C# 诺基亚在此地图绘制多个位置c
我正在用c和xaml开发一个WindowsPhone8应用程序。 我必须使用诺基亚地图SDK绘制多个位置。 我有纬度、经度和标题属性C# 诺基亚在此地图绘制多个位置c,c#,windows-phone-8,here-api,C#,Windows Phone 8,Here Api,我正在用c和xaml开发一个WindowsPhone8应用程序。 我必须使用诺基亚地图SDK绘制多个位置。 我有纬度、经度和标题属性 http://here.com/map=29.1491875,75.7216527,17/title=Fancy%20Stationers http://here.com/map=29.1491875,75.7216527,17/title=Fancy%20Stationers http://here.com/map=28.5415839,77.2550147,1
http://here.com/map=29.1491875,75.7216527,17/title=Fancy%20Stationers
http://here.com/map=29.1491875,75.7216527,17/title=Fancy%20Stationers
http://here.com/map=28.5415839,77.2550147,17/title=Future%20Forward
http://here.com/map=28.651879,77.187967,17/title=Hotline%20Communication
http://here.com/map=28.831140,77.074928,17/title=Jindal%20Agencies
http://here.com/map=28.7,77.14,17/title=Ace%20Communication
http://here.com/map=28.6904,76.9409,17/title=Cell%20Solutions
http://here.com/map=28.54,77.27,17/title=Communication%20Solution
http://here.com/map=29.17,77.21,17/title=Dexter
http://here.com/map=28.65,77.09,17/title=Hotline%20Communications
http://here.com/map=28.47,77.04,17/title=Instant%20Solutions
有办法吗?将所有链接放入一个列表中,然后尝试下面的代码
foreach (var node in ListofLinks)
{
if (loc.Contains("map="))
{
loc = loc.Substring(20);
coordinates = loc.Split(',');
newCoordinate.Coordinates.Longitude = (coordinates != null ? Double.Parse(coordinates[0]) : 0.00);
newCoordinate.Coordinates.Latitude = (coordinates != null ? Double.Parse(coordinates[1]) : 0.00);
}
} CoOrdinates.Add(newCoordinate);
循环遍历所有链接,并将坐标添加到坐标列表中,该列表是地理坐标列表
获得坐标列表后,将其添加到地图中
foreach (var cor in CoOrdinates)
{
MapOverlay myLocOverlay = new MapOverlay();
myLocOverlay.PositionOrigin = new Point(0.5, 0.5);
myLocOverlay.GeoCoordinate = new GeoCoordinate();
myLocOverlay.GeoCoordinate.Latitude = cor.Coordinates.Longitude;
myLocOverlay.GeoCoordinate.Longitude = cor.Coordinates.Latitude;
myLocOverlay.Content = CreateShape(myLocOverlay.GeoCoordinate.Latitude, myLocOverlay.GeoCoordinate.Longitude);
// Create a MapLayer to contain the MapOverlay.
MapLayer myLocLayer = new MapLayer();
myLocLayer.Add(myLocOverlay);
// Add the MapLayer to the Map.
mapWithMyLocation.Layers.Add(myLocLayer);
}
private Polygon CreateShape(double latitude, double longitude)
{
Polygon MyPolygon = new Polygon();
MyPolygon.Points.Add(new Point(4, 0));
MyPolygon.Points.Add(new Point(22, 0));
MyPolygon.Points.Add(new Point(4, 60));
MyPolygon.Stroke = new SolidColorBrush(Colors.Red);
MyPolygon.Fill = new SolidColorBrush(Colors.Green);
MyPolygon.SetValue(Grid.RowProperty, 1);
MyPolygon.SetValue(Grid.ColumnProperty, 0);
MyPolygon.Tag = new GeoCoordinate(latitude, longitude);
MyPolygon.Tap += MyPolygon_Tap;
return MyPolygon;
}