correct node for closest.
This commit is contained in:
parent
bb789e731d
commit
5289020d44
@ -95,14 +95,13 @@ namespace Pathfinding
|
|||||||
hasConnectionUsingVehicle = false;
|
hasConnectionUsingVehicle = false;
|
||||||
foreach (OsmEdge edge in node.edges)
|
foreach (OsmEdge edge in node.edges)
|
||||||
{
|
{
|
||||||
byte speed = GetSpeedForEdge(node, edge.wayId, vehicle);
|
if (TestValidConnectionForType(node, edge, vehicle))
|
||||||
if (speed != 0)
|
|
||||||
hasConnectionUsingVehicle = true;
|
hasConnectionUsingVehicle = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double nodeDistance = Utils.DistanceBetween(node, coordinates);
|
double nodeDistance = Utils.DistanceBetween(node, coordinates);
|
||||||
if (nodeDistance < distance && hasConnectionUsingVehicle)
|
if (hasConnectionUsingVehicle && nodeDistance < distance)
|
||||||
{
|
{
|
||||||
closest = node;
|
closest = node;
|
||||||
distance = nodeDistance;
|
distance = nodeDistance;
|
||||||
@ -121,7 +120,7 @@ namespace Pathfinding
|
|||||||
{
|
{
|
||||||
case Tag.SpeedType.pedestrian:
|
case Tag.SpeedType.pedestrian:
|
||||||
speed = Tag.defaultSpeedPedestrian[wayType];
|
speed = Tag.defaultSpeedPedestrian[wayType];
|
||||||
return speed is not 0 ? speed : (byte)0;
|
return speed;
|
||||||
case Tag.SpeedType.car:
|
case Tag.SpeedType.car:
|
||||||
byte? maxSpeed = (byte?)tags.GetTag(wayId, Tag.TagType.maxspeed);
|
byte? maxSpeed = (byte?)tags.GetTag(wayId, Tag.TagType.maxspeed);
|
||||||
speed = Tag.defaultSpeedCar[wayType];
|
speed = Tag.defaultSpeedCar[wayType];
|
||||||
|
Reference in New Issue
Block a user