mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-01-31 04:44:14 +01:00
MapProjection.EnableCenterUpdates method
This commit is contained in:
parent
98f057ca0c
commit
b0352c8f94
|
|
@ -7,8 +7,9 @@ namespace MapControl
|
|||
{
|
||||
public abstract class AzimuthalProjection : MapProjection
|
||||
{
|
||||
protected AzimuthalProjection() : base(true)
|
||||
protected AzimuthalProjection()
|
||||
{
|
||||
EnableCenterUpdates();
|
||||
}
|
||||
|
||||
public readonly struct ProjectedPoint
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace MapControl
|
|||
#else
|
||||
[System.ComponentModel.TypeConverter(typeof(MapProjectionConverter))]
|
||||
#endif
|
||||
public abstract class MapProjection(bool hasCenter = false)
|
||||
public abstract class MapProjection
|
||||
{
|
||||
public const double Wgs84EquatorialRadius = 6378137d;
|
||||
public const double Wgs84Flattening = 1d / 298.257223563;
|
||||
|
|
@ -56,7 +56,7 @@ namespace MapControl
|
|||
public double MeterPerDegree => EquatorialRadius * Math.PI / 180d;
|
||||
|
||||
private Location center;
|
||||
private bool updateCenter = hasCenter;
|
||||
private bool updateCenter;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an optional projection center. If the property is set to a non-null value,
|
||||
|
|
@ -77,6 +77,11 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
protected void EnableCenterUpdates()
|
||||
{
|
||||
updateCenter = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by MapBase.UpdateTransform().
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
public Wgs84AutoTmProjection(string crsId)
|
||||
{
|
||||
CrsId = crsId;
|
||||
EnableCenterUpdates();
|
||||
}
|
||||
|
||||
protected override void CenterChanged()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ namespace MapControl
|
|||
{
|
||||
CrsId = autoCrsId;
|
||||
}
|
||||
|
||||
EnableCenterUpdates();
|
||||
}
|
||||
|
||||
protected override void CenterChanged()
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ namespace MapControl.Projections
|
|||
/// </summary>
|
||||
public class ProjNetMapProjection : MapProjection
|
||||
{
|
||||
protected ProjNetMapProjection(bool hasCenter = false)
|
||||
: base(hasCenter)
|
||||
protected ProjNetMapProjection()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,23 +12,23 @@ namespace MapControl.Projections
|
|||
public class Wgs84OrthographicProjection : ProjNetMapProjection
|
||||
{
|
||||
public Wgs84OrthographicProjection()
|
||||
: base(true)
|
||||
{
|
||||
EnableCenterUpdates();
|
||||
CenterChanged();
|
||||
}
|
||||
|
||||
protected override void CenterChanged()
|
||||
{
|
||||
var wktFormat =
|
||||
"PROJCS[\"WGS 84 / World Mercator\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Orthographic\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",{0:0.########}]," +
|
||||
"PARAMETER[\"central_meridian\",{1:0.########}]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]" +
|
||||
"AUTHORITY[\"AUTO2\",\"42003\"]]";
|
||||
"PROJCS[\"WGS 84 / World Mercator\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Orthographic\"]," +
|
||||
"PARAMETER[\"latitude_of_origin\",{0:0.########}]," +
|
||||
"PARAMETER[\"central_meridian\",{1:0.########}]," +
|
||||
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]," +
|
||||
"AXIS[\"Easting\",EAST]," +
|
||||
"AXIS[\"Northing\",NORTH]" +
|
||||
"AUTHORITY[\"AUTO2\",\"42003\"]]";
|
||||
|
||||
CoordinateSystemWkt = string.Format(
|
||||
CultureInfo.InvariantCulture, wktFormat, Center.Latitude, Center.Longitude);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ namespace MapControl.Projections
|
|||
public class Wgs84StereographicProjection : ProjNetMapProjection
|
||||
{
|
||||
public Wgs84StereographicProjection()
|
||||
: base(true)
|
||||
{
|
||||
EnableCenterUpdates();
|
||||
CenterChanged();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue