LatLonBox in GeoImage

This commit is contained in:
ClemensFischer 2024-09-11 11:53:09 +02:00
parent d66febcdf0
commit 1ad4c1b1a3
2 changed files with 12 additions and 6 deletions

View file

@ -83,9 +83,9 @@ namespace MapControl
var p1 = geoImage.transformMatrix.Transform(new Point());
var p2 = geoImage.transformMatrix.Transform(geoImage.BitmapSize);
var boundingBox = geoImage.mapProjection != null
? geoImage.mapProjection.MapToBoundingBox(new Rect(p1, p2))
: new LatLonBox(p1.Y, p1.X, p2.Y, p2.X, 0d);
var latLonBox = geoImage.mapProjection != null
? new LatLonBox(geoImage.mapProjection.MapToBoundingBox(new Rect(p1, p2)))
: new LatLonBox(p1.Y, p1.X, p2.Y, p2.X);
if (element is Image image)
{
@ -96,7 +96,7 @@ namespace MapControl
shape.Fill = geoImage.ImageBrush;
}
MapPanel.SetBoundingBox(element, boundingBox);
MapPanel.SetBoundingBox(element, latLonBox);
}
catch (Exception ex)
{

View file

@ -9,18 +9,24 @@ namespace MapControl
/// </summary>
public class LatLonBox : BoundingBox
{
public LatLonBox(double latitude1, double longitude1, double latitude2, double longitude2, double rotation)
public LatLonBox(double latitude1, double longitude1, double latitude2, double longitude2, double rotation = 0d)
: base(latitude1, longitude1, latitude2, longitude2)
{
Rotation = rotation;
}
public LatLonBox(Location location1, Location location2, double rotation)
public LatLonBox(Location location1, Location location2, double rotation = 0d)
: base(location1, location2)
{
Rotation = rotation;
}
public LatLonBox(BoundingBox boundingBox, double rotation = 0d)
: base(boundingBox.South, boundingBox.West, boundingBox.North, boundingBox.East)
{
Rotation = rotation;
}
/// <summary>
/// Gets a counterclockwise rotation angle in degrees.
/// </summary>