namespace OSMDatastructure; public class OsmNode { public HashSet edges { get; } public Coordinates coordinates { get; } public OsmNode? previousPathNode = null; public double currentPathWeight = double.MaxValue; public double directDistanceToGoal = double.MaxValue; public OsmNode(float lat, float lon) { this.edges = new(); this.coordinates = new Coordinates(lat, lon); } public OsmNode(Coordinates coordinates) { this.edges = new(); this.coordinates = coordinates; } public OsmEdge? GetEdgeToNode(OsmNode n) { foreach (OsmEdge e in this.edges) if (e.neighborCoordinates.Equals(n.coordinates)) return e; return null; } public override bool Equals(object? obj) { return obj != null && obj.GetType() == this.GetType() && ((OsmNode)obj).coordinates.Equals(this.coordinates); } public override int GetHashCode() { return HashCode.Combine(coordinates); } public override string ToString() { if(this.previousPathNode != null) return string.Format( "NODE {0} Edges-Count: {1} previousPathNode: {2} currentPathWeight: {3} directDistanceToGoal: {4}", this.coordinates.ToString(), this.edges.Count, this.previousPathNode.coordinates.ToString(), this.currentPathWeight, this.directDistanceToGoal); else return string.Format( "NODE {0} Edges-Count: {1} previousPathNode: NO PREVIOUS NODE currentPathWeight: {2} directDistanceToGoal: {3}", this.coordinates.ToString(), this.edges.Count, this.currentPathWeight, this.directDistanceToGoal); } }