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 ulong nodeId { get; }
public HashSet<OsmEdge> edges { get; }
public HashSet<OsmWay> edges { get; }
public Coordinates coordinates { get; }
[NonSerialized]public OsmNode? previousPathNode = null;
@ -26,9 +26,9 @@ public class OsmNode
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)
return e;
return null;

View File

@ -1,17 +1,19 @@
namespace OSMDatastructure.Graph;
[Serializable]
public class OsmEdge
public class OsmWay
{
public ulong wayId { get; }
public ulong startId { get; }
public ulong neighborId { 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.neighborId = neighborID;
this.wayId = wayId;
this.startId = startId;
this.neighborId = neighborId;
this.neighborRegion = neighborRegion;
}