Version 5.0: Separated map projection and view transform.

This commit is contained in:
ClemensF 2020-03-26 19:08:20 +01:00
parent 53723844a0
commit c7cb2efcdb
47 changed files with 401 additions and 382 deletions

View file

@ -30,27 +30,27 @@ namespace MapControl
get { return maxLatitude; }
}
public override Vector GetMapScale(Location location)
public override Vector GetRelativeScale(Location location)
{
var lat = location.Latitude * Math.PI / 180d;
var eSinLat = Wgs84Eccentricity * Math.Sin(lat);
var k = Math.Sqrt(1d - eSinLat * eSinLat) / Math.Cos(lat); // p.44 (7-8)
return new Vector(ViewportScale * k, ViewportScale * k);
return new Vector(k, k);
}
public override Point LocationToPoint(Location location)
public override Point LocationToMap(Location location)
{
return new Point(
TrueScale * location.Longitude,
TrueScale * LatitudeToY(location.Latitude));
UnitsPerDegree * location.Longitude,
UnitsPerDegree * LatitudeToY(location.Latitude));
}
public override Location PointToLocation(Point point)
public override Location MapToLocation(Point point)
{
return new Location(
YToLatitude(point.Y / TrueScale),
point.X / TrueScale);
YToLatitude(point.Y / UnitsPerDegree),
point.X / UnitsPerDegree);
}
public static double LatitudeToY(double latitude)