mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-08 16:05:50 +00:00
Avoid unnecessary Location and Point allocations
This commit is contained in:
parent
f44d2207e5
commit
e268be2948
20 changed files with 205 additions and 172 deletions
|
|
@ -28,25 +28,19 @@ namespace MapControl
|
|||
CrsId = crsId;
|
||||
}
|
||||
|
||||
public override Point GetRelativeScale(Location location)
|
||||
public override Point GetRelativeScale(double latitude, double longitude)
|
||||
{
|
||||
return new Point(
|
||||
1d / Math.Cos(location.Latitude * Math.PI / 180d),
|
||||
1d);
|
||||
return new Point(1d / Math.Cos(latitude * Math.PI / 180d), 1d);
|
||||
}
|
||||
|
||||
public override Point? LocationToMap(Location location)
|
||||
public override Point? LocationToMap(double latitude, double longitude)
|
||||
{
|
||||
return new Point(
|
||||
Wgs84MeterPerDegree * location.Longitude,
|
||||
Wgs84MeterPerDegree * location.Latitude);
|
||||
return new Point(Wgs84MeterPerDegree * longitude, Wgs84MeterPerDegree * latitude);
|
||||
}
|
||||
|
||||
public override Location MapToLocation(Point point)
|
||||
public override Location MapToLocation(double x, double y)
|
||||
{
|
||||
return new Location(
|
||||
point.Y / Wgs84MeterPerDegree,
|
||||
point.X / Wgs84MeterPerDegree);
|
||||
return new Location(y / Wgs84MeterPerDegree, x / Wgs84MeterPerDegree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue