OSMServer/OSMDatastructure/Region.cs
glax 806dcf98c9 Renamed OsmWay -> OsmEdge again
Prevented duplicate writes of Tags for way
2023-04-01 01:47:56 +02:00

33 lines
852 B
C#

using OSMDatastructure.Graph;
namespace OSMDatastructure;
[Serializable]
public class Region
{
[NonSerialized]public const float RegionSize = 0.1f;
public readonly HashSet<OsmNode> nodes = new();
public readonly HashSet<OsmEdge> ways = 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;
}
}