Added weight and distance delta to pathnode
This commit is contained in:
@ -38,16 +38,20 @@ public static partial class Pathfinder
|
||||
while (currentNode is not null)
|
||||
{
|
||||
HashSet<Tag>? tags = null;
|
||||
double distance = 0;
|
||||
double weight = 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;
|
||||
}
|
||||
|
||||
currentNode = currentNode.previousPathNode;
|
||||
PathNode? pn = PathNode.FromOsmNode(currentNode, tags);
|
||||
PathNode? pn = PathNode.FromOsmNode(currentNode, tags, distance, weight);
|
||||
if(pn is not null)
|
||||
path.Add(pn!);
|
||||
currentNode = currentNode.previousPathNode;
|
||||
}
|
||||
|
||||
path.Reverse();
|
||||
|
Reference in New Issue
Block a user