Fixed MapItem.MapTransform implementation

This commit is contained in:
ClemensFischer 2023-01-19 17:16:02 +01:00
parent d7593cbe8c
commit fd13503613
11 changed files with 229 additions and 127 deletions

View file

@ -236,6 +236,18 @@ namespace MapControl
return ViewTransform.Scale * MapProjection.GetRelativeScale(location);
}
/// <summary>
/// Gets a transform Matrix for scaling and rotating objects that are anchored
/// at a Location from map coordinates (i.e. meters) to view coordinates.
/// </summary>
public Matrix GetMapTransform(Location location)
{
var scale = GetScale(location);
var matrix = new Matrix(scale.X, 0d, 0d, scale.Y, 0d, 0d);
matrix.Rotate(ViewTransform.Rotation);
return matrix;
}
/// <summary>
/// Transforms a Location in geographic coordinates to a Point in view coordinates.
/// </summary>