mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Simplified WmsImageLayer
This commit is contained in:
parent
03ac94a002
commit
6b7fd84c7b
|
|
@ -187,7 +187,7 @@ namespace MapControl
|
|||
return finalSize;
|
||||
}
|
||||
|
||||
protected Point? GetViewPosition(Location location)
|
||||
private Point? GetViewPosition(Location location)
|
||||
{
|
||||
var position = parentMap.LocationToView(location);
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ namespace MapControl
|
|||
return position;
|
||||
}
|
||||
|
||||
protected Rect? GetViewRect(BoundingBox boundingBox)
|
||||
private Rect? GetViewRect(BoundingBox boundingBox)
|
||||
{
|
||||
var mapRect = parentMap.MapProjection.BoundingBoxToMap(boundingBox);
|
||||
|
||||
|
|
@ -218,16 +218,15 @@ namespace MapControl
|
|||
return null;
|
||||
}
|
||||
|
||||
protected Rect GetViewRect(Rect mapRect)
|
||||
private Rect GetViewRect(Rect mapRect)
|
||||
{
|
||||
var center = new Point(mapRect.X + mapRect.Width / 2d, mapRect.Y + mapRect.Height / 2d);
|
||||
var position = parentMap.ViewTransform.MapToView(center);
|
||||
var projection = parentMap.MapProjection;
|
||||
|
||||
if (projection.Type <= MapProjectionType.NormalCylindrical &&
|
||||
if (parentMap.MapProjection.Type <= MapProjectionType.NormalCylindrical &&
|
||||
!parentMap.InsideViewBounds(position))
|
||||
{
|
||||
var location = projection.MapToLocation(center);
|
||||
var location = parentMap.MapProjection.MapToLocation(center);
|
||||
|
||||
if (location != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -236,7 +236,8 @@ namespace MapControl
|
|||
return null;
|
||||
}
|
||||
|
||||
var viewScale = ParentMap.ViewTransform.Scale;
|
||||
var width = ParentMap.ViewTransform.Scale * mapRect.Value.Width;
|
||||
var height = ParentMap.ViewTransform.Scale * mapRect.Value.Height;
|
||||
|
||||
return GetRequestUri(new Dictionary<string, string>
|
||||
{
|
||||
|
|
@ -248,8 +249,8 @@ namespace MapControl
|
|||
{ "FORMAT", "image/png" },
|
||||
{ "CRS", GetCrsValue() },
|
||||
{ "BBOX", GetBboxValue(mapRect.Value) },
|
||||
{ "WIDTH", Math.Round(viewScale * mapRect.Value.Width).ToString("F0") },
|
||||
{ "HEIGHT", Math.Round(viewScale * mapRect.Value.Height).ToString("F0") }
|
||||
{ "WIDTH", Math.Round(width).ToString("F0") },
|
||||
{ "HEIGHT", Math.Round(height).ToString("F0") }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -267,12 +268,13 @@ namespace MapControl
|
|||
return null;
|
||||
}
|
||||
|
||||
var viewRect = GetViewRect(mapRect.Value);
|
||||
var width = ParentMap.ViewTransform.Scale * mapRect.Value.Width;
|
||||
var height = ParentMap.ViewTransform.Scale * mapRect.Value.Height;
|
||||
|
||||
var transform = ViewTransform.CreateTransformMatrix(
|
||||
-viewport.Width / 2d, -viewport.Height / 2d,
|
||||
-ParentMap.ViewTransform.Rotation,
|
||||
viewRect.Width / 2d, viewRect.Height / 2d);
|
||||
width / 2d, height / 2d);
|
||||
|
||||
var imagePos = transform.Transform(position);
|
||||
|
||||
|
|
@ -287,8 +289,8 @@ namespace MapControl
|
|||
{ "INFO_FORMAT", format },
|
||||
{ "CRS", GetCrsValue() },
|
||||
{ "BBOX", GetBboxValue(mapRect.Value) },
|
||||
{ "WIDTH", Math.Round(viewRect.Width).ToString("F0") },
|
||||
{ "HEIGHT", Math.Round(viewRect.Height).ToString("F0") },
|
||||
{ "WIDTH", Math.Round(width).ToString("F0") },
|
||||
{ "HEIGHT", Math.Round(height).ToString("F0") },
|
||||
{ "I", Math.Round(imagePos.X).ToString("F0") },
|
||||
{ "J", Math.Round(imagePos.Y).ToString("F0") }
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue