Use Matrix for projection relative scale

This commit is contained in:
ClemensFischer 2026-01-20 09:48:16 +01:00
parent 2c9e478095
commit ab155a26e7
21 changed files with 93 additions and 104 deletions

View file

@ -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)

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}