OSMServer/Pathfinding/PathNode.cs

32 lines
1023 B
C#
Raw Normal View History

using System.Text.Json.Serialization;
using OSMDatastructure.Graph;
namespace Pathfinding;
public class PathNode : OsmNode
{
[JsonInclude]public new double currentPathWeight = double.MaxValue;
[JsonInclude]public new double currentPathLength = double.MaxValue;
[JsonInclude]public new double directDistanceToGoal = double.MaxValue;
public PathNode(ulong nodeId, float lat, float lon) : base(nodeId, lat, lon)
{
}
public PathNode(ulong nodeId, Coordinates coordinates) : base(nodeId, coordinates)
{
}
public static PathNode? FromOsmNode(OsmNode? node)
{
if (node is null)
return null;
PathNode retNode = new PathNode(node.nodeId, node.coordinates)
{
currentPathLength = node.currentPathLength,
2023-04-09 17:02:56 +02:00
currentPathWeight = double.IsPositiveInfinity(node.currentPathWeight) ? double.MaxValue : node.currentPathWeight,
directDistanceToGoal = node.directDistanceToGoal
};
return retNode;
}
}