OSMServer/Importer/RegionManager.cs
2023-02-02 19:03:00 +01:00

28 lines
680 B
C#

namespace OSMServer;
public class RegionManager
{
private Dictionary<uint, Region> regions;
public RegionManager()
{
this.regions = new Dictionary<uint, Region>();
}
public Region GetRegion(Coordinates coordinates)
{
if(this.regions.ContainsKey(coordinates.GetRegionHash()))
return this.regions[coordinates.GetRegionHash()];
else
{
Region newRegion = new Region(coordinates.GetRegionHash());
this.regions.Add(newRegion.regionHash, newRegion);
return newRegion;
}
}
public Region[] GetAllRegions()
{
return this.regions.Values.ToArray();
}
}