33 lines
852 B
C#
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;
|
|
}
|
|
} |