OSMServer/OSMSplitter/RegionCollection.cs

25 lines
631 B
C#
Raw Normal View History

using OSMDatastructure;
namespace OSMImporter;
internal class RegionCollection
{
private readonly Dictionary<ulong, Region> _regions = new();
public Region GetRegion(Coordinates coordinates)
{
if(this._regions.ContainsKey(coordinates.GetRegionHash()))
return this._regions[coordinates.GetRegionHash()];
else
{
Region newRegion = new Region(coordinates);
this._regions.Add(newRegion.regionHash, value: newRegion);
return newRegion;
}
}
public Region[] GetAllRegions()
{
return this._regions.Values.ToArray();
}
}