diff --git a/Caching/FileDbCache/Properties/AssemblyInfo.cs b/Caching/FileDbCache/Properties/AssemblyInfo.cs index 32c8fa11..f6d2b2de 100644 --- a/Caching/FileDbCache/Properties/AssemblyInfo.cs +++ b/Caching/FileDbCache/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/Caching/ImageFileCache/Properties/AssemblyInfo.cs b/Caching/ImageFileCache/Properties/AssemblyInfo.cs index 0a947e8c..029697fe 100644 --- a/Caching/ImageFileCache/Properties/AssemblyInfo.cs +++ b/Caching/ImageFileCache/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/MapBase.cs b/MapControl/MapBase.cs index ab977f77..827b050b 100644 --- a/MapControl/MapBase.cs +++ b/MapControl/MapBase.cs @@ -388,17 +388,19 @@ namespace MapControl } /// - /// Sets the value of the ZoomLevel property while retaining the specified origin point + /// Sets the value of the TargetZoomLevel property while retaining the specified origin point /// in viewport coordinates. /// public void ZoomMap(Point origin, double zoomLevel) { + SetTransformOrigin(origin); + var targetZoomLevel = TargetZoomLevel; TargetZoomLevel = zoomLevel; - if (TargetZoomLevel != targetZoomLevel) // TargetZoomLevel might be coerced + if (TargetZoomLevel == targetZoomLevel) // TargetZoomLevel might be coerced { - SetTransformOrigin(origin); + ResetTransformOrigin(); } } diff --git a/MapControl/MapImageLayer.cs b/MapControl/MapImageLayer.cs index 67cefa5a..20bfbbe0 100644 --- a/MapControl/MapImageLayer.cs +++ b/MapControl/MapImageLayer.cs @@ -32,7 +32,6 @@ namespace MapControl private readonly DispatcherTimer updateTimer; private string uriFormat; - private bool latLonBoundingBox; private bool updateInProgress; private int currentImageIndex; @@ -68,22 +67,16 @@ namespace MapControl throw new ArgumentException("UriFormat must specify the requested image size by {X} and {Y}."); } - if (value.Contains("{w}") && value.Contains("{s}") && value.Contains("{e}") && value.Contains("{n}")) + if (!(value.Contains("{W}") && value.Contains("{S}") && value.Contains("{E}") && value.Contains("{N}")) && + !(value.Contains("{w}") && value.Contains("{s}") && value.Contains("{e}") && value.Contains("{n}"))) { - latLonBoundingBox = true; - } - else if (!(value.Contains("{W}") && value.Contains("{S}") && value.Contains("{E}") && value.Contains("{N}"))) - { - throw new ArgumentException("UriFormat must specify a bounding box in meters by {W},{S},{E},{N} or as lat/lon by {w},{s},{e},{n}."); + throw new ArgumentException("UriFormat must specify a bounding box in meters by {W},{S},{E},{N} or lat/lon by {w},{s},{e},{n}."); } } uriFormat = value; - if (ParentMap != null) - { - UpdateImage(this, EventArgs.Empty); - } + UpdateImage(this, EventArgs.Empty); } } @@ -103,15 +96,7 @@ namespace MapControl { var uri = uriFormat.Replace("{X}", width.ToString()).Replace("{Y}", height.ToString()); - if (latLonBoundingBox) - { - uri = uri. - Replace("{w}", west.ToString(CultureInfo.InvariantCulture)). - Replace("{s}", south.ToString(CultureInfo.InvariantCulture)). - Replace("{e}", east.ToString(CultureInfo.InvariantCulture)). - Replace("{n}", north.ToString(CultureInfo.InvariantCulture)); - } - else + if (uri.Contains("{W}") && uri.Contains("{S}") && uri.Contains("{E}") && uri.Contains("{N}")) { var p1 = ParentMap.MapTransform.Transform(new Location(south, west)); var p2 = ParentMap.MapTransform.Transform(new Location(north, east)); @@ -123,6 +108,14 @@ namespace MapControl Replace("{E}", (arc * p2.X).ToString(CultureInfo.InvariantCulture)). Replace("{N}", (arc * p2.Y).ToString(CultureInfo.InvariantCulture)); } + else + { + uri = uri. + Replace("{w}", west.ToString(CultureInfo.InvariantCulture)). + Replace("{s}", south.ToString(CultureInfo.InvariantCulture)). + Replace("{e}", east.ToString(CultureInfo.InvariantCulture)). + Replace("{n}", north.ToString(CultureInfo.InvariantCulture)); + } try { @@ -156,7 +149,7 @@ namespace MapControl private void UpdateImage(object sender, EventArgs e) { - if (!updateInProgress) + if (ParentMap != null && !updateInProgress) { updateTimer.Stop(); updateInProgress = true; @@ -179,10 +172,7 @@ namespace MapControl var north = Math.Max(loc1.Latitude, Math.Max(loc2.Latitude, Math.Max(loc3.Latitude, loc4.Latitude))); var image = GetImage(west, east, south, north, (int)width, (int)height); - if (image != null) - { - Dispatcher.BeginInvoke((Action)(() => UpdateImage(west, east, south, north, image))); - } + Dispatcher.BeginInvoke((Action)(() => UpdateImage(west, east, south, north, image))); updateInProgress = false; }); diff --git a/MapControl/MapOverlay.cs b/MapControl/MapOverlay.cs index cffed6e2..c832c887 100644 --- a/MapControl/MapOverlay.cs +++ b/MapControl/MapOverlay.cs @@ -2,6 +2,7 @@ // Copyright © Clemens Fischer 2012-2013 // Licensed under the Microsoft Public License (Ms-PL) +using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -170,14 +171,14 @@ namespace MapControl { if (parentMap != null) { - parentMap.ViewportChanged -= (o, e) => OnViewportChanged(); + parentMap.ViewportChanged -= OnViewportChanged; } parentMap = value; if (parentMap != null) { - parentMap.ViewportChanged += (o, e) => OnViewportChanged(); + parentMap.ViewportChanged += OnViewportChanged; OnViewportChanged(); } } @@ -225,6 +226,11 @@ namespace MapControl { } + private void OnViewportChanged(object sender, EventArgs e) + { + OnViewportChanged(); + } + private void ForegroundChanged() { if (Stroke == null) diff --git a/MapControl/MapPanel.cs b/MapControl/MapPanel.cs index f83bbf65..9acd7f53 100644 --- a/MapControl/MapPanel.cs +++ b/MapControl/MapPanel.cs @@ -2,6 +2,7 @@ // Copyright © Clemens Fischer 2012-2013 // Licensed under the Microsoft Public License (Ms-PL) +using System; #if NETFX_CORE using Windows.Foundation; using Windows.UI.Xaml; @@ -57,32 +58,19 @@ namespace MapControl { if (parentMap != null && parentMap != this) { - parentMap.ViewportChanged -= (o, e) => OnViewportChanged(); + parentMap.ViewportChanged -= OnViewportChanged; } parentMap = value; if (parentMap != null && parentMap != this) { - parentMap.ViewportChanged += (o, e) => OnViewportChanged(); + parentMap.ViewportChanged += OnViewportChanged; OnViewportChanged(); } } } - protected virtual void OnViewportChanged() - { - foreach (UIElement element in InternalChildren) - { - var location = GetLocation(element); - - if (location != null) - { - SetViewportPosition(element, parentMap, location); - } - } - } - protected override Size MeasureOverride(Size availableSize) { foreach (UIElement element in InternalChildren) @@ -110,6 +98,24 @@ namespace MapControl return finalSize; } + protected virtual void OnViewportChanged() + { + foreach (UIElement element in InternalChildren) + { + var location = GetLocation(element); + + if (location != null) + { + SetViewportPosition(element, parentMap, location); + } + } + } + + private void OnViewportChanged(object sender, EventArgs e) + { + OnViewportChanged(); + } + private static void ParentMapPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { var mapElement = obj as IMapElement; diff --git a/MapControl/Properties/AssemblyInfo.cs b/MapControl/Properties/AssemblyInfo.cs index b0b16132..9d17a95a 100644 --- a/MapControl/Properties/AssemblyInfo.cs +++ b/MapControl/Properties/AssemblyInfo.cs @@ -15,8 +15,8 @@ using System.Windows; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/WinRT/Properties/AssemblyInfo.cs b/MapControl/WinRT/Properties/AssemblyInfo.cs index 9ce4a501..51a0b77f 100644 --- a/MapControl/WinRT/Properties/AssemblyInfo.cs +++ b/MapControl/WinRT/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs index 230e140d..65750fd3 100644 --- a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs +++ b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs index cfa9dfaf..22311dff 100644 --- a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs +++ b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/StoreApplication/Properties/AssemblyInfo.cs b/SampleApps/StoreApplication/Properties/AssemblyInfo.cs index a2ee4f91..9ebdbc68 100644 --- a/SampleApps/StoreApplication/Properties/AssemblyInfo.cs +++ b/SampleApps/StoreApplication/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/SurfaceApplication/Properties/AssemblyInfo.cs b/SampleApps/SurfaceApplication/Properties/AssemblyInfo.cs index d92ba43b..237aa226 100644 --- a/SampleApps/SurfaceApplication/Properties/AssemblyInfo.cs +++ b/SampleApps/SurfaceApplication/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/WpfApplication/MainWindow.xaml b/SampleApps/WpfApplication/MainWindow.xaml index 100a2a3d..8da7248a 100644 --- a/SampleApps/WpfApplication/MainWindow.xaml +++ b/SampleApps/WpfApplication/MainWindow.xaml @@ -45,10 +45,10 @@ - - + + @@ -153,7 +153,7 @@ @@ -229,7 +229,7 @@ + SelectedIndex="0" ItemsSource="{Binding Source={StaticResource TileLayersViewSource}}"/> diff --git a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs index a6d2aa7b..1a06261d 100644 --- a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs +++ b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("1.3.5")] -[assembly: AssemblyFileVersion("1.3.5")] +[assembly: AssemblyVersion("1.3.6")] +[assembly: AssemblyFileVersion("1.3.6")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/SampleApps/WpfApplication/Properties/Settings.Designer.cs b/SampleApps/WpfApplication/Properties/Settings.Designer.cs index b8c0153a..c4d3337e 100644 --- a/SampleApps/WpfApplication/Properties/Settings.Designer.cs +++ b/SampleApps/WpfApplication/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18033 +// Runtime Version:4.0.30319.18046 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated.