diff --git a/MBTiles/UWP/MBTiles.UWP.csproj b/MBTiles/UWP/MBTiles.UWP.csproj
index d3ba3b8d..8f2c2af1 100644
--- a/MBTiles/UWP/MBTiles.UWP.csproj
+++ b/MBTiles/UWP/MBTiles.UWP.csproj
@@ -40,9 +40,6 @@
PackageReference
-
- MBTileData.cs
-
MBTileLayer.cs
diff --git a/MapControl/Shared/GeoImage.cs b/MapControl/Shared/GeoImage.cs
index 410b520d..52e52979 100644
--- a/MapControl/Shared/GeoImage.cs
+++ b/MapControl/Shared/GeoImage.cs
@@ -68,7 +68,7 @@ namespace MapControl
private static async Task LoadGeoImageAsync(Image image, string sourcePath)
{
- if (sourcePath != null)
+ if (!string.IsNullOrEmpty(sourcePath))
{
try
{
diff --git a/MapControl/Shared/MapPanel.cs b/MapControl/Shared/MapPanel.cs
index 40ebae9c..78b02481 100644
--- a/MapControl/Shared/MapPanel.cs
+++ b/MapControl/Shared/MapPanel.cs
@@ -206,7 +206,7 @@ namespace MapControl
return position;
}
- protected ViewRect? GetViewRect(BoundingBox boundingBox)
+ protected Rect? GetViewRect(BoundingBox boundingBox)
{
var mapRect = parentMap.MapProjection.BoundingBoxToMap(boundingBox);
@@ -218,7 +218,7 @@ namespace MapControl
return null;
}
- protected ViewRect GetViewRect(Rect mapRect)
+ protected Rect GetViewRect(Rect mapRect)
{
var center = new Point(mapRect.X + mapRect.Width / 2d, mapRect.Y + mapRect.Height / 2d);
var position = parentMap.ViewTransform.MapToView(center);
@@ -246,7 +246,7 @@ namespace MapControl
var x = position.X - width / 2d;
var y = position.Y - height / 2d;
- return new ViewRect(x, y, width, height, parentMap.ViewTransform.Rotation);
+ return new Rect(x, y, width, height);
}
private void ArrangeChildElement(FrameworkElement element, Size panelSize)
@@ -277,11 +277,11 @@ namespace MapControl
if (boundingBox != null)
{
- var viewRect = GetViewRect(boundingBox);
+ var rect = GetViewRect(boundingBox);
- if (viewRect.HasValue)
+ if (rect.HasValue)
{
- ArrangeElement(element, viewRect.Value);
+ ArrangeElement(element, rect.Value, parentMap.ViewTransform.Rotation);
}
}
else
@@ -291,20 +291,20 @@ namespace MapControl
}
}
- private static void ArrangeElement(FrameworkElement element, ViewRect rect)
+ private static void ArrangeElement(FrameworkElement element, Rect rect, double rotation)
{
- element.Width = rect.Rect.Width;
- element.Height = rect.Rect.Height;
+ element.Width = rect.Width;
+ element.Height = rect.Height;
- element.Arrange(rect.Rect);
+ element.Arrange(rect);
if (element.RenderTransform is RotateTransform rotateTransform)
{
- rotateTransform.Angle = rect.Rotation;
+ rotateTransform.Angle = rotation;
}
- else if (rect.Rotation != 0d)
+ else if (rotation != 0d)
{
- SetRenderTransform(element, new RotateTransform { Angle = rect.Rotation }, 0.5, 0.5);
+ SetRenderTransform(element, new RotateTransform { Angle = rotation }, 0.5, 0.5);
}
}
diff --git a/MapControl/Shared/ViewRect.cs b/MapControl/Shared/ViewRect.cs
deleted file mode 100644
index 7eaa388d..00000000
--- a/MapControl/Shared/ViewRect.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
-// Copyright © 2024 Clemens Fischer
-// Licensed under the Microsoft Public License (Ms-PL)
-
-#if WPF
-using System.Windows;
-#endif
-
-namespace MapControl
-{
- ///
- /// Rotated rectangle used to arrange and rotate an element with a BoundingBox.
- ///
- public readonly struct ViewRect
- {
- public ViewRect(double x, double y, double width, double height, double rotation)
- {
- Rect = new Rect(x, y, width, height);
- Rotation = rotation;
- }
-
- public Rect Rect { get; }
- public double Rotation { get; }
- }
-}
diff --git a/MapControl/Shared/WmsImageLayer.cs b/MapControl/Shared/WmsImageLayer.cs
index 88d55f86..55c82c93 100644
--- a/MapControl/Shared/WmsImageLayer.cs
+++ b/MapControl/Shared/WmsImageLayer.cs
@@ -270,8 +270,8 @@ namespace MapControl
var transform = ViewTransform.CreateTransformMatrix(
-viewport.Width / 2d, -viewport.Height / 2d,
- -viewRect.Rotation,
- viewRect.Rect.Width / 2d, viewRect.Rect.Height / 2d);
+ -ParentMap.ViewTransform.Rotation,
+ viewRect.Width / 2d, viewRect.Height / 2d);
var imagePos = transform.Transform(position);
@@ -286,8 +286,8 @@ namespace MapControl
{ "INFO_FORMAT", format },
{ "CRS", GetCrsValue() },
{ "BBOX", GetBboxValue(mapRect.Value) },
- { "WIDTH", Math.Round(viewRect.Rect.Width).ToString("F0") },
- { "HEIGHT", Math.Round(viewRect.Rect.Height).ToString("F0") },
+ { "WIDTH", Math.Round(viewRect.Width).ToString("F0") },
+ { "HEIGHT", Math.Round(viewRect.Height).ToString("F0") },
{ "I", Math.Round(imagePos.X).ToString("F0") },
{ "J", Math.Round(imagePos.Y).ToString("F0") }
};
diff --git a/MapControl/UWP/MapControl.UWP.csproj b/MapControl/UWP/MapControl.UWP.csproj
index 1a2f5e5b..b9d24f8f 100644
--- a/MapControl/UWP/MapControl.UWP.csproj
+++ b/MapControl/UWP/MapControl.UWP.csproj
@@ -182,9 +182,6 @@
ViewportChangedEventArgs.cs
-
- ViewRect.cs
-
ViewTransform.cs