OSMServer/OSMDatastructure/OsmNode.cs
2023-02-06 17:32:55 +01:00

33 lines
891 B
C#

using GeoGraph;
namespace OSMDatastructure;
public class OsmNode : Node
{
public new HashSet<OsmEdge> 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) : base(lat, lon)
{
this.edges = new();
this.coordinates = new Coordinates(lat, lon);
}
public OsmNode(Coordinates coordinates) : base(coordinates.latitude, coordinates.longitude)
{
this.edges = new();
this.coordinates = new Coordinates(lat, lon);
}
public OsmEdge? GetEdgeToNode(OsmNode n)
{
foreach (OsmEdge e in this.edges)
if (e.neighborCoordinates.Equals(n.coordinates))
return e;
return null;
}
}