mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 22:46:58 +00:00
Extend map projections
This commit is contained in:
parent
57e614978b
commit
d8d1cbccaf
27 changed files with 448 additions and 207 deletions
|
|
@ -381,15 +381,19 @@ namespace MapControl
|
|||
public void ZoomToBounds(BoundingBox boundingBox)
|
||||
{
|
||||
var mapRect = MapProjection.BoundingBoxToMapRect(boundingBox);
|
||||
var targetCenter = MapProjection.MapToLocation(mapRect.Center);
|
||||
|
||||
if (targetCenter != null)
|
||||
if (mapRect != null)
|
||||
{
|
||||
var scale = Math.Min(RenderSize.Width / mapRect.Width, RenderSize.Height / mapRect.Height);
|
||||
var targetCenter = MapProjection.MapToLocation(mapRect.Center);
|
||||
|
||||
TargetZoomLevel = ViewTransform.ScaleToZoomLevel(scale);
|
||||
TargetCenter = targetCenter;
|
||||
TargetHeading = 0d;
|
||||
if (targetCenter != null)
|
||||
{
|
||||
var scale = Math.Min(RenderSize.Width / mapRect.Width, RenderSize.Height / mapRect.Height);
|
||||
|
||||
TargetZoomLevel = ViewTransform.ScaleToZoomLevel(scale);
|
||||
TargetCenter = targetCenter;
|
||||
TargetHeading = 0d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue