/// <summary> /// regenerates shape of route /// </summary> public virtual void RegenerateShape(GMapControl map) { if (map != null) { this.Map = map; if(Points.Count > 1) { Position = Points[0]; var localPath = new List<System.Windows.Point>(Points.Count); var offset = Map.FromLatLngToLocal(Points[0]); foreach(var i in Points) { var p = Map.FromLatLngToLocal(i); localPath.Add(new System.Windows.Point(p.X - offset.X, p.Y - offset.Y)); } var shape = map.CreateRoutePath(localPath); if(this.Shape is Path) { (this.Shape as Path).Data = shape.Data; } else { this.Shape = shape; } } else { this.Shape = null; } } }
/// <summary> /// regenerates shape of route /// </summary> 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; } } }