From 4f98563a1e9b0bac0d3ca3657a6d9c2a4831f75c Mon Sep 17 00:00:00 2001 From: glax Date: Tue, 23 Jul 2024 23:14:33 +0200 Subject: [PATCH] Change RemoveAllNonHighways wayIDs, nodeIds to Hashsets --- OSM_Regions/Converter.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OSM_Regions/Converter.cs b/OSM_Regions/Converter.cs index 6818504..8d5abb7 100644 --- a/OSM_Regions/Converter.cs +++ b/OSM_Regions/Converter.cs @@ -168,8 +168,8 @@ public class Converter(float regionSize, string? exportFolderPath = null, ILogge int count = 0; DateTime print = DateTime.Now; DateTime start = DateTime.Now; - List wayIds = new(); - List nodeIds = new(); + HashSet wayIds = new(); + HashSet nodeIds = new(); foreach (string path in wayRegionsPaths) { if (DateTime.Now - print > TimeSpan.FromSeconds(2)) @@ -198,7 +198,8 @@ public class Converter(float regionSize, string? exportFolderPath = null, ILogge { waysStreamWriter.WriteLine(line); wayIds.Add(w.ID); - nodeIds.AddRange(w.NodeIds); + foreach (ulong nodeId in w.NodeIds) + nodeIds.Add(nodeId); hasWritten = true; }else logger?.LogTrace($"Way {w.ID} is not a highway. BYE!");