mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-01-15 21:20:29 +01:00
Updated MapProjection
This commit is contained in:
parent
0d556e6b14
commit
5d8f1b5ff0
|
|
@ -193,7 +193,11 @@ namespace MapControl
|
|||
var y = (ParentMap.ActualHeight - height) / 2d;
|
||||
|
||||
boundingBox = ParentMap.ViewRectToBoundingBox(x, y, width, height);
|
||||
image = await GetImageAsync(boundingBox, loadingProgress);
|
||||
|
||||
if (boundingBox != null)
|
||||
{
|
||||
image = await GetImageAsync(boundingBox, loadingProgress);
|
||||
}
|
||||
}
|
||||
|
||||
SwapImages(image, boundingBox);
|
||||
|
|
|
|||
|
|
@ -293,10 +293,10 @@ namespace MapControl
|
|||
{
|
||||
var rotatedRect = parentMap.MapProjection.LatLonBoxToMap(latLonBox);
|
||||
|
||||
if (rotatedRect != null)
|
||||
if (rotatedRect.HasValue)
|
||||
{
|
||||
mapRect = rotatedRect.Item1;
|
||||
rotation = -rotatedRect.Item2;
|
||||
mapRect = rotatedRect.Value.Item1;
|
||||
rotation = -rotatedRect.Value.Item2;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -114,9 +114,9 @@ namespace MapControl
|
|||
/// Transforms a LatLonBox in geographic coordinates to a rotated Rect in projected map coordinates.
|
||||
/// Returns null when the LatLonBox can not be transformed.
|
||||
/// </summary>
|
||||
public virtual Tuple<Rect, double> LatLonBoxToMap(LatLonBox latLonBox)
|
||||
public virtual (Rect, double)? LatLonBoxToMap(LatLonBox latLonBox)
|
||||
{
|
||||
Tuple<Rect, double> rotatedRect = null;
|
||||
(Rect, double)? rotatedRect = null;
|
||||
Point? center, north, south, west, east;
|
||||
var centerLatitude = latLonBox.Center.Latitude;
|
||||
var centerLongitude = latLonBox.Center.Longitude;
|
||||
|
|
@ -142,7 +142,7 @@ namespace MapControl
|
|||
var r1 = (Math.Atan2(dy1, dx1) * 180d / Math.PI + 180d) % 360d - 180d;
|
||||
var r2 = (Math.Atan2(-dx2, dy2) * 180d / Math.PI + 180d) % 360d - 180d;
|
||||
|
||||
rotatedRect = new Tuple<Rect, double>(new Rect(x, y, width, height), latLonBox.Rotation + (r1 + r2) / 2d);
|
||||
rotatedRect = (new Rect(x, y, width, height), latLonBox.Rotation + (r1 + r2) / 2d);
|
||||
}
|
||||
|
||||
return rotatedRect;
|
||||
|
|
|
|||
Loading…
Reference in a new issue