Add IsPriorityRoad to Way

This commit is contained in:
glax 2024-07-25 02:19:52 +02:00
parent a365c155b2
commit 334ff16253

View File

@ -9,6 +9,14 @@ public class Way(ulong id, Dictionary<string, string> tags, List<ulong> nodeIds)
public readonly ulong ID = id; public readonly ulong ID = id;
public readonly List<ulong> NodeIds = nodeIds; public readonly List<ulong> NodeIds = nodeIds;
public bool IsPriorityRoad()
{
string[] priorityValues = ["yes", "designated", "yes_unposted"];
if (Tags.TryGetValue("priority_road", out string? priorityValue))
return priorityValues.Contains(priorityValue);
return false;
}
public AccessEnum AccessType() public AccessEnum AccessType()
{ {
if (Tags.TryGetValue("access", out string? accessValue) && Enum.TryParse(accessValue, out AccessEnum access)) if (Tags.TryGetValue("access", out string? accessValue) && Enum.TryParse(accessValue, out AccessEnum access))