Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="points"></param>
        private void DrawRoute(List<Location> points)
        {
            MapShapeLayer shapeLayer = new MapShapeLayer();
            MapPolyline polyline = new MapPolyline();

            LocationCollection lc = new LocationCollection();

            foreach (Location p in points)
            {
                lc.Add(p);
            }

            polyline.Locations = lc;
            polyline.Color = Color.FromArgb(255, 102, 0, 0);
            polyline.Width = 5;
            shapeLayer.Shapes.Add(polyline);
            Map.ShapeLayers.Clear();
            Map.ShapeLayers.Add(shapeLayer);

            Location midpoint = new Location(lc.FirstOrDefault().Latitude + ((lc.LastOrDefault().Latitude - lc.FirstOrDefault().Latitude) / 2.0),
                                             lc.FirstOrDefault().Longitude + ((lc.LastOrDefault().Longitude - lc.FirstOrDefault().Longitude) / 2.0));

            Map.SetView(midpoint, 15.5F);
        }