RegenerateRouteShape() in WPF

Topics: Bugs, WPF
Sep 22, 2011 at 6:52 AM

Hi radioman, I believe that there is a bug in the RegenerateRouteShape() function in "GMapMarker.cs". It does not update the map when you remove all the points from the route and call RegenerateRouteShape(). Need to add the code below in blue for the function to work properly. Also, same thing in RegeneratePolygonShape().

public virtual void RegenerateRouteShape(GMapControl map)
      {
         this.map = map;

         if(map != null && Route.Count > 1)
         {
            var localPath = new List<System.Windows.Point>();
            var offset = Map.FromLatLngToLocal(Route[0]);
            foreach(var i in Route)
            {
               var p = Map.FromLatLngToLocal(new PointLatLng(i.Lat, i.Lng));
               localPath.Add(new System.Windows.Point(p.X - offset.X, p.Y - offset.Y));
            }

            var shape = map.CreateRoutePath(localPath);

            if(this.Shape != null && this.Shape is Path)
            {
               (this.Shape as Path).Data = shape.Data;
            }
            else
            {
               this.Shape = shape;
            }
         }
         else if (map != null && Route.Count == 0)
         {
             this.Shape = null;
         }
      }

Coordinator
Sep 22, 2011 at 6:58 AM

thx

Sep 22, 2011 at 12:50 PM

Sorry, bug fix for my bug fix. Should be this:

... ...

else if (map != null && Route.Count <= 1)
{
    this.Shape = null;
}


*sheepish*

Coordinator
Sep 22, 2011 at 1:50 PM

ok ;}