From bad7fc1760981a4385da3a1f33ddd37df565cd92 Mon Sep 17 00:00:00 2001 From: radioman Date: Tue, 19 May 2015 12:26:41 +0300 Subject: [PATCH] GMap.NET.WindowsPresentation: WPF couldn't draw GMapRoute and GMapPolygon, thx WintelZhao --- GMap.NET.WindowsForms/GMap.NET.WindowsForms/GMapMarker.cs | 5 +---- .../GMap.NET.WindowsPresentation/GMapPolygon.cs | 8 +++----- .../GMap.NET.WindowsPresentation/GMapRoute.cs | 8 +++----- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/GMap.NET.WindowsForms/GMap.NET.WindowsForms/GMapMarker.cs b/GMap.NET.WindowsForms/GMap.NET.WindowsForms/GMapMarker.cs index 564802da..93fba73e 100644 --- a/GMap.NET.WindowsForms/GMap.NET.WindowsForms/GMapMarker.cs +++ b/GMap.NET.WindowsForms/GMap.NET.WindowsForms/GMapMarker.cs @@ -109,10 +109,7 @@ public Point LocalPosition { if(!Overlay.Control.HoldInvalidation) { - if (Overlay.Control.Core.Refresh!=null) - { - Overlay.Control.Core.Refresh.Set(); - } + Overlay.Control.Invalidate(); } } } diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapPolygon.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapPolygon.cs index c7653a0a..74714270 100644 --- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapPolygon.cs +++ b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapPolygon.cs @@ -11,11 +11,7 @@ public class GMapPolygon : GMapMarker, IShapable public GMapPolygon(IEnumerable points) { Points.AddRange(points); - if (Points.Count > 0) - { - Position = Points[0]; - RegenerateShape(null); - } + RegenerateShape(null); } public override void Clear() @@ -35,6 +31,8 @@ public virtual void RegenerateShape(GMapControl map) if(Points.Count > 1) { + Position = Points[0]; + var localPath = new List(Points.Count); var offset = Map.FromLatLngToLocal(Points[0]); foreach(var i in Points) diff --git a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapRoute.cs b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapRoute.cs index fa79851e..01d4a321 100644 --- a/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapRoute.cs +++ b/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation/GMapRoute.cs @@ -16,11 +16,7 @@ public class GMapRoute : GMapMarker, IShapable public GMapRoute(IEnumerable points) { Points.AddRange(points); - if (Points.Count > 0) - { - Position = Points[0]; - RegenerateShape(null); - } + RegenerateShape(null); } public override void Clear() @@ -40,6 +36,8 @@ public virtual void RegenerateShape(GMapControl map) if(Points.Count > 1) { + Position = Points[0]; + var localPath = new List(Points.Count); var offset = Map.FromLatLngToLocal(Points[0]); foreach(var i in Points)