mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 22:46:58 +00:00
Improve MapRect
This commit is contained in:
parent
07a8e454d5
commit
8bb2555533
10 changed files with 80 additions and 65 deletions
|
|
@ -223,15 +223,14 @@ namespace MapControl
|
|||
return GetViewRect(parentMap.MapProjection.BoundingBoxToMapRect(boundingBox));
|
||||
}
|
||||
|
||||
protected ViewRect GetViewRect(MapRect rect)
|
||||
protected ViewRect GetViewRect(MapRect mapRect)
|
||||
{
|
||||
var center = new Point(rect.X + rect.Width / 2d, rect.Y + rect.Height / 2d);
|
||||
var position = parentMap.ViewTransform.MapToView(center);
|
||||
var position = parentMap.ViewTransform.MapToView(mapRect.Center);
|
||||
|
||||
if (parentMap.MapProjection.Type <= MapProjectionType.NormalCylindrical &&
|
||||
IsOutsideViewport(position))
|
||||
{
|
||||
var location = parentMap.MapProjection.MapToLocation(center);
|
||||
var location = parentMap.MapProjection.MapToLocation(mapRect.Center);
|
||||
|
||||
if (location != null)
|
||||
{
|
||||
|
|
@ -245,8 +244,8 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
var width = rect.Width * parentMap.ViewTransform.Scale;
|
||||
var height = rect.Height * parentMap.ViewTransform.Scale;
|
||||
var width = mapRect.Width * parentMap.ViewTransform.Scale;
|
||||
var height = mapRect.Height * parentMap.ViewTransform.Scale;
|
||||
var x = position.X - width / 2d;
|
||||
var y = position.Y - height / 2d;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue