From 334ff16253073b615a282255313972909bfec2d0 Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 25 Jul 2024 02:19:52 +0200 Subject: [PATCH] Add IsPriorityRoad to Way --- OSM_Graph/Way.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OSM_Graph/Way.cs b/OSM_Graph/Way.cs index 773a351..9ebd546 100644 --- a/OSM_Graph/Way.cs +++ b/OSM_Graph/Way.cs @@ -9,6 +9,14 @@ public class Way(ulong id, Dictionary tags, List nodeIds) public readonly ulong ID = id; public readonly List 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() { if (Tags.TryGetValue("access", out string? accessValue) && Enum.TryParse(accessValue, out AccessEnum access))