示例#1
0
        public static GMapRoute DrawRoute(GMapOverlay overlay, RouteList routeList, RouteGeometryCalculator geometryCalc = null)
        {
            List <PointLatLng> points;

            if (geometryCalc != null)
            {
                var address = routeList.GenerateHashPiontsOfRoute();
                MainClass.progressBarWin.ProgressStart(address.Length);
                points = geometryCalc.GetGeometryOfRoute(address, (val, max) => MainClass.progressBarWin.ProgressUpdate(val));
                MainClass.progressBarWin.ProgressClose();
            }
            else
            {
                points = new List <PointLatLng>();
                points.Add(DistanceCalculator.BasePoint);
                points.AddRange(routeList.Addresses.Select(x => x.Order.DeliveryPoint.GmapPoint));
                points.Add(DistanceCalculator.BasePoint);
            }

            var route = new GMapRoute(points, routeList.Id.ToString());

            route.Stroke           = new System.Drawing.Pen(System.Drawing.Color.Blue);
            route.Stroke.Width     = 2;
            route.Stroke.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;

            overlay.Routes.Add(route);
            return(route);
        }