Added GetNode(Coordinates coordinates)

Added GetNode(ulong id)
Instead of returning null in LoadRegion now throw an exception when file is not found.
Added some Method descriptors
This commit is contained in:
2023-02-05 20:02:22 +01:00
parent 8c8aadc2e1
commit 3350d8e3b9
2 changed files with 53 additions and 10 deletions

View File

@ -2,7 +2,7 @@ namespace OSMDatastructure
{
public class Region
{
public const float regionSize = 0.01f;
public const float regionSize = 0.01f; //For Splitting
private readonly Dictionary<ulong, Node> _nodesInRegion = new();
public ulong regionHash { get; }
@ -36,6 +36,16 @@ namespace OSMDatastructure
{
return this._nodesInRegion.ContainsKey(id) ? this._nodesInRegion[id] : null;
}
public Node? GetNode(Coordinates coordinates)
{
foreach (Node node in this._nodesInRegion.Values)
{
if (node.Equals(coordinates))
return node;
}
return null;
}
}
}