Fixed LatLonBox rotation

This commit is contained in:
ClemensFischer 2026-01-25 17:27:03 +01:00
parent 7208cc71bd
commit ceb19a9ae4
2 changed files with 6 additions and 4 deletions

View file

@ -306,7 +306,9 @@ namespace MapControl
element.Height = viewRect.Height;
element.Arrange(viewRect);
rotation += parentMap.ViewTransform.Rotation;
// LatLonBoxToMap rotation is counterclockwise, RotateTransform is clockwise.
//
rotation = (parentMap.ViewTransform.Rotation - rotation) % 360d;
if (element.RenderTransform is RotateTransform rotateTransform)
{

View file

@ -193,11 +193,11 @@ namespace MapControl
// Additional rotation caused by the projection, calculated as mean value
// of the two angles measured relative to the east and north axis.
//
var r1 = (Math.Atan2(dy1, dx1) * 180d / Math.PI + 180d) % 360d - 180d;
var r2 = (Math.Atan2(-dx2, dy2) * 180d / Math.PI + 180d) % 360d - 180d;
var r1 = Math.Atan2(dy1, dx1) * 180d / Math.PI;
var r2 = Math.Atan2(-dx2, dy2) * 180d / Math.PI;
rect = new Rect(x, y, width, height);
rotation = latLonBox.Rotation + (r1 + r2) / 2d;
rotation = latLonBox.Rotation + (r1 + r2) / 2d % 360d;
}
return (rect, rotation);