mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 22:46:58 +00:00
Version 4.12. Revised projections
This commit is contained in:
parent
8cafe207cb
commit
90aa92def0
25 changed files with 390 additions and 167 deletions
|
|
@ -348,17 +348,14 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public void ZoomToBounds(BoundingBox boundingBox)
|
||||
{
|
||||
if (boundingBox != null && boundingBox.HasValidBounds)
|
||||
{
|
||||
var rect = MapProjection.BoundingBoxToRect(boundingBox);
|
||||
var center = new Point(rect.X + rect.Width / 2d, rect.Y + rect.Height / 2d);
|
||||
var scale = Math.Min(RenderSize.Width / rect.Width, RenderSize.Height / rect.Height)
|
||||
* MapProjection.TrueScale / MapProjection.PixelPerDegree;
|
||||
var rect = MapProjection.BoundingBoxToRect(boundingBox);
|
||||
var center = new Point(rect.X + rect.Width / 2d, rect.Y + rect.Height / 2d);
|
||||
var scale = Math.Min(RenderSize.Width / rect.Width, RenderSize.Height / rect.Height)
|
||||
* MapProjection.TrueScale / MapProjection.PixelPerDegree;
|
||||
|
||||
TargetZoomLevel = Math.Log(scale, 2d);
|
||||
TargetCenter = MapProjection.PointToLocation(center);
|
||||
TargetHeading = 0d;
|
||||
}
|
||||
TargetZoomLevel = Math.Log(scale, 2d);
|
||||
TargetCenter = MapProjection.PointToLocation(center);
|
||||
TargetHeading = 0d;
|
||||
}
|
||||
|
||||
private void MapLayerPropertyChanged(UIElement oldLayer, UIElement newLayer)
|
||||
|
|
@ -451,7 +448,7 @@ namespace MapControl
|
|||
|
||||
if (!targetCenter.Equals(Center))
|
||||
{
|
||||
var targetCenterLongitude = MapProjection.IsCylindrical
|
||||
var targetCenterLongitude = MapProjection.IsNormalCylindrical
|
||||
? Location.NearestLongitude(targetCenter.Longitude, Center.Longitude)
|
||||
: targetCenter.Longitude;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue