mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 06:55:04 +00:00
Version 5.0: Separated map projection and view transform.
This commit is contained in:
parent
53723844a0
commit
c7cb2efcdb
47 changed files with 401 additions and 382 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue