OSMServer/OSMDatastructure/OsmNode.cs

31 lines
781 B
C#

namespace OSMDatastructure;
public class OsmNode
{
public 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)
{
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;
}
}