Update GeoImage.cs

This commit is contained in:
ClemensFischer 2024-05-31 20:11:23 +02:00
parent 1f72ddd76d
commit aa33bb03dc

View file

@ -108,30 +108,22 @@ namespace MapControl
Math.Sqrt(transform.M11 * transform.M11 + transform.M12 * transform.M12), 0d, 0d, Math.Sqrt(transform.M11 * transform.M11 + transform.M12 * transform.M12), 0d, 0d,
-Math.Sqrt(transform.M22 * transform.M22 + transform.M21 * transform.M21), 0d, 0d); -Math.Sqrt(transform.M22 * transform.M22 + transform.M21 * transform.M21), 0d, 0d);
} }
#if AVALONIA #if AVALONIA
var width = geoBitmap.Bitmap.PixelSize.Width; var size = new Point(geoBitmap.Bitmap.PixelSize.Width, geoBitmap.Bitmap.PixelSize.Height);
var height = geoBitmap.Bitmap.PixelSize.Height;
#else #else
var width = geoBitmap.Bitmap.PixelWidth; var size = new Point(geoBitmap.Bitmap.PixelWidth, geoBitmap.Bitmap.PixelHeight);
var height = geoBitmap.Bitmap.PixelHeight;
#endif #endif
var rect = new Rect(transform.Transform(new Point()), transform.Transform(new Point(width, height))); var rect = new Rect(transform.Transform(new Point()), transform.Transform(size));
BoundingBox boundingBox = null; var boundingBox = geoBitmap.Projection != null
? geoBitmap.Projection.MapToBoundingBox(rect)
: new BoundingBox(rect.Y, rect.X, rect.Y + rect.Height, rect.X + rect.Width);
if (geoBitmap.Projection != null) MapPanel.SetBoundingBox(this, boundingBox);
{
boundingBox = geoBitmap.Projection.MapToBoundingBox(rect);
}
else
{
boundingBox = new BoundingBox(rect.Y, rect.X, rect.Y + rect.Height, rect.X + rect.Width);
}
Children.Clear(); Children.Clear();
Children.Add(image); Children.Add(image);
MapPanel.SetBoundingBox(this, boundingBox);
} }
private static async Task<GeoBitmap> ReadWorldFileImageAsync(string sourcePath, string worldFilePath) private static async Task<GeoBitmap> ReadWorldFileImageAsync(string sourcePath, string worldFilePath)