Simplified WmsImageLayer

This commit is contained in:
ClemensFischer 2024-09-08 15:56:48 +02:00
parent 6b7fd84c7b
commit 7df36512b8
3 changed files with 80 additions and 71 deletions

View file

@ -48,7 +48,7 @@ namespace MapControl
return image;
}
private DrawingImage GetImage(MapProjection projection, Rect rect, IEnumerable<IMapDrawingItem> items)
private DrawingImage GetImage(MapProjection projection, Rect mapRect, IEnumerable<IMapDrawingItem> items)
{
var scale = ParentMap.ViewTransform.Scale;
var rotation = ParentMap.ViewTransform.Rotation;
@ -62,13 +62,13 @@ namespace MapControl
.Select(point => point.Value)
.ToList();
if (points.Any(point => rect.Contains(point)))
if (points.Any(point => mapRect.Contains(point)))
{
for (int i = 0; i < points.Count; i++)
{
points[i] = new Point(
scale * (points[i].X - rect.X),
scale * ((rect.Y + rect.Height) - points[i].Y));
scale * (points[i].X - mapRect.X),
scale * ((mapRect.Y + mapRect.Height) - points[i].Y));
}
drawings.Children.Add(item.GetDrawing(points, scale, rotation));
@ -79,7 +79,7 @@ namespace MapControl
{
Drawing = drawings,
ViewboxUnits = BrushMappingMode.Absolute,
Viewbox = new Rect(0, 0, scale * rect.Width, scale * rect.Height),
Viewbox = new Rect(0, 0, scale * mapRect.Width, scale * mapRect.Height),
};
var drawing = new GeometryDrawing(