OSMServer/OSMDatastructure/Region.cs
2023-03-30 18:24:57 +02:00

32 lines
802 B
C#

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