2025-02-27 18:46:32 +01:00
|
|
|
|
using ProjNet.CoordinateSystems;
|
2022-01-21 00:17:01 +01:00
|
|
|
|
using System;
|
2018-08-29 20:54:42 +02:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl.Projections
|
|
|
|
|
|
{
|
2022-12-14 18:02:19 +01:00
|
|
|
|
/// <summary>
|
2026-01-10 08:28:10 +01:00
|
|
|
|
/// WGS84 Universal Transverse Mercator Projection.
|
2022-12-14 18:02:19 +01:00
|
|
|
|
/// </summary>
|
2026-01-15 11:04:11 +01:00
|
|
|
|
public class Wgs84UtmProjection : ProjNetMapProjection
|
2018-08-29 20:54:42 +02:00
|
|
|
|
{
|
2022-12-14 18:02:19 +01:00
|
|
|
|
public const int FirstZone = 1;
|
|
|
|
|
|
public const int LastZone = 60;
|
|
|
|
|
|
public const int FirstZoneNorthEpsgCode = 32600 + FirstZone;
|
|
|
|
|
|
public const int LastZoneNorthEpsgCode = 32600 + LastZone;
|
|
|
|
|
|
public const int FirstZoneSouthEpsgCode = 32700 + FirstZone;
|
|
|
|
|
|
public const int LastZoneSouthEpsgCode = 32700 + LastZone;
|
|
|
|
|
|
|
|
|
|
|
|
public int Zone { get; private set; }
|
2026-01-10 16:21:55 +01:00
|
|
|
|
public Hemisphere Hemisphere { get; private set; }
|
2022-12-14 18:02:19 +01:00
|
|
|
|
|
2026-01-10 16:21:55 +01:00
|
|
|
|
public Wgs84UtmProjection(int zone, Hemisphere hemisphere)
|
2018-10-03 11:27:55 +02:00
|
|
|
|
{
|
2026-01-10 16:21:55 +01:00
|
|
|
|
SetZone(zone, hemisphere);
|
2022-12-14 18:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-10 16:21:55 +01:00
|
|
|
|
protected void SetZone(int zone, Hemisphere hemisphere)
|
2022-12-14 18:02:19 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (zone < FirstZone || zone > LastZone)
|
2022-01-21 00:17:01 +01:00
|
|
|
|
{
|
2022-12-14 18:02:19 +01:00
|
|
|
|
throw new ArgumentException($"Invalid WGS84 UTM zone {zone}.", nameof(zone));
|
2022-01-21 00:17:01 +01:00
|
|
|
|
}
|
2018-10-03 11:27:55 +02:00
|
|
|
|
|
2022-12-14 18:02:19 +01:00
|
|
|
|
Zone = zone;
|
2026-01-10 16:21:55 +01:00
|
|
|
|
Hemisphere = hemisphere;
|
2026-01-10 21:36:22 +01:00
|
|
|
|
CoordinateSystem = ProjectedCoordinateSystem.WGS84_UTM(zone, hemisphere == Hemisphere.North);
|
2022-12-14 18:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-08-29 20:54:42 +02:00
|
|
|
|
}
|