diff --git a/MapControl/Shared/GeoImage.cs b/MapControl/Shared/GeoImage.cs index 9bbf333f..a76a8b6e 100644 --- a/MapControl/Shared/GeoImage.cs +++ b/MapControl/Shared/GeoImage.cs @@ -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) { diff --git a/MapControl/Shared/LatLonBox.cs b/MapControl/Shared/LatLonBox.cs index a3756419..0ff9b263 100644 --- a/MapControl/Shared/LatLonBox.cs +++ b/MapControl/Shared/LatLonBox.cs @@ -9,18 +9,24 @@ namespace MapControl /// 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; + } + /// /// Gets a counterclockwise rotation angle in degrees. ///