From 6b496957d7f324907fdc6cc802ccc8ecc6c4b7d5 Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 9 Apr 2023 23:55:24 +0200 Subject: [PATCH] Fixes for oneway-change --- OSMDatastructure/Tag.cs | 5 ++--- OSMDatastructure/TagManager.cs | 5 +++-- Server/RegionConverter.cs | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/OSMDatastructure/Tag.cs b/OSMDatastructure/Tag.cs index 2be1496..3230358 100644 --- a/OSMDatastructure/Tag.cs +++ b/OSMDatastructure/Tag.cs @@ -62,13 +62,11 @@ public class Tag byte speed = Convert.ToByte(value); if (speed != 255) ret.Add(new Tag(TagType.maxspeed, speed)); - break; } catch (Exception) { ret.Add(new Tag(TagType.maxspeed, byte.MinValue)); } - break; case "oneway": switch (value) @@ -84,7 +82,8 @@ public class Tag ret.Add(new Tag(TagType.oneway, false)); break; } - return null; + + break; case "name": ret.Add(new Tag(TagType.name, value)); break; diff --git a/OSMDatastructure/TagManager.cs b/OSMDatastructure/TagManager.cs index dee1746..9420384 100644 --- a/OSMDatastructure/TagManager.cs +++ b/OSMDatastructure/TagManager.cs @@ -26,8 +26,9 @@ public class TagManager public void AddTag(ulong wayId, string key, string value) { HashSet pTags = Tag.ConvertToTags(key, value); - foreach (Tag pTag in pTags) - AddTag(wayId, pTag); + if(pTags.Count > 0) + foreach (Tag pTag in pTags) + AddTag(wayId, pTag); } public void AddTag(ulong wayId, Tag tag) diff --git a/Server/RegionConverter.cs b/Server/RegionConverter.cs index be830bb..8d81120 100644 --- a/Server/RegionConverter.cs +++ b/Server/RegionConverter.cs @@ -130,8 +130,9 @@ public class RegionConverter if (wayReader.Name == "tag") { HashSet pTags = Tag.ConvertToTags(wayReader.GetAttribute("k")!, wayReader.GetAttribute("v")!); - foreach (Tag pTag in pTags) - currentTags.TryAdd(pTag.key, pTag.value); + if(pTags.Count > 0) + foreach (Tag pTag in pTags) + currentTags.TryAdd(pTag.key, pTag.value); } else if (wayReader.Name == "nd") {