Updated MapProjection

This commit is contained in:
ClemensFischer 2025-12-30 00:26:08 +01:00
parent 0d556e6b14
commit 5d8f1b5ff0
3 changed files with 11 additions and 7 deletions

View file

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