Bing 地图 polygon/polyline 出现在图像叠加层下方
Bing maps polygon/polyline appears beneath image overlay
我一直在关注 post 关于为 bing 地图使用图像叠加层的内容:
http://blogs.msdn.com/b/bingdevcenter/archive/2014/04/04/image-overlays-with-bing-maps-native.aspx
我现在想要的是能够在此图像之上添加 polygons/polylines。例如,我们使用以下代码:
(From here: http://blogs.bing.com/maps/2014/01/23/make-clickable-shapes-in-the-native-bing-maps-control/)
private void MyMapLoaded(object sender, RoutedEventArgs e)
{
//Add a shape layer to the map
shapeLayer = new MapShapeLayer();
MyMap.ShapeLayers.Add(shapeLayer);
//Create mock data points
var locs = new LocationCollection();
locs.Add(new Location(coordinates that are over the image));
locs.Add(new Location(coordinates that are over the image));
locs.Add(new Location(coordinates that are over the image));
//Create test polygon
var polygon = new MapPolygon();
polygon.Locations = locs;
polygon.FillColor = Colors.Red;
shapeLayer.Shapes.Add(polygon);
var locs2 = new LocationCollection();
locs2.Add(new Location(20, 20));
locs2.Add(new Location(40, 40));
locs2.Add(new Location(50, 20));
//Create test polyline
var polyline = new MapPolyline();
polyline.Locations = locs2;
polyline.Width = 5;
polyline.Color = Colors.Blue;
//Add the shape to the map
shapeLayer.Shapes.Add(polyline);
}
问题是 polygon/polyline 总是出现在图像下方。
ShapeLayer 有一个 属性 用于 z-index 但它没有帮助。有没有办法让我的多边形始终在顶部?
不确定为什么要这样做,但是您将无法在作为地图子项添加的用户控件上方显示 MapPolygon。也就是说,您可以创建 WPF 多边形并添加它们。您可以做的是创建一个自定义用户控件,将图像叠加功能与以下内容结合起来:http://blogs.msdn.com/b/bingdevcenter/archive/2014/03/25/custom-shapes-in-windows-store-apps-c.aspx
我一直在关注 post 关于为 bing 地图使用图像叠加层的内容:
http://blogs.msdn.com/b/bingdevcenter/archive/2014/04/04/image-overlays-with-bing-maps-native.aspx
我现在想要的是能够在此图像之上添加 polygons/polylines。例如,我们使用以下代码:
(From here: http://blogs.bing.com/maps/2014/01/23/make-clickable-shapes-in-the-native-bing-maps-control/)
private void MyMapLoaded(object sender, RoutedEventArgs e)
{
//Add a shape layer to the map
shapeLayer = new MapShapeLayer();
MyMap.ShapeLayers.Add(shapeLayer);
//Create mock data points
var locs = new LocationCollection();
locs.Add(new Location(coordinates that are over the image));
locs.Add(new Location(coordinates that are over the image));
locs.Add(new Location(coordinates that are over the image));
//Create test polygon
var polygon = new MapPolygon();
polygon.Locations = locs;
polygon.FillColor = Colors.Red;
shapeLayer.Shapes.Add(polygon);
var locs2 = new LocationCollection();
locs2.Add(new Location(20, 20));
locs2.Add(new Location(40, 40));
locs2.Add(new Location(50, 20));
//Create test polyline
var polyline = new MapPolyline();
polyline.Locations = locs2;
polyline.Width = 5;
polyline.Color = Colors.Blue;
//Add the shape to the map
shapeLayer.Shapes.Add(polyline);
}
问题是 polygon/polyline 总是出现在图像下方。 ShapeLayer 有一个 属性 用于 z-index 但它没有帮助。有没有办法让我的多边形始终在顶部?
不确定为什么要这样做,但是您将无法在作为地图子项添加的用户控件上方显示 MapPolygon。也就是说,您可以创建 WPF 多边形并添加它们。您可以做的是创建一个自定义用户控件,将图像叠加功能与以下内容结合起来:http://blogs.msdn.com/b/bingdevcenter/archive/2014/03/25/custom-shapes-in-windows-store-apps-c.aspx