2023-04-13 19:18:25 +02:00
|
|
|
using System.Diagnostics.Tracing;
|
2023-04-06 14:27:25 +02:00
|
|
|
using System.Text.Json.Serialization;
|
2023-04-09 17:38:57 +02:00
|
|
|
using OSMDatastructure;
|
2023-04-06 14:27:25 +02:00
|
|
|
using OSMDatastructure.Graph;
|
|
|
|
|
|
|
|
namespace Pathfinding;
|
|
|
|
|
|
|
|
public class PathNode : OsmNode
|
|
|
|
{
|
2023-04-09 17:38:57 +02:00
|
|
|
[JsonInclude]public Dictionary<string, string> tags = new();
|
2023-04-13 19:18:25 +02:00
|
|
|
|
|
|
|
[JsonConstructor]
|
|
|
|
public PathNode(ulong nodeId, Coordinates coordinates, Dictionary<string, string> tags) : base(nodeId, coordinates)
|
|
|
|
{
|
|
|
|
this.tags = tags;
|
|
|
|
}
|
2023-04-09 17:38:57 +02:00
|
|
|
|
2023-04-06 14:27:25 +02:00
|
|
|
public PathNode(ulong nodeId, float lat, float lon) : base(nodeId, lat, lon)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public PathNode(ulong nodeId, Coordinates coordinates) : base(nodeId, coordinates)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-04-11 01:04:19 +02:00
|
|
|
public static PathNode? FromOsmNode(OsmNode? node, HashSet<Tag>? tags)
|
2023-04-06 14:27:25 +02:00
|
|
|
{
|
|
|
|
if (node is null)
|
|
|
|
return null;
|
2023-04-11 01:04:19 +02:00
|
|
|
PathNode retNode = new(node.nodeId, node.coordinates);
|
2023-04-09 17:38:57 +02:00
|
|
|
if (tags != null)
|
|
|
|
foreach (Tag tag in tags)
|
|
|
|
{
|
|
|
|
retNode.tags.Add(tag.key.ToString(), tag.value.ToString());
|
|
|
|
}
|
|
|
|
|
2023-04-06 14:27:25 +02:00
|
|
|
return retNode;
|
|
|
|
}
|
|
|
|
}
|