OSMServer/OSMDatastructure/Region.cs

35 lines
919 B
C#
Raw Normal View History

namespace OSMDatastructure
2023-02-02 22:30:43 +01:00
{
public class Region
{
private readonly Dictionary<ulong, Node> _nodesInRegion = new();
2023-02-02 22:30:43 +01:00
public ulong regionHash { get; }
public Region(Coordinates regionCoordinates, float regionSize)
2023-02-02 22:30:43 +01:00
{
this.regionHash = regionCoordinates.GetRegionHash(regionSize);
2023-02-02 22:30:43 +01:00
}
public Region(ulong nodeId, Node firstNode, float regionSize)
2023-02-02 22:30:43 +01:00
{
this.regionHash = firstNode.GetRegionHash(regionSize);
2023-02-02 22:30:43 +01:00
this._nodesInRegion.Add(nodeId, value: firstNode);
}
public Region(ulong regionHash)
{
this.regionHash = regionHash;
}
2023-02-02 22:30:43 +01:00
public void AddNode(ulong nodeId, Node node)
{
this._nodesInRegion.Add(nodeId, value: node);
}
2023-02-03 00:02:04 +01:00
public Dictionary<ulong, Node> GetNodes()
2023-02-02 22:30:43 +01:00
{
2023-02-03 00:02:04 +01:00
return this._nodesInRegion;
2023-02-02 22:30:43 +01:00
}
2023-02-02 22:30:43 +01:00
}
}