OSMServer/OSMDatastructure/Region.cs

35 lines
919 B
C#

namespace OSMDatastructure
{
public class Region
{
private readonly Dictionary<ulong, Node> _nodesInRegion = new();
public ulong regionHash { get; }
public Region(Coordinates regionCoordinates, float regionSize)
{
this.regionHash = regionCoordinates.GetRegionHash(regionSize);
}
public Region(ulong nodeId, Node firstNode, float regionSize)
{
this.regionHash = firstNode.GetRegionHash(regionSize);
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;
}
}
}