From ac77708834892ebcdad476b0a2eb46684cb76550 Mon Sep 17 00:00:00 2001 From: glax Date: Fri, 31 Mar 2023 21:55:43 +0200 Subject: [PATCH] Renamed OsmEdge to OsmWay and added startnodeid (for serialization) --- OSMDatastructure/OsmNode.cs | 6 +++--- OSMDatastructure/{OSMEdge.cs => OsmWay.cs} | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) rename OSMDatastructure/{OSMEdge.cs => OsmWay.cs} (60%) diff --git a/OSMDatastructure/OsmNode.cs b/OSMDatastructure/OsmNode.cs index 507aa2f..1d620e1 100644 --- a/OSMDatastructure/OsmNode.cs +++ b/OSMDatastructure/OsmNode.cs @@ -4,7 +4,7 @@ namespace OSMDatastructure.Graph; public class OsmNode { public ulong nodeId { get; } - public HashSet edges { get; } + public HashSet 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; diff --git a/OSMDatastructure/OSMEdge.cs b/OSMDatastructure/OsmWay.cs similarity index 60% rename from OSMDatastructure/OSMEdge.cs rename to OSMDatastructure/OsmWay.cs index c1aec95..7557a66 100644 --- a/OSMDatastructure/OSMEdge.cs +++ b/OSMDatastructure/OsmWay.cs @@ -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; }