mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-01-19 23:20:41 +01:00
Added Auto Transverse Mercator Projection
This commit is contained in:
parent
2686cda333
commit
8630c6ed70
|
|
@ -36,6 +36,10 @@ namespace MapControl
|
|||
projection = new Wgs84AutoUtmProjection();
|
||||
break;
|
||||
|
||||
case Wgs84AutoTmProjection.DefaultCrsId:
|
||||
projection = new Wgs84AutoTmProjection();
|
||||
break;
|
||||
|
||||
case OrthographicProjection.DefaultCrsId:
|
||||
projection = new OrthographicProjection();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using Avalonia;
|
|||
namespace MapControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Universal Transverse Mercator Projection.
|
||||
/// See https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.
|
||||
/// Transverse Mercator Projection.
|
||||
/// See https://en.wikipedia.org/wiki/Transverse_Mercator_projection.
|
||||
/// </summary>
|
||||
public class TransverseMercatorProjection : MapProjection
|
||||
{
|
||||
|
|
@ -17,7 +17,7 @@ namespace MapControl
|
|||
public double Flattening { get; set; } = Wgs84Flattening;
|
||||
public double ScaleFactor { get; set; } = 0.9996;
|
||||
public double CentralMeridian { get; set; }
|
||||
public double FalseEasting { get; set; } = 5e5;
|
||||
public double FalseEasting { get; set; }
|
||||
public double FalseNorthing { get; set; }
|
||||
|
||||
public TransverseMercatorProjection()
|
||||
|
|
|
|||
31
MapControl/Shared/Wgs84AutoTmProjection.cs
Normal file
31
MapControl/Shared/Wgs84AutoTmProjection.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
namespace MapControl
|
||||
{
|
||||
/// <summary>
|
||||
/// WGS84 Auto Transverse Mercator Projection.
|
||||
/// </summary>
|
||||
public class Wgs84AutoTmProjection : TransverseMercatorProjection
|
||||
{
|
||||
public const string DefaultCrsId = "AUTO2:42002";
|
||||
|
||||
public Wgs84AutoTmProjection()
|
||||
: this(DefaultCrsId)
|
||||
{
|
||||
// XAML needs parameterless constructor
|
||||
}
|
||||
|
||||
public Wgs84AutoTmProjection(string crsId)
|
||||
{
|
||||
CrsId = crsId;
|
||||
}
|
||||
|
||||
public override Location Center
|
||||
{
|
||||
get => base.Center;
|
||||
protected internal set
|
||||
{
|
||||
base.Center = value;
|
||||
CentralMeridian = value.Longitude;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ namespace MapControl
|
|||
{
|
||||
/// <summary>
|
||||
/// WGS84 UTM Projection with zone number and north/south flag.
|
||||
/// See https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.
|
||||
/// </summary>
|
||||
public class Wgs84UtmProjection : TransverseMercatorProjection
|
||||
{
|
||||
|
|
@ -66,7 +67,7 @@ namespace MapControl
|
|||
get => base.Center;
|
||||
protected internal set
|
||||
{
|
||||
if (!Equals(base.Center, value))
|
||||
if (!base.Center.Equals(value))
|
||||
{
|
||||
base.Center = value;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace MapControl.Projections
|
|||
{
|
||||
/// <summary>
|
||||
/// WGS84 UTM Projection with zone number and north/south flag.
|
||||
/// See https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.
|
||||
/// </summary>
|
||||
public class Wgs84UtmProjection : GeoApiProjection
|
||||
{
|
||||
|
|
@ -41,17 +42,16 @@ namespace MapControl.Projections
|
|||
/// </summary>
|
||||
public class Wgs84AutoUtmProjection : Wgs84UtmProjection
|
||||
{
|
||||
private readonly string autoCrsId;
|
||||
public Wgs84AutoUtmProjection()
|
||||
: this(MapControl.Wgs84AutoUtmProjection.DefaultCrsId)
|
||||
{
|
||||
// XAML needs parameterless constructor
|
||||
}
|
||||
|
||||
public Wgs84AutoUtmProjection(string crsId = MapControl.Wgs84AutoUtmProjection.DefaultCrsId)
|
||||
public Wgs84AutoUtmProjection(string crsId)
|
||||
: base(31, true)
|
||||
{
|
||||
autoCrsId = crsId;
|
||||
|
||||
if (!string.IsNullOrEmpty(autoCrsId))
|
||||
{
|
||||
CrsId = autoCrsId;
|
||||
}
|
||||
CrsId = crsId;
|
||||
}
|
||||
|
||||
public override Location Center
|
||||
|
|
@ -59,7 +59,7 @@ namespace MapControl.Projections
|
|||
get => base.Center;
|
||||
protected set
|
||||
{
|
||||
if (!Equals(base.Center, value))
|
||||
if (!base.Center.Equals(value))
|
||||
{
|
||||
base.Center = value;
|
||||
|
||||
|
|
@ -69,12 +69,9 @@ namespace MapControl.Projections
|
|||
|
||||
if (Zone != zone || IsNorth != north)
|
||||
{
|
||||
var crsId = CrsId;
|
||||
SetZone(zone, north);
|
||||
|
||||
if (!string.IsNullOrEmpty(autoCrsId))
|
||||
{
|
||||
CrsId = autoCrsId;
|
||||
}
|
||||
CrsId = crsId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue