Removed unnecessary Object creation

Added logline after load of region.
This commit is contained in:
glax 2024-07-24 01:16:12 +02:00
parent f122a5fadf
commit 7833eb5e83

View File

@ -46,7 +46,7 @@ public class RegionLoader(float regionSize, string? importFolderPath = null, ILo
if(line is null) if(line is null)
continue; continue;
Node n = Node.Deserialize(line); Node n = Node.Deserialize(line);
ret.Nodes.Add(n.ID, new Graph.Node(n.Lat, n.Lon)); ret.Nodes.Add(n.ID, n);
} }
logger?.LogDebug($"Loading Ways {waysPath}"); logger?.LogDebug($"Loading Ways {waysPath}");
@ -56,7 +56,7 @@ public class RegionLoader(float regionSize, string? importFolderPath = null, ILo
if(line is null) if(line is null)
continue; continue;
Way w = Way.Deserialize(line); Way w = Way.Deserialize(line);
ret.Ways.Add(w.ID, new Graph.Way(w.Tags)); ret.Ways.Add(w.ID, w);
for (int i = 1; i < w.NodeIds.Count; i++) for (int i = 1; i < w.NodeIds.Count; i++)
{ {
ulong node1Id = w.NodeIds[i - 1]; ulong node1Id = w.NodeIds[i - 1];
@ -74,6 +74,7 @@ public class RegionLoader(float regionSize, string? importFolderPath = null, ILo
nodesReader.Dispose(); nodesReader.Dispose();
waysReader.Dispose(); waysReader.Dispose();
logger?.LogDebug($"Loaded Region {regionId} {ret.Nodes.Count} Nodes {ret.Ways.Count} Ways");
return ret; return ret;
} }