Renamed PathNode distance and weight to include "delta".

Added directDistanceDelta
This commit is contained in:
2023-04-09 17:52:37 +02:00
parent 6eab23ff16
commit d8f8a41dcc
2 changed files with 15 additions and 10 deletions

View File

@ -38,17 +38,20 @@ public static partial class Pathfinder
while (currentNode is not null)
{
HashSet<Tag>? tags = null;
double distance = 0;
double weight = 0;
double pathDistanceDelta = 0;
double pathWeightDelta = 0;
double directDistanceDelta = 0;
if (currentNode.previousPathNode is not null)
{
OsmEdge edge = currentNode.previousPathNode!.edges.First(e => e.neighborId.Equals(currentNode.nodeId));
tags = regionManager.GetRegion(currentNode.coordinates)!.tagManager.GetTagsForWayId(edge.wayId);
distance = currentNode.currentPathLength - currentNode.previousPathNode.currentPathLength;
weight = currentNode.currentPathWeight - currentNode.previousPathNode.currentPathWeight;
pathDistanceDelta = currentNode.currentPathLength - currentNode.previousPathNode.currentPathLength;
pathWeightDelta = currentNode.currentPathWeight - currentNode.previousPathNode.currentPathWeight;
directDistanceDelta =
currentNode.directDistanceToGoal - currentNode.previousPathNode.directDistanceToGoal;
}
PathNode? pn = PathNode.FromOsmNode(currentNode, tags, distance, weight);
PathNode? pn = PathNode.FromOsmNode(currentNode, tags, pathDistanceDelta, pathWeightDelta, directDistanceDelta);
if(pn is not null)
path.Add(pn!);
currentNode = currentNode.previousPathNode;