27 lines
586 B
C#
27 lines
586 B
C#
|
using System.Diagnostics;
|
||
|
|
||
|
namespace OSMServer;
|
||
|
|
||
|
public class Coordinates
|
||
|
{
|
||
|
public float lat { get; }
|
||
|
public float lon { get; }
|
||
|
|
||
|
public Coordinates(float lat, float lon)
|
||
|
{
|
||
|
this.lat = lat;
|
||
|
this.lon = lon;
|
||
|
}
|
||
|
|
||
|
public uint GetHash()
|
||
|
{
|
||
|
return Convert.ToUInt32((this.lat * 10000f + this.lon) * 10000f);
|
||
|
}
|
||
|
|
||
|
public uint GetRegionHash()
|
||
|
{
|
||
|
float latRegion = this.lat % Importer.regionSize;
|
||
|
float lonRegion = this.lon % Importer.regionSize;
|
||
|
return new Coordinates(latRegion, lonRegion).GetHash();
|
||
|
}
|
||
|
}
|