2023-02-03 23:44:15 +01:00
|
|
|
using OSMDatastructure;
|
|
|
|
|
2023-02-03 23:36:43 +01:00
|
|
|
namespace Pathfinding;
|
|
|
|
|
|
|
|
public class PathNode : OSMDatastructure.Node
|
|
|
|
{
|
2023-02-03 23:44:15 +01:00
|
|
|
PathNode? previousNode = null;
|
|
|
|
private Dictionary<Connection, double> distanceDictionary = new();
|
|
|
|
double currentWeight = double.MaxValue;
|
|
|
|
|
|
|
|
|
2023-02-03 23:36:43 +01:00
|
|
|
public PathNode(float lat, float lon) : base(lat, lon)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2023-02-03 23:44:15 +01:00
|
|
|
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-02-03 23:36:43 +01:00
|
|
|
}
|