簡體   English   中英

如何繪制折線Bing地圖Silverlight控件

[英]How plot polylines Bing Map Silverlight Control

我在Windows Phone 7上使用bing maps控件,而折線僅在模擬器中繪制。 當我在設備上運行時,沒有任何反應...

XDocument doc = XDocument.Parse(getRoute1());  //private string getRoute1() return gpx file
var ns = doc.Root.GetDefaultNamespace();
var loc = doc.Descendants()
   .Where(el => el.Name == ns + "wpt" || el.Name == ns + "trkpt")
   .Select(trkpt =>
   new Location
   {
        Latitude = double.Parse(trkpt.Attribute("lat").Value),
        Longitude = double.Parse(trkpt.Attribute("lon").Value)
    }).ToLocationCollection();
mapPolyline.Locations = loc;
maps.Children.Add(mapPolyline);
public MainPage()
        {
            InitializeComponent();
            double[] lattitudes = { 50.21934078740, 33.563511, 19.511719, 25.3125 };
            double[] longitudes = { 23.0518068854053, 35.368259, -14.43468, 67.542167 };
            this.DrawPolyLine(lattitudes, longitudes);   

        }

            private void DrawPolyLine(double []lat, double[]longi)
        {

            MapPolyline line = new MapPolyline();
             line.Stroke = new SolidColorBrush(Colors.Brown);
            line.StrokeThickness = 3;
            line.Locations = new LocationCollection();
            for (int i=0;i<4;i++){
                line.Locations.Add(new Location(lat[i], longi[i]));

                Pushpin p = new Pushpin();

                p.Location = new Location(lat[i], longi[i]);

                map1.Children.Add(p);
            }
                 map1.Children.Add(line);
         }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM