diff --git a/MapControl/Shared/PolarStereographicProjection.cs b/MapControl/Shared/PolarStereographicProjection.cs index 0f461601..8fc545cd 100644 --- a/MapControl/Shared/PolarStereographicProjection.cs +++ b/MapControl/Shared/PolarStereographicProjection.cs @@ -15,14 +15,6 @@ namespace MapControl /// public class PolarStereographicProjection : MapProjection { - public PolarStereographicProjection(bool north) - { - LatitudeOfOrigin = north ? 90d : -90d; - ScaleFactor = 0.994; - FalseEasting = 2e6; - FalseNorthing = 2e6; - } - public override double GridConvergence(double latitude, double longitude) { return Math.Sign(LatitudeOfOrigin) * (longitude - CentralMeridian); @@ -99,9 +91,13 @@ namespace MapControl { } - public Wgs84UpsNorthProjection(string crsId) : base(true) + public Wgs84UpsNorthProjection(string crsId) { CrsId = crsId; + ScaleFactor = 0.994; + LatitudeOfOrigin = 90d; + FalseEasting = 2e6; + FalseNorthing = 2e6; } } @@ -117,9 +113,13 @@ namespace MapControl { } - public Wgs84UpsSouthProjection(string crsId) : base(false) + public Wgs84UpsSouthProjection(string crsId) { CrsId = crsId; + ScaleFactor = 0.994; + LatitudeOfOrigin = -90d; + FalseEasting = 2e6; + FalseNorthing = 2e6; } } } diff --git a/MapControl/Shared/TransverseMercatorProjection.cs b/MapControl/Shared/TransverseMercatorProjection.cs index c1db6dad..dcfc24d1 100644 --- a/MapControl/Shared/TransverseMercatorProjection.cs +++ b/MapControl/Shared/TransverseMercatorProjection.cs @@ -29,17 +29,10 @@ namespace MapControl private readonly double d3; // δ3 private readonly double A; - public TransverseMercatorProjection( - double equatorialRadius, double flattening, - double scaleFactor, double centralMeridian, - double falseEasting, double falseNorthing = 0d) + protected TransverseMercatorProjection(double equatorialRadius, double flattening) { EquatorialRadius = equatorialRadius; Flattening = flattening; - ScaleFactor = scaleFactor; - CentralMeridian = centralMeridian; - FalseEasting = falseEasting; - FalseNorthing = falseNorthing; n = flattening / (2d - flattening); m = 2d * Math.Sqrt(n) / (1d + n); @@ -58,12 +51,14 @@ namespace MapControl A = equatorialRadius / (1d + n) * (1d + n2 / 4d + n2 * n2 / 64d); } - public TransverseMercatorProjection( - double equatorialRadius, double flattening, - double scaleFactor, int utmZone, bool north = true) - : this(equatorialRadius, flattening, - scaleFactor, utmZone * 6d - 183d, 5e5, north ? 0d : 1e7) + public TransverseMercatorProjection(string crsId, double equatorialRadius, double flattening, int utmZone, bool north = true) + : this(equatorialRadius, flattening) { + CrsId = crsId; + ScaleFactor = 0.9996; + CentralMeridian = utmZone * 6d - 183d; + FalseEasting = 5e5; + FalseNorthing = north ? 0d : 1e7; } public override double GridConvergence(double latitude, double longitude) diff --git a/MapControl/Shared/TransverseMercatorProjectionSnyder.cs b/MapControl/Shared/TransverseMercatorProjectionSnyder.cs index f08b0505..5f4c46e1 100644 --- a/MapControl/Shared/TransverseMercatorProjectionSnyder.cs +++ b/MapControl/Shared/TransverseMercatorProjectionSnyder.cs @@ -15,26 +15,6 @@ namespace MapControl /// public class TransverseMercatorProjectionSnyder : MapProjection { - public TransverseMercatorProjectionSnyder( - double equatorialRadius, double flattening, double scaleFactor, - double centralMeridian, double latitudeOfOrigin, - double falseEasting, double falseNorthing = 0d) - { - EquatorialRadius = equatorialRadius; - Flattening = flattening; - ScaleFactor = scaleFactor; - CentralMeridian = centralMeridian; - LatitudeOfOrigin = latitudeOfOrigin; - FalseEasting = falseEasting; - FalseNorthing = falseNorthing; - } - - public TransverseMercatorProjectionSnyder(int utmZone, bool north = true) - : this(Wgs84EquatorialRadius, Wgs84Flattening, - 0.9996, utmZone * 6d - 183d, 0d, 5e5, north ? 0d : 1e7) - { - } - public override double GridConvergence(double latitude, double longitude) { // φ diff --git a/MapControl/Shared/UtmProjections.cs b/MapControl/Shared/UtmProjections.cs index 1496b880..a99427f5 100644 --- a/MapControl/Shared/UtmProjections.cs +++ b/MapControl/Shared/UtmProjections.cs @@ -18,7 +18,7 @@ namespace MapControl public int Zone { get; } public Wgs84UtmProjection(int zone, bool north) - : base(Wgs84EquatorialRadius, Wgs84Flattening, 0.9996, zone, north) + : base($"EPSG:{(north ? 32600 : 32700) + zone}", Wgs84EquatorialRadius, Wgs84Flattening, zone, north) { if (zone < FirstZone || zone > LastZone) { @@ -26,7 +26,6 @@ namespace MapControl } Zone = zone; - CrsId = $"EPSG:{(north ? 32600 : 32700) + zone}"; } } @@ -43,7 +42,7 @@ namespace MapControl public int Zone { get; } public Etrs89UtmProjection(int zone) - : base(6378137d, 1d / 298.257222101, 0.9996, zone) // GRS 1980 + : base($"EPSG:{25800 + zone}", 6378137d, 1d / 298.257222101, zone) // GRS 1980 { if (zone < FirstZone || zone > LastZone) { @@ -51,7 +50,6 @@ namespace MapControl } Zone = zone; - CrsId = $"EPSG:{25800 + zone}"; } } @@ -68,7 +66,7 @@ namespace MapControl public int Zone { get; } public Nad83UtmProjection(int zone) - : base(6378137d, 1d / 298.257222101, 0.9996, zone) // GRS 1980 + : base($"EPSG:{26900 + zone}", 6378137d, 1d / 298.257222101, zone) // GRS 1980 { if (zone < FirstZone || zone > LastZone) { @@ -76,7 +74,6 @@ namespace MapControl } Zone = zone; - CrsId = $"EPSG:{26900 + zone}"; } } @@ -93,7 +90,7 @@ namespace MapControl public int Zone { get; } public Nad27UtmProjection(int zone) - : base(6378206.4, 1d / 294.978698213898, 0.9996, zone) // Clarke 1866 + : base($"EPSG:{26700 + zone}", 6378206.4, 1d / 294.978698213898, zone) // Clarke 1866 { if (zone < FirstZone || zone > LastZone) { @@ -101,7 +98,6 @@ namespace MapControl } Zone = zone; - CrsId = $"EPSG:{26700 + zone}"; } } }