Renamed OsmEdge to OsmWay and added startnodeid (for serialization)

This commit is contained in:
glax 2023-03-31 21:55:43 +02:00
parent 255d924dc4
commit ac77708834
2 changed files with 9 additions and 7 deletions

View File

@ -4,7 +4,7 @@ namespace OSMDatastructure.Graph;
public class OsmNode public class OsmNode
{ {
public ulong nodeId { get; } public ulong nodeId { get; }
public HashSet<OsmEdge> edges { get; } public HashSet<OsmWay> edges { get; }
public Coordinates coordinates { get; } public Coordinates coordinates { get; }
[NonSerialized]public OsmNode? previousPathNode = null; [NonSerialized]public OsmNode? previousPathNode = null;
@ -26,9 +26,9 @@ public class OsmNode
this.coordinates = coordinates; this.coordinates = coordinates;
} }
public OsmEdge? GetEdgeToNode(OsmNode n) public OsmWay? GetEdgeToNode(OsmNode n)
{ {
foreach (OsmEdge e in this.edges) foreach (OsmWay e in this.edges)
if (e.neighborId == n.nodeId) if (e.neighborId == n.nodeId)
return e; return e;
return null; return null;

View File

@ -1,17 +1,19 @@
namespace OSMDatastructure.Graph; namespace OSMDatastructure.Graph;
[Serializable] [Serializable]
public class OsmEdge public class OsmWay
{ {
public ulong wayId { get; } public ulong wayId { get; }
public ulong startId { get; }
public ulong neighborId { get; } public ulong neighborId { get; }
public ulong neighborRegion { get; } public ulong neighborRegion { get; }
public OsmEdge(ulong wayID, ulong neighborID, ulong neighborRegion) public OsmWay(ulong wayId, ulong startId, ulong neighborId, ulong neighborRegion)
{ {
this.wayId = wayID; this.wayId = wayId;
this.neighborId = neighborID; this.startId = startId;
this.neighborId = neighborId;
this.neighborRegion = neighborRegion; this.neighborRegion = neighborRegion;
} }