From e85f1472ed49cc7e380a4b7089db25e01cff975e Mon Sep 17 00:00:00 2001 From: ClemensF Date: Sun, 5 Feb 2017 18:35:30 +0100 Subject: [PATCH] Version 2.14. Added ViewportChangedEventArgs, fixed default MapItem Style --- .../Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- MapControl/Map.Silverlight.cs | 2 +- MapControl/Map.WPF.cs | 2 +- MapControl/MapBase.Silverlight.WinRT.cs | 2 +- MapControl/MapBase.WPF.cs | 2 +- MapControl/MapBase.cs | 17 ++-- MapControl/MapControl.Silverlight.csproj | 1 + MapControl/MapControl.WPF.csproj | 1 + MapControl/MapGraticule.Silverlight.WinRT.cs | 4 +- MapControl/MapGraticule.WPF.cs | 2 +- MapControl/MapGraticule.cs | 2 +- MapControl/MapImageLayer.Silverlight.WinRT.cs | 8 +- MapControl/MapImageLayer.WPF.cs | 8 +- MapControl/MapImageLayer.cs | 86 +++++++++++++------ MapControl/MapPanel.cs | 8 +- MapControl/MapPath.cs | 2 +- MapControl/MapRectangle.cs | 15 +++- MapControl/MapScale.cs | 2 +- MapControl/Properties/AssemblyInfo.cs | 4 +- MapControl/Themes/Generic.xaml | 4 +- MapControl/TileLayer.Silverlight.WinRT.cs | 2 +- MapControl/TileLayer.WPF.cs | 2 +- MapControl/TileLayer.cs | 10 +-- MapControl/TileSource.cs | 20 ++--- MapControl/ViewportChangedEventArgs.cs | 22 +++++ MapControl/WinRT/MapControl.WinRT.csproj | 3 + MapControl/WinRT/Properties/AssemblyInfo.cs | 4 +- MapControl/WinRT/Themes/Generic.xaml | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../UniversalApp/Properties/AssemblyInfo.cs | 4 +- .../WpfApplication/Properties/AssemblyInfo.cs | 4 +- 37 files changed, 174 insertions(+), 105 deletions(-) create mode 100644 MapControl/ViewportChangedEventArgs.cs diff --git a/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs b/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs index b296706c..68a0ee2f 100644 --- a/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs +++ b/Caching/FileDbCache.WPF/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2016 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("2.13.0")] -[assembly: AssemblyFileVersion("2.13.0")] +[assembly: AssemblyVersion("2.14.0")] +[assembly: AssemblyFileVersion("2.14.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs b/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs index adc57779..30cc8632 100644 --- a/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs +++ b/Caching/FileDbCache.WinRT/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2016 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("2.13.0")] -[assembly: AssemblyFileVersion("2.13.0")] +[assembly: AssemblyVersion("2.14.0")] +[assembly: AssemblyFileVersion("2.14.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs b/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs index 3ed13877..5706ccb7 100644 --- a/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs +++ b/Caching/ImageFileCache.WPF/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2016 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("2.13.0")] -[assembly: AssemblyFileVersion("2.13.0")] +[assembly: AssemblyVersion("2.14.0")] +[assembly: AssemblyFileVersion("2.14.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs b/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs index 66abbdaa..87206b9c 100644 --- a/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs +++ b/Caching/ImageFileCache.WinRT/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2016 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("2.13.0")] -[assembly: AssemblyFileVersion("2.13.0")] +[assembly: AssemblyVersion("2.14.0")] +[assembly: AssemblyFileVersion("2.14.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/Map.Silverlight.cs b/MapControl/Map.Silverlight.cs index 470d190c..413f310c 100644 --- a/MapControl/Map.Silverlight.cs +++ b/MapControl/Map.Silverlight.cs @@ -36,7 +36,7 @@ namespace MapControl private void OnMouseWheel(object sender, MouseWheelEventArgs e) { - var zoomChange = MouseWheelZoomDelta * (double)e.Delta / 120d; + var zoomChange = MouseWheelZoomDelta * e.Delta / 120d; ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomChange); } diff --git a/MapControl/Map.WPF.cs b/MapControl/Map.WPF.cs index bd7bdfaa..02dd65a4 100644 --- a/MapControl/Map.WPF.cs +++ b/MapControl/Map.WPF.cs @@ -47,7 +47,7 @@ namespace MapControl { base.OnMouseWheel(e); - var zoomDelta = MouseWheelZoomDelta * (double)e.Delta / 120d; + var zoomDelta = MouseWheelZoomDelta * e.Delta / 120d; ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomDelta); } diff --git a/MapControl/MapBase.Silverlight.WinRT.cs b/MapControl/MapBase.Silverlight.WinRT.cs index 459ca2ce..c0f64af5 100644 --- a/MapControl/MapBase.Silverlight.WinRT.cs +++ b/MapControl/MapBase.Silverlight.WinRT.cs @@ -71,7 +71,7 @@ namespace MapControl private void SetViewportTransform(Location origin) { MapOrigin = mapTransform.Transform(origin); - ViewportScale = Math.Pow(2d, ZoomLevel) * (double)TileSource.TileSize / 360d; + ViewportScale = Math.Pow(2d, ZoomLevel) * TileSource.TileSize / 360d; var transform = new Matrix(1d, 0d, 0d, 1d, -MapOrigin.X, -MapOrigin.Y) .Rotate(-Heading) diff --git a/MapControl/MapBase.WPF.cs b/MapControl/MapBase.WPF.cs index 095afd78..64b48c4d 100644 --- a/MapControl/MapBase.WPF.cs +++ b/MapControl/MapBase.WPF.cs @@ -87,7 +87,7 @@ namespace MapControl private void SetViewportTransform(Location origin) { MapOrigin = mapTransform.Transform(origin); - ViewportScale = Math.Pow(2d, ZoomLevel) * (double)TileSource.TileSize / 360d; + ViewportScale = Math.Pow(2d, ZoomLevel) * TileSource.TileSize / 360d; var transform = new Matrix(1d, 0d, 0d, 1d, -MapOrigin.X, -MapOrigin.Y); transform.Rotate(-Heading); diff --git a/MapControl/MapBase.cs b/MapControl/MapBase.cs index 48c6c4fc..d9ec0d5c 100644 --- a/MapControl/MapBase.cs +++ b/MapControl/MapBase.cs @@ -92,7 +92,7 @@ namespace MapControl /// /// Raised when the current viewport has changed. /// - public event EventHandler ViewportChanged; + public event EventHandler ViewportChanged; /// /// Gets or sets the map foreground Brush. @@ -278,17 +278,17 @@ namespace MapControl public double ViewportScale { get; private set; } /// - /// Gets the scaling factor from meters to viewport coordinate units at the Center location. + /// Gets the scaling factor from meters to viewport coordinate units at the Center location (px/m). /// public double CenterScale { get; private set; } /// - /// Gets the map scale at the specified location as viewport coordinate units per meter. + /// Gets the map scale at the specified location as viewport coordinate units per meter (px/m). /// public double GetMapScale(Location location) { return mapTransform.RelativeScale(location) * - Math.Pow(2d, ZoomLevel) * (double)TileSource.TileSize / (TileSource.MetersPerDegree * 360d); + Math.Pow(2d, ZoomLevel) * TileSource.TileSize / (TileSource.MetersPerDegree * 360d); } /// @@ -821,6 +821,7 @@ namespace MapControl private void UpdateTransform(bool resetOrigin = false) { + var mapOriginX = MapOrigin.X; var center = transformOrigin ?? Center; SetViewportTransform(center); @@ -856,14 +857,14 @@ namespace MapControl scaleTransform.ScaleY = CenterScale; rotateTransform.Angle = Heading; - OnViewportChanged(); + OnViewportChanged(new ViewportChangedEventArgs(MapOrigin.X - mapOriginX)); } - protected override void OnViewportChanged() + protected override void OnViewportChanged(ViewportChangedEventArgs e) { - base.OnViewportChanged(); + base.OnViewportChanged(e); - ViewportChanged?.Invoke(this, EventArgs.Empty); + ViewportChanged?.Invoke(this, e); } } } diff --git a/MapControl/MapControl.Silverlight.csproj b/MapControl/MapControl.Silverlight.csproj index d5376343..baf3f127 100644 --- a/MapControl/MapControl.Silverlight.csproj +++ b/MapControl/MapControl.Silverlight.csproj @@ -113,6 +113,7 @@ + diff --git a/MapControl/MapControl.WPF.csproj b/MapControl/MapControl.WPF.csproj index 212d9d93..1e89bd4d 100644 --- a/MapControl/MapControl.WPF.csproj +++ b/MapControl/MapControl.WPF.csproj @@ -98,6 +98,7 @@ + diff --git a/MapControl/MapGraticule.Silverlight.WinRT.cs b/MapControl/MapGraticule.Silverlight.WinRT.cs index bff045a9..702ae56c 100644 --- a/MapControl/MapGraticule.Silverlight.WinRT.cs +++ b/MapControl/MapGraticule.Silverlight.WinRT.cs @@ -32,7 +32,7 @@ namespace MapControl StrokeThickness = 0.5; } - protected override void OnViewportChanged() + protected override void OnViewportChanged(ViewportChangedEventArgs e) { if (path == null) { @@ -199,7 +199,7 @@ namespace MapControl viewportTransform.Y = viewportPosition.Y; } - base.OnViewportChanged(); + base.OnViewportChanged(e); } } } diff --git a/MapControl/MapGraticule.WPF.cs b/MapControl/MapGraticule.WPF.cs index 1da4fc30..3035b2fa 100644 --- a/MapControl/MapGraticule.WPF.cs +++ b/MapControl/MapGraticule.WPF.cs @@ -33,7 +33,7 @@ namespace MapControl typeof(MapGraticule), new FrameworkPropertyMetadata(0.5)); } - protected override void OnViewportChanged() + protected override void OnViewportChanged(ViewportChangedEventArgs e) { InvalidateVisual(); } diff --git a/MapControl/MapGraticule.cs b/MapControl/MapGraticule.cs index 30e8bfb3..da723602 100644 --- a/MapControl/MapGraticule.cs +++ b/MapControl/MapGraticule.cs @@ -30,7 +30,7 @@ namespace MapControl private double GetLineDistance() { - var minDistance = MinLineDistance * 360d / (Math.Pow(2d, ParentMap.ZoomLevel) * (double)TileSource.TileSize); + var minDistance = MinLineDistance * 360d / (Math.Pow(2d, ParentMap.ZoomLevel) * TileSource.TileSize); var scale = 1d; if (minDistance < 1d) diff --git a/MapControl/MapImageLayer.Silverlight.WinRT.cs b/MapControl/MapImageLayer.Silverlight.WinRT.cs index cfc16c99..3d6c0b6e 100644 --- a/MapControl/MapImageLayer.Silverlight.WinRT.cs +++ b/MapControl/MapImageLayer.Silverlight.WinRT.cs @@ -15,14 +15,14 @@ namespace MapControl { public partial class MapImageLayer { - protected virtual void UpdateImage(BoundingBox boundingBox, Uri uri) + protected virtual void UpdateImage(Uri uri) { - UpdateImage(boundingBox, new BitmapImage(uri)); + UpdateImage(new BitmapImage(uri)); } - protected void UpdateImage(BoundingBox boundingBox, BitmapSource bitmap) + protected void UpdateImage(BitmapSource bitmap) { - SetTopImage(boundingBox, bitmap); + SetTopImage(bitmap); var bitmapImage = bitmap as BitmapImage; diff --git a/MapControl/MapImageLayer.WPF.cs b/MapControl/MapImageLayer.WPF.cs index e7b22029..54ea8762 100644 --- a/MapControl/MapImageLayer.WPF.cs +++ b/MapControl/MapImageLayer.WPF.cs @@ -11,18 +11,18 @@ namespace MapControl { public partial class MapImageLayer { - protected virtual void UpdateImage(BoundingBox boundingBox, Uri uri) + protected virtual void UpdateImage(Uri uri) { Task.Run(() => { var image = ImageLoader.FromUri(uri); - Dispatcher.BeginInvoke(new Action(() => UpdateImage(boundingBox, image))); + Dispatcher.BeginInvoke(new Action(() => UpdateImage(image))); }); } - protected void UpdateImage(BoundingBox boundingBox, BitmapSource bitmap) + protected void UpdateImage(BitmapSource bitmap) { - SetTopImage(boundingBox, bitmap); + SetTopImage(bitmap); if (bitmap != null && !bitmap.IsFrozen && bitmap.IsDownloading) { diff --git a/MapControl/MapImageLayer.cs b/MapControl/MapImageLayer.cs index 3649b0d6..f0ba3af1 100644 --- a/MapControl/MapImageLayer.cs +++ b/MapControl/MapImageLayer.cs @@ -4,6 +4,7 @@ using System; using System.Globalization; +using System.Linq; #if NETFX_CORE using Windows.Foundation; using Windows.UI.Xaml; @@ -21,7 +22,7 @@ using System.Windows.Threading; namespace MapControl { /// - /// Map image overlay. Fills the entire viewport with map images provided by a web service, + /// Map image overlay. Fills the entire viewport with a map image provided by a web service, /// e.g. a Web Map Service (WMS). The image request Uri is specified by the UriFormat property. /// public partial class MapImageLayer : MapPanel @@ -58,6 +59,9 @@ namespace MapControl public static readonly DependencyProperty MaxLatitudeProperty = DependencyProperty.Register( "MaxLatitude", typeof(double), typeof(MapImageLayer), new PropertyMetadata(double.NaN)); + public static readonly DependencyProperty MaxBoundingBoxWidthProperty = DependencyProperty.Register( + "MaxBoundingBoxWidth", typeof(double), typeof(MapImageLayer), new PropertyMetadata(double.NaN)); + public static readonly DependencyProperty RelativeImageSizeProperty = DependencyProperty.Register( "RelativeImageSize", typeof(double), typeof(MapImageLayer), new PropertyMetadata(1d)); @@ -127,7 +131,16 @@ namespace MapControl } /// - /// Relative size of the map images in relation to the current viewport size. + /// Optional maximum width of the map image's bounding box. Default is NaN. + /// + public double MaxBoundingBoxWidth + { + get { return (double)GetValue(MaxBoundingBoxWidthProperty); } + set { SetValue(MaxBoundingBoxWidthProperty, value); } + } + + /// + /// Relative size of the map image in relation to the current viewport size. /// Setting a value greater than one will let MapImageLayer request images that /// are larger than the viewport, in order to support smooth panning. /// @@ -146,19 +159,36 @@ namespace MapControl set { SetValue(UpdateIntervalProperty, value); } } - protected virtual BoundingBox ProjectBoundingBox(BoundingBox boundingBox) - { - var p1 = ParentMap.MapTransform.Transform(new Location(boundingBox.South, boundingBox.West)); - var p2 = ParentMap.MapTransform.Transform(new Location(boundingBox.North, boundingBox.East)); + protected BoundingBox ImageBoundingBox { get; private set; } - return new BoundingBox( - TileSource.MetersPerDegree * p1.X, TileSource.MetersPerDegree * p2.X, - TileSource.MetersPerDegree * p1.Y, TileSource.MetersPerDegree * p2.Y); + protected virtual BoundingBox ProjectedBoundingBox + { + get + { + var p1 = ParentMap.MapTransform.Transform(new Location(ImageBoundingBox.South, ImageBoundingBox.West)); + var p2 = ParentMap.MapTransform.Transform(new Location(ImageBoundingBox.North, ImageBoundingBox.East)); + + return new BoundingBox( + TileSource.MetersPerDegree * p1.X, TileSource.MetersPerDegree * p2.X, + TileSource.MetersPerDegree * p1.Y, TileSource.MetersPerDegree * p2.Y); + } } - protected override void OnViewportChanged() + protected override void OnViewportChanged(ViewportChangedEventArgs e) { - base.OnViewportChanged(); + base.OnViewportChanged(e); + + if (Math.Abs(e.OriginOffset) > 180d) + { + var offset = 360d * Math.Sign(e.OriginOffset); + + ImageBoundingBox = new BoundingBox(ImageBoundingBox.West + offset, ImageBoundingBox.East + offset, ImageBoundingBox.South, ImageBoundingBox.North); + + foreach (var mapImage in Children.OfType().Where(i => i.BoundingBoxValid)) + { + mapImage.SetBoundingBox(mapImage.West + offset, mapImage.East + offset, mapImage.South, mapImage.North); + } + } updateTimer.Stop(); updateTimer.Start(); @@ -212,16 +242,24 @@ namespace MapControl north = MaxLatitude; } + if (!double.IsNaN(MaxBoundingBoxWidth) && east - west > MaxBoundingBoxWidth) + { + var d = (east - west - MaxBoundingBoxWidth) / 2d; + west += d; + east -= d; + } + + ImageBoundingBox = new BoundingBox(west, east, south, north); + var p1 = ParentMap.MapTransform.Transform(new Location(south, west)); var p2 = ParentMap.MapTransform.Transform(new Location(north, east)); - UpdateImage(new BoundingBox(west, east, south, north), - (int)Math.Round((p2.X - p1.X) * ParentMap.ViewportScale), - (int)Math.Round((p2.Y - p1.Y) * ParentMap.ViewportScale)); + UpdateImage((int)Math.Round((p2.X - p1.X) * ParentMap.ViewportScale), + (int)Math.Round((p2.Y - p1.Y) * ParentMap.ViewportScale)); } } - protected virtual void UpdateImage(BoundingBox boundingBox, int width, int height) + protected virtual void UpdateImage(int width, int height) { if (UriFormat != null && width > 0 && height > 0) { @@ -231,7 +269,7 @@ namespace MapControl if (uri.Contains("{W}") && uri.Contains("{E}") && uri.Contains("{S}") && uri.Contains("{N}")) { - var projectedBoundingBox = ProjectBoundingBox(boundingBox); + var projectedBoundingBox = ProjectedBoundingBox; uri = uri .Replace("{W}", projectedBoundingBox.West.ToString(CultureInfo.InvariantCulture)) @@ -242,26 +280,26 @@ namespace MapControl else { uri = uri - .Replace("{w}", boundingBox.West.ToString(CultureInfo.InvariantCulture)) - .Replace("{s}", boundingBox.South.ToString(CultureInfo.InvariantCulture)) - .Replace("{e}", boundingBox.East.ToString(CultureInfo.InvariantCulture)) - .Replace("{n}", boundingBox.North.ToString(CultureInfo.InvariantCulture)); + .Replace("{w}", ImageBoundingBox.West.ToString(CultureInfo.InvariantCulture)) + .Replace("{s}", ImageBoundingBox.South.ToString(CultureInfo.InvariantCulture)) + .Replace("{e}", ImageBoundingBox.East.ToString(CultureInfo.InvariantCulture)) + .Replace("{n}", ImageBoundingBox.North.ToString(CultureInfo.InvariantCulture)); } - UpdateImage(boundingBox, new Uri(uri)); + UpdateImage(new Uri(uri)); } else { - UpdateImage(boundingBox, (BitmapSource)null); + UpdateImage((BitmapSource)null); } } - private void SetTopImage(BoundingBox boundingBox, BitmapSource bitmap) + private void SetTopImage(BitmapSource bitmap) { currentImageIndex = (currentImageIndex + 1) % 2; var topImage = (MapImage)Children[currentImageIndex]; - topImage.SetBoundingBox(boundingBox.West, boundingBox.East, boundingBox.South, boundingBox.North); + topImage.SetBoundingBox(ImageBoundingBox.West, ImageBoundingBox.East, ImageBoundingBox.South, ImageBoundingBox.North); topImage.Source = bitmap; } diff --git a/MapControl/MapPanel.cs b/MapControl/MapPanel.cs index 0d80aed9..f7495025 100644 --- a/MapControl/MapPanel.cs +++ b/MapControl/MapPanel.cs @@ -74,11 +74,11 @@ namespace MapControl if (parentMap != null && parentMap != this) { parentMap.ViewportChanged += OnViewportChanged; - OnViewportChanged(); + OnViewportChanged(new ViewportChangedEventArgs(0d)); } } - protected virtual void OnViewportChanged() + protected virtual void OnViewportChanged(ViewportChangedEventArgs e) { foreach (UIElement element in Children) { @@ -91,9 +91,9 @@ namespace MapControl } } - private void OnViewportChanged(object sender, EventArgs e) + private void OnViewportChanged(object sender, ViewportChangedEventArgs e) { - OnViewportChanged(); + OnViewportChanged(e); } private static void ParentMapPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) diff --git a/MapControl/MapPath.cs b/MapControl/MapPath.cs index 5e9716a9..779735f6 100644 --- a/MapControl/MapPath.cs +++ b/MapControl/MapPath.cs @@ -93,7 +93,7 @@ namespace MapControl { viewportTransform.Children.Insert(0, new TranslateTransform()); parentMap.ViewportChanged += OnViewportChanged; - OnViewportChanged(parentMap, EventArgs.Empty); + OnViewportChanged(parentMap, null); } private void DetachViewportChanged() diff --git a/MapControl/MapRectangle.cs b/MapControl/MapRectangle.cs index c56550f6..4e44172d 100644 --- a/MapControl/MapRectangle.cs +++ b/MapControl/MapRectangle.cs @@ -67,6 +67,16 @@ namespace MapControl set { SetValue(NorthProperty, value); } } + public bool BoundingBoxValid + { + get + { + return !double.IsNaN(South) && !double.IsNaN(North) + && !double.IsNaN(West) && !double.IsNaN(East) + && South < North && West < East; + } + } + public void SetBoundingBox(double west, double east, double south, double north) { if (West != west || East != east || South != south || North != north) @@ -87,10 +97,7 @@ namespace MapControl { var geometry = (RectangleGeometry)Data; - if (ParentMap != null && - !double.IsNaN(South) && !double.IsNaN(North) && - !double.IsNaN(West) && !double.IsNaN(East) && - South < North && West < East) + if (ParentMap != null && BoundingBoxValid) { var rect = new Rect(ParentMap.MapTransform.Transform(new Location(South, West)), ParentMap.MapTransform.Transform(new Location(North, East))); diff --git a/MapControl/MapScale.cs b/MapControl/MapScale.cs index d92c2d52..2f5c4119 100644 --- a/MapControl/MapScale.cs +++ b/MapControl/MapScale.cs @@ -99,7 +99,7 @@ namespace MapControl } } - protected override void OnViewportChanged() + protected override void OnViewportChanged(ViewportChangedEventArgs e) { InvalidateMeasure(); } diff --git a/MapControl/Properties/AssemblyInfo.cs b/MapControl/Properties/AssemblyInfo.cs index 9c43987b..159a095c 100644 --- a/MapControl/Properties/AssemblyInfo.cs +++ b/MapControl/Properties/AssemblyInfo.cs @@ -14,8 +14,8 @@ using System.Windows; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2016 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("2.13.0")] -[assembly: AssemblyFileVersion("2.13.0")] +[assembly: AssemblyVersion("2.14.0")] +[assembly: AssemblyFileVersion("2.14.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/Themes/Generic.xaml b/MapControl/Themes/Generic.xaml index 9bb30526..d85e6f7d 100644 --- a/MapControl/Themes/Generic.xaml +++ b/MapControl/Themes/Generic.xaml @@ -20,8 +20,8 @@