mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Added MapProjection.CenterChanged method
This commit is contained in:
parent
2817ecda7d
commit
31b38d5049
6 changed files with 67 additions and 89 deletions
|
|
@ -27,28 +27,18 @@ namespace MapControl.Projections
|
|||
}
|
||||
}
|
||||
|
||||
public override Location Center
|
||||
protected override void CenterChanged()
|
||||
{
|
||||
get => base.Center;
|
||||
protected set
|
||||
var zone = (int)Math.Floor(Center.Longitude / 6d) + 31;
|
||||
var hemisphere = Center.Latitude >= 0d ? Hemisphere.North : Hemisphere.South;
|
||||
|
||||
if (Zone != zone || Hemisphere != hemisphere)
|
||||
{
|
||||
if (!base.Center.Equals(value))
|
||||
SetZone(zone, hemisphere);
|
||||
|
||||
if (!string.IsNullOrEmpty(autoCrsId))
|
||||
{
|
||||
base.Center = value;
|
||||
|
||||
var lon = Location.NormalizeLongitude(value.Longitude);
|
||||
var zone = (int)Math.Floor(lon / 6d) + 31;
|
||||
var hemisphere = value.Latitude >= 0d ? Hemisphere.North : Hemisphere.South;
|
||||
|
||||
if (Zone != zone || Hemisphere != hemisphere)
|
||||
{
|
||||
SetZone(zone, hemisphere);
|
||||
|
||||
if (!string.IsNullOrEmpty(autoCrsId))
|
||||
{
|
||||
CrsId = autoCrsId;
|
||||
}
|
||||
}
|
||||
CrsId = autoCrsId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
|
|
@ -7,17 +6,12 @@ namespace MapControl.Projections
|
|||
{
|
||||
public Wgs84OrthographicProjection()
|
||||
{
|
||||
Center = base.Center;
|
||||
CenterChanged();
|
||||
}
|
||||
|
||||
public override Location Center
|
||||
protected override void CenterChanged()
|
||||
{
|
||||
get => base.Center;
|
||||
protected set
|
||||
{
|
||||
base.Center = value;
|
||||
|
||||
var wktFormat =
|
||||
var wktFormat =
|
||||
"PROJCS[\"WGS 84 / World Mercator\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Orthographic\"]," +
|
||||
|
|
@ -28,9 +22,8 @@ namespace MapControl.Projections
|
|||
"AXIS[\"Northing\",NORTH]" +
|
||||
"AUTHORITY[\"AUTO2\",\"42003\"]]";
|
||||
|
||||
CoordinateSystemWkt = string.Format(
|
||||
CultureInfo.InvariantCulture, wktFormat, value.Latitude, value.Longitude);
|
||||
}
|
||||
CoordinateSystemWkt = string.Format(
|
||||
CultureInfo.InvariantCulture, wktFormat, Center.Latitude, Center.Longitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MapControl.Projections
|
||||
{
|
||||
|
|
@ -7,30 +6,24 @@ namespace MapControl.Projections
|
|||
{
|
||||
public Wgs84StereographicProjection()
|
||||
{
|
||||
Center = base.Center;
|
||||
CenterChanged();
|
||||
}
|
||||
|
||||
public override Location Center
|
||||
protected override void CenterChanged()
|
||||
{
|
||||
get => base.Center;
|
||||
protected set
|
||||
{
|
||||
base.Center = value;
|
||||
var wktFormat =
|
||||
"PROJCS[\"WGS 84 / World Mercator\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Oblique_Stereographic\"]," +
|
||||
"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\",\"97002\"]]";
|
||||
|
||||
var wktFormat =
|
||||
"PROJCS[\"WGS 84 / World Mercator\"," +
|
||||
WktConstants.GeogCsWgs84 + "," +
|
||||
"PROJECTION[\"Oblique_Stereographic\"]," +
|
||||
"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\",\"97002\"]]";
|
||||
|
||||
CoordinateSystemWkt = string.Format(
|
||||
CultureInfo.InvariantCulture, wktFormat, value.Latitude, value.Longitude);
|
||||
}
|
||||
CoordinateSystemWkt = string.Format(
|
||||
CultureInfo.InvariantCulture, wktFormat, Center.Latitude, Center.Longitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue