27 lines
770 B
C#
27 lines
770 B
C#
using OSMDatastructure;
|
|
|
|
namespace Pathfinding;
|
|
|
|
public class PathNode : OSMDatastructure.Node
|
|
{
|
|
PathNode? previousNode = null;
|
|
private Dictionary<Connection, double> distanceDictionary = new();
|
|
double currentWeight = double.MaxValue;
|
|
|
|
|
|
public PathNode(float lat, float lon) : base(lat, lon)
|
|
{
|
|
|
|
}
|
|
|
|
public double? DistanceTo(Connection connection)
|
|
{
|
|
if (!this.GetConnections().Contains(connection))
|
|
return null; //TODO exception is not actually connected
|
|
if (!this.distanceDictionary.ContainsKey(connection))
|
|
this.distanceDictionary.Add(connection, Utils.DistanceBetween(this, connection.endNodeCoordinates));
|
|
return this.distanceDictionary[connection];
|
|
}
|
|
|
|
|
|
} |