OSMServer/OSMDatastructure/Region.cs

28 lines
648 B
C#

using OSMDatastructure.Graph;
namespace OSMDatastructure;
public class Region
{
public const float RegionSize = 0.01f;
public readonly HashSet<OsmNode> nodes = new();
public int regionHash { get; }
public Region(int regionHash)
{
this.regionHash = regionHash;
}
public Region(Coordinates coordinates)
{
regionHash = Coordinates.GetRegionHashCode(coordinates);
}
public OsmNode? GetNodeWithCoordinates(Coordinates coordinates)
{
foreach(OsmNode node in this.nodes)
if (node.coordinates.Equals(coordinates))
return node;
return null;
}
}