From de4ba0765a5f154bba537b6c5f0619e38951709f Mon Sep 17 00:00:00 2001 From: ClemensF Date: Thu, 29 Mar 2018 19:35:52 +0200 Subject: [PATCH] Version 4.7.1: Fixed MapOverlay Foreground and Stroke. --- FileDbCache/UWP/Properties/AssemblyInfo.cs | 4 +- FileDbCache/WPF/Properties/AssemblyInfo.cs | 4 +- MBTiles/UWP/Properties/AssemblyInfo.cs | 4 +- MBTiles/WPF/Properties/AssemblyInfo.cs | 4 +- MapControl.sln | 2 +- MapControl/Shared/MapOverlay.cs | 18 ++++++++ MapControl/Shared/MapScale.cs | 54 +++++++++++----------- MapControl/UWP/MapGraticule.UWP.cs | 36 ++++++--------- MapControl/UWP/MapOverlay.UWP.cs | 32 ++----------- MapControl/UWP/Properties/AssemblyInfo.cs | 4 +- MapControl/WPF/MapGraticule.WPF.cs | 8 +++- MapControl/WPF/MapOverlay.WPF.cs | 21 --------- MapControl/WPF/Properties/AssemblyInfo.cs | 4 +- 13 files changed, 84 insertions(+), 111 deletions(-) diff --git a/FileDbCache/UWP/Properties/AssemblyInfo.cs b/FileDbCache/UWP/Properties/AssemblyInfo.cs index 65b78324..e28a23e1 100644 --- a/FileDbCache/UWP/Properties/AssemblyInfo.cs +++ b/FileDbCache/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2018 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("4.7.0")] -[assembly: AssemblyFileVersion("4.7.0")] +[assembly: AssemblyVersion("4.7.1")] +[assembly: AssemblyFileVersion("4.7.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/FileDbCache/WPF/Properties/AssemblyInfo.cs b/FileDbCache/WPF/Properties/AssemblyInfo.cs index 589f6001..50ae554e 100644 --- a/FileDbCache/WPF/Properties/AssemblyInfo.cs +++ b/FileDbCache/WPF/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2018 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("4.7.0")] -[assembly: AssemblyFileVersion("4.7.0")] +[assembly: AssemblyVersion("4.7.1")] +[assembly: AssemblyFileVersion("4.7.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MBTiles/UWP/Properties/AssemblyInfo.cs b/MBTiles/UWP/Properties/AssemblyInfo.cs index 0139d9ec..726c3d27 100644 --- a/MBTiles/UWP/Properties/AssemblyInfo.cs +++ b/MBTiles/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2018 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("4.7.0")] -[assembly: AssemblyFileVersion("4.7.0")] +[assembly: AssemblyVersion("4.7.1")] +[assembly: AssemblyFileVersion("4.7.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MBTiles/WPF/Properties/AssemblyInfo.cs b/MBTiles/WPF/Properties/AssemblyInfo.cs index d557551c..2079624f 100644 --- a/MBTiles/WPF/Properties/AssemblyInfo.cs +++ b/MBTiles/WPF/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2018 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("4.7.0")] -[assembly: AssemblyFileVersion("4.7.0")] +[assembly: AssemblyVersion("4.7.1")] +[assembly: AssemblyFileVersion("4.7.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl.sln b/MapControl.sln index 9310175b..7b5a8380 100644 --- a/MapControl.sln +++ b/MapControl.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.27004.2005 +VisualStudioVersion = 15.0.27130.2036 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MapControl", "MapControl", "{52AECE49-F314-4F76-98F2-FA800F07824B}" EndProject diff --git a/MapControl/Shared/MapOverlay.cs b/MapControl/Shared/MapOverlay.cs index da7d785b..745b4d9c 100644 --- a/MapControl/Shared/MapOverlay.cs +++ b/MapControl/Shared/MapOverlay.cs @@ -4,9 +4,12 @@ #if WINDOWS_UWP using Windows.UI.Text; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; #else using System.Windows; +using System.Windows.Data; using System.Windows.Media; #endif @@ -17,6 +20,21 @@ namespace MapControl /// public partial class MapOverlay : MapPanel { + public MapOverlay() + { + Loaded += (s, e) => + { + if (Stroke == null) + { + SetBinding(StrokeProperty, new Binding + { + Source = this, + Path = new PropertyPath("Foreground") + }); + } + }; + } + public double FontSize { get { return (double)GetValue(FontSizeProperty); } diff --git a/MapControl/Shared/MapScale.cs b/MapControl/Shared/MapScale.cs index 9245fcf2..6cf35623 100644 --- a/MapControl/Shared/MapScale.cs +++ b/MapControl/Shared/MapScale.cs @@ -43,29 +43,27 @@ namespace MapControl label.VerticalAlignment = VerticalAlignment.Top; label.TextAlignment = TextAlignment.Center; - label.SetBinding(TextBlock.ForegroundProperty, - GetBindingExpression(ForegroundProperty)?.ParentBinding ?? - new Binding - { - Source = this, - Path = new PropertyPath("Foreground") - }); + label.SetBinding(TextBlock.ForegroundProperty, new Binding + { + Source = this, + Path = new PropertyPath("Foreground") + }); - line.SetBinding(Shape.StrokeProperty, - GetBindingExpression(StrokeProperty)?.ParentBinding ?? - new Binding - { - Source = this, - Path = new PropertyPath("Stroke") - }); - line.SetBinding(Shape.StrokeThicknessProperty, - GetBindingExpression(StrokeThicknessProperty)?.ParentBinding ?? - new Binding - { - Source = this, - Path = new PropertyPath("StrokeThickness") - }); + + line.SetBinding(Shape.StrokeProperty, new Binding + { + Source = this, + Path = new PropertyPath("Stroke") + }); + + + + line.SetBinding(Shape.StrokeThicknessProperty, new Binding + { + Source = this, + Path = new PropertyPath("StrokeThickness") + }); Children.Add(line); Children.Add(label); @@ -106,13 +104,15 @@ namespace MapControl var x2 = size.Width - Padding.Right - StrokeThickness / 2d; var y1 = size.Height / 2d; var y2 = size.Height - Padding.Bottom - StrokeThickness / 2d; - var points = new PointCollection(); - points.Add(new Point(x1, y1)); - points.Add(new Point(x1, y2)); - points.Add(new Point(x2, y2)); - points.Add(new Point(x2, y1)); - line.Points = points; + line.Points = new PointCollection + { + new Point(x1, y1), + new Point(x1, y2), + new Point(x2, y2), + new Point(x2, y1) + }; + line.Measure(size); if (FontFamily != null) diff --git a/MapControl/UWP/MapGraticule.UWP.cs b/MapControl/UWP/MapGraticule.UWP.cs index d1ed0f42..0f5dcfe3 100644 --- a/MapControl/UWP/MapGraticule.UWP.cs +++ b/MapControl/UWP/MapGraticule.UWP.cs @@ -35,21 +35,17 @@ namespace MapControl Data = new PathGeometry() }; - path.SetBinding(Shape.StrokeProperty, - GetBindingExpression(StrokeProperty)?.ParentBinding ?? - new Binding - { - Source = this, - Path = new PropertyPath("Stroke") - }); + path.SetBinding(Shape.StrokeProperty, new Binding + { + Source = this, + Path = new PropertyPath("Stroke") + }); - path.SetBinding(Shape.StrokeThicknessProperty, - GetBindingExpression(StrokeThicknessProperty)?.ParentBinding ?? - new Binding - { - Source = this, - Path = new PropertyPath("StrokeThickness") - }); + path.SetBinding(Shape.StrokeThicknessProperty, new Binding + { + Source = this, + Path = new PropertyPath("StrokeThickness") + }); Children.Add(path); } @@ -135,13 +131,11 @@ namespace MapControl RenderTransform = renderTransform }; - label.SetBinding(TextBlock.ForegroundProperty, - GetBindingExpression(ForegroundProperty)?.ParentBinding ?? - new Binding - { - Source = this, - Path = new PropertyPath("Foreground") - }); + label.SetBinding(TextBlock.ForegroundProperty, new Binding + { + Source = this, + Path = new PropertyPath("Foreground") + }); Children.Add(label); } diff --git a/MapControl/UWP/MapOverlay.UWP.cs b/MapControl/UWP/MapOverlay.UWP.cs index 0487894d..02092e68 100644 --- a/MapControl/UWP/MapOverlay.UWP.cs +++ b/MapControl/UWP/MapOverlay.UWP.cs @@ -58,35 +58,13 @@ namespace MapControl protected override void SetParentMap(MapBase parentMap) { - if (GetBindingExpression(ForegroundProperty) != null) + if (parentMap != null && Foreground == null) { - ClearValue(ForegroundProperty); - } - - if (GetBindingExpression(StrokeProperty) != null) - { - ClearValue(StrokeProperty); - } - - if (parentMap != null) - { - if (Foreground == null) + SetBinding(ForegroundProperty, new Binding { - SetBinding(ForegroundProperty, new Binding - { - Source = parentMap, - Path = new PropertyPath("Foreground") - }); - } - - if (Stroke == null) - { - SetBinding(StrokeProperty, new Binding - { - Source = parentMap, - Path = new PropertyPath("Foreground") - }); - } + Source = parentMap, + Path = new PropertyPath("Foreground") + }); } base.SetParentMap(parentMap); diff --git a/MapControl/UWP/Properties/AssemblyInfo.cs b/MapControl/UWP/Properties/AssemblyInfo.cs index 49515f25..44a37f24 100644 --- a/MapControl/UWP/Properties/AssemblyInfo.cs +++ b/MapControl/UWP/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2018 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("4.7.0")] -[assembly: AssemblyFileVersion("4.7.0")] +[assembly: AssemblyVersion("4.7.1")] +[assembly: AssemblyFileVersion("4.7.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] diff --git a/MapControl/WPF/MapGraticule.WPF.cs b/MapControl/WPF/MapGraticule.WPF.cs index 1359205f..d776c3ee 100644 --- a/MapControl/WPF/MapGraticule.WPF.cs +++ b/MapControl/WPF/MapGraticule.WPF.cs @@ -70,8 +70,12 @@ namespace MapControl { Brush = Stroke, Thickness = StrokeThickness, - DashStyle = new DashStyle(StrokeDashArray, StrokeDashOffset), - DashCap = StrokeDashCap + LineJoin = StrokeLineJoin, + MiterLimit = StrokeMiterLimit, + StartLineCap = StrokeStartLineCap, + EndLineCap = StrokeEndLineCap, + DashCap = StrokeDashCap, + DashStyle = new DashStyle(StrokeDashArray, StrokeDashOffset) }; for (var lat = latLabelStart; lat <= boundingBox.North; lat += lineDistance) diff --git a/MapControl/WPF/MapOverlay.WPF.cs b/MapControl/WPF/MapOverlay.WPF.cs index 2ae253d8..c65f559a 100644 --- a/MapControl/WPF/MapOverlay.WPF.cs +++ b/MapControl/WPF/MapOverlay.WPF.cs @@ -4,8 +4,6 @@ using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Media; using System.Windows.Shapes; namespace MapControl @@ -50,24 +48,5 @@ namespace MapControl public static readonly DependencyProperty StrokeMiterLimitProperty = Shape.StrokeMiterLimitProperty.AddOwner( typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true }); - - protected override void SetParentMap(MapBase parentMap) - { - if (GetBindingExpression(StrokeProperty) != null) - { - ClearValue(StrokeProperty); - } - - if (parentMap != null && Stroke == null) - { - SetBinding(StrokeProperty, new Binding - { - Source = parentMap, - Path = new PropertyPath("Foreground") - }); - } - - base.SetParentMap(parentMap); - } } } diff --git a/MapControl/WPF/Properties/AssemblyInfo.cs b/MapControl/WPF/Properties/AssemblyInfo.cs index 259e762b..0f813a52 100644 --- a/MapControl/WPF/Properties/AssemblyInfo.cs +++ b/MapControl/WPF/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ using System.Windows; [assembly: AssemblyCompany("Clemens Fischer")] [assembly: AssemblyCopyright("© 2018 Clemens Fischer")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyVersion("4.7.0")] -[assembly: AssemblyFileVersion("4.7.0")] +[assembly: AssemblyVersion("4.7.1")] +[assembly: AssemblyFileVersion("4.7.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)]