Compare commits
2 Commits
bea789f625
...
a0418a6fae
Author | SHA1 | Date | |
---|---|---|---|
a0418a6fae | |||
2bf19d1095 |
@ -61,14 +61,20 @@ public class RegionLoader(float regionSize, string? importFolderPath = null, ILo
|
||||
{
|
||||
ulong node1Id = w.NodeIds[i - 1];
|
||||
ulong node2Id = w.NodeIds[i];
|
||||
if (ret.Nodes.TryGetValue(node1Id, out Graph.Node? node1) && ret.Nodes.TryGetValue(node2Id, out Graph.Node? node2))
|
||||
if (ret.Nodes.TryGetValue(node1Id, out Graph.Node? node1))
|
||||
{
|
||||
node1.Neighbors.TryAdd(node2Id, w.ID);
|
||||
node2.Neighbors.TryAdd(node1Id, w.ID);
|
||||
//TODO add oneway checks
|
||||
node1.Neighbors.TryAdd(node2Id, w.ID);
|
||||
}
|
||||
if (ret.Nodes.TryGetValue(node2Id, out Graph.Node? node2))
|
||||
{
|
||||
//TODO add oneway checks
|
||||
node2.Neighbors.TryAdd(node1Id, w.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
nodesReader.Dispose();
|
||||
waysReader.Dispose();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -76,7 +82,7 @@ public class RegionLoader(float regionSize, string? importFolderPath = null, ILo
|
||||
public Graph.Graph? LoadRegionFromNodeId(ulong nodeId)
|
||||
{
|
||||
logger?.LogDebug($"Loading Region for Node {nodeId}");
|
||||
StreamReader nodesMapFileStream = new(Path.Join(ImportFolderPath, NodesMapRegionFileName), Encoding.ASCII);
|
||||
using StreamReader nodesMapFileStream = new(Path.Join(ImportFolderPath, NodesMapRegionFileName), Encoding.ASCII);
|
||||
while (!nodesMapFileStream.EndOfStream)
|
||||
{
|
||||
string? line = nodesMapFileStream.ReadLine();
|
||||
@ -101,7 +107,7 @@ public class RegionLoader(float regionSize, string? importFolderPath = null, ILo
|
||||
public Graph.Graph?[] LoadRegionsFromWayId(ulong wayId)
|
||||
{
|
||||
logger?.LogDebug($"Loading Region for Way {wayId}");
|
||||
StreamReader waysMapFileStream = new(Path.Join(ImportFolderPath, WayMapRegionFileName), Encoding.ASCII);
|
||||
using StreamReader waysMapFileStream = new(Path.Join(ImportFolderPath, WayMapRegionFileName), Encoding.ASCII);
|
||||
while (!waysMapFileStream.EndOfStream)
|
||||
{
|
||||
string? line = waysMapFileStream.ReadLine();
|
||||
|
Loading…
Reference in New Issue
Block a user