39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System.Diagnostics.Tracing;
|
|
using System.Text.Json.Serialization;
|
|
using OSMDatastructure;
|
|
using OSMDatastructure.Graph;
|
|
|
|
namespace Pathfinding;
|
|
|
|
public class PathNode : OsmNode
|
|
{
|
|
[JsonInclude]public Dictionary<string, string> tags = new();
|
|
|
|
[JsonConstructor]
|
|
public PathNode(ulong nodeId, Coordinates coordinates, Dictionary<string, string> tags) : base(nodeId, coordinates)
|
|
{
|
|
this.tags = tags;
|
|
}
|
|
|
|
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, HashSet<Tag>? tags)
|
|
{
|
|
if (node is null)
|
|
return null;
|
|
PathNode retNode = new(node.nodeId, node.coordinates);
|
|
if (tags != null)
|
|
foreach (Tag tag in tags)
|
|
{
|
|
retNode.tags.Add(tag.key.ToString(), tag.value.ToString());
|
|
}
|
|
|
|
return retNode;
|
|
}
|
|
} |