mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-01-21 08:00:17 +01:00
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using System.Globalization;
|
|
#if WPF
|
|
using System.Windows.Media;
|
|
#endif
|
|
|
|
namespace MapControl.Projections
|
|
{
|
|
/// <summary>
|
|
/// Spherical Stereographic Projection - AUTO2:97002.
|
|
/// See "Map Projections - A Working Manual" (https://pubs.usgs.gov/publication/pp1395), p.157-160.
|
|
/// </summary>
|
|
public class Wgs84StereographicProjection : ProjNetMapProjection
|
|
{
|
|
public Wgs84StereographicProjection()
|
|
: base(true)
|
|
{
|
|
CenterChanged();
|
|
}
|
|
|
|
protected override void CenterChanged()
|
|
{
|
|
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, Center.Latitude, Center.Longitude);
|
|
}
|
|
|
|
public override Matrix RelativeScale(double latitude, double longitude)
|
|
{
|
|
var p = new AzimuthalProjection.ProjectedPoint(Center.Latitude, Center.Longitude, latitude, longitude);
|
|
var k = 2d / (1d + p.CosC); // p.157 (21-4), k0 == 1
|
|
|
|
return new Matrix(k, 0d, 0d, k, 0d, 0d);
|
|
}
|
|
}
|
|
}
|