mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 22:18:56 +00:00
Use Matrix for projection relative scale
This commit is contained in:
parent
2c9e478095
commit
ab155a26e7
21 changed files with 93 additions and 104 deletions
|
|
@ -93,13 +93,6 @@ namespace MapControl.Projections
|
|||
|
||||
public MathTransform MapToLocationTransform { get; private set; }
|
||||
|
||||
public override Point RelativeScale(double latitude, double longitude)
|
||||
{
|
||||
var k = CoordinateSystem?.Projection?.GetParameter("scale_factor")?.Value ?? 1d;
|
||||
|
||||
return new Point(k, k);
|
||||
}
|
||||
|
||||
public override Point? LocationToMap(double latitude, double longitude)
|
||||
{
|
||||
if (LocationToMapTransform == null)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
using ProjNet.CoordinateSystems;
|
||||
using System;
|
||||
#if WPF
|
||||
using System.Windows;
|
||||
#elif AVALONIA
|
||||
using Avalonia;
|
||||
using System.Windows.Media;
|
||||
#endif
|
||||
|
||||
namespace MapControl.Projections
|
||||
|
|
@ -19,11 +17,11 @@ namespace MapControl.Projections
|
|||
CoordinateSystem = ProjectedCoordinateSystem.WebMercator;
|
||||
}
|
||||
|
||||
public override Point RelativeScale(double latitude, double longitude)
|
||||
public override Matrix RelativeScale(double latitude, double longitude)
|
||||
{
|
||||
var k = 1d / Math.Cos(latitude * Math.PI / 180d); // p.44 (7-3)
|
||||
|
||||
return new Point(k, k);
|
||||
return new Matrix(k, 0d, 0d, k, 0d, 0d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#if WPF
|
||||
using System.Windows;
|
||||
#elif AVALONIA
|
||||
using Avalonia;
|
||||
using System.Windows.Media;
|
||||
#endif
|
||||
|
||||
namespace MapControl.Projections
|
||||
|
|
@ -23,11 +21,11 @@ namespace MapControl.Projections
|
|||
"AUTHORITY[\"EPSG\",\"32661\"]]";
|
||||
}
|
||||
|
||||
public override Point RelativeScale(double latitude, double longitude)
|
||||
public override Matrix RelativeScale(double latitude, double longitude)
|
||||
{
|
||||
var k = PolarStereographicProjection.RelativeScale(Hemisphere.North, Wgs84Flattening, 0.994, latitude);
|
||||
var k = PolarStereographicProjection.RelativeScale(Hemisphere.North, Wgs84Flattening, latitude);
|
||||
|
||||
return new Point(k, k);
|
||||
return new Matrix(k, 0d, 0d, k, 0d, 0d);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,11 +46,11 @@ namespace MapControl.Projections
|
|||
"AUTHORITY[\"EPSG\",\"32761\"]]";
|
||||
}
|
||||
|
||||
public override Point RelativeScale(double latitude, double longitude)
|
||||
public override Matrix RelativeScale(double latitude, double longitude)
|
||||
{
|
||||
var k = PolarStereographicProjection.RelativeScale(Hemisphere.South, Wgs84Flattening, 0.994, latitude);
|
||||
var k = PolarStereographicProjection.RelativeScale(Hemisphere.South, Wgs84Flattening, latitude);
|
||||
|
||||
return new Point(k, k);
|
||||
return new Matrix(k, 0d, 0d, k, 0d, 0d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#if WPF
|
||||
using System.Windows;
|
||||
#elif AVALONIA
|
||||
using Avalonia;
|
||||
using System.Windows.Media;
|
||||
#endif
|
||||
|
||||
namespace MapControl.Projections
|
||||
|
|
@ -29,11 +27,11 @@ namespace MapControl.Projections
|
|||
"AUTHORITY[\"EPSG\",\"3395\"]]";
|
||||
}
|
||||
|
||||
public override Point RelativeScale(double latitude, double longitude)
|
||||
public override Matrix RelativeScale(double latitude, double longitude)
|
||||
{
|
||||
var k = MapControl.WorldMercatorProjection.RelativeScale(latitude);
|
||||
|
||||
return new Point(k, k);
|
||||
return new Matrix(k, 0d, 0d, k, 0d, 0d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue