41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
namespace OSMDatastructure
|
|
{
|
|
public class Region
|
|
{
|
|
public const float regionSize = 0.01f;
|
|
private readonly Dictionary<ulong, Node> _nodesInRegion = new();
|
|
public ulong regionHash { get; }
|
|
|
|
public Region(Coordinates regionCoordinates)
|
|
{
|
|
this.regionHash = regionCoordinates.GetRegionHash();
|
|
}
|
|
|
|
public Region(ulong nodeId, Node firstNode)
|
|
{
|
|
this.regionHash = firstNode.GetRegionHash();
|
|
this._nodesInRegion.Add(nodeId, value: firstNode);
|
|
}
|
|
|
|
public Region(ulong regionHash)
|
|
{
|
|
this.regionHash = regionHash;
|
|
}
|
|
|
|
public void AddNode(ulong nodeId, Node node)
|
|
{
|
|
this._nodesInRegion.Add(nodeId, value: node);
|
|
}
|
|
|
|
public Dictionary<ulong, Node> GetNodes()
|
|
{
|
|
return this._nodesInRegion;
|
|
}
|
|
|
|
public Node? GetNode(ulong id)
|
|
{
|
|
return this._nodesInRegion.ContainsKey(id) ? this._nodesInRegion[id] : null;
|
|
}
|
|
|
|
}
|
|
} |