多边形和折线分层 [英] Polygon and Polyline layering
问题描述
我试图在bing地图上绘制一些路径(Microsoft.Maps.Polyline)和分区(Microsoft.Maps.Polygon)。
基本上我的问题是多边形始终位于折线的顶部,因此在多个区域重叠的区域中,我无法再看到我的路径。
多边形示例
Microsoft.Maps.loadModule(" Microsoft.Maps .SpatialMath",function(){
polygons [0] = new Microsoft.Maps.Polygon(Microsoft.Maps.SpatialMath.getRegularPolygon({latitude:-33.9949890,经度:18.5989740},150,30,Microsoft.Maps .SpatialMath.KM),{fillColor:'rgba(156,2,156,1)',strokeColor:'rgba(63,76,107,0.7)',strokeThickness:2,zIndex:1});
polygons [1 ] = new Microsoft.Maps.Polygon(Microsoft.Maps.SpatialMath.getRegularPolygon({latitude:-33.9900460,经度:18.5773360},150,30,Microsoft.Maps.SpatialMath.KM),{fillColor:'rgba(156,2,156) ,1)',strokeColor:'rgba(63,76,107,0.7)',strokeThickness:2,zIndex:1});
map.entities.push(polygons);
});
$
I能够用用户层来解决这个问题。
https://msdn.microsoft.com/en-us/library/mt712656.asp
这对于多边形的多边形而言现在很快乐。
var polygons = new Array() ;
var layerpolygons = new Microsoft.Maps.Layer();
Microsoft.Maps.loadModule(" Microsoft.Maps.SpatialMath",function(){
polygons [0] = new Microsoft.Maps.Polygon(Microsoft.Maps.SpatialMath.getRegularPolygon({latitude: -33.9949890,经度:18.5989740},150,30,Microsoft.Maps.SpatialMath.KM),{fillColor:'rgba(156,2,156,1)',strokeColor:'rgba(63,76,107,0.7)',strokeThickness: 2,zIndex:1});
多边形[1] =新的Microsoft.Maps.Polygon(Microsoft.Maps.SpatialMath.getRegularPolygon({纬度:-33.9900460,经度:18.5773360},150,30,Microsoft.Maps .SpatialMath.KM),{fillColor:'rgba(156,2,156,1)',strokeColor:'rgba(63,76,107,0.7)',strokeThickness:2,zIndex:1});
layerpolygons.add (多边形);
});
map.layers.insert(layerpolygons);
zindex现在可以设置为
layerpolygons.setZIndex(10000)
和
layerpolylines.setZIndex(10001)
$
I am trying to draw some paths(Microsoft.Maps.Polyline) and zoning (Microsoft.Maps.Polygon) on the bing map.
Basically my issue is that the Polygon is always on top of the polyline so in areas where a multiple zones overlap i can no longer see my path.
example of polygons
Microsoft.Maps.loadModule("Microsoft.Maps.SpatialMath", function () { polygons[0] = new Microsoft.Maps.Polygon( Microsoft.Maps.SpatialMath.getRegularPolygon({latitude:-33.9949890,longitude:18.5989740}, 150, 30, Microsoft.Maps.SpatialMath.KM), {fillColor: 'rgba(156,2,156,1)', strokeColor: 'rgba(63,76,107,0.7)', strokeThickness: 2, zIndex:1}); polygons[1] = new Microsoft.Maps.Polygon( Microsoft.Maps.SpatialMath.getRegularPolygon({latitude:-33.9900460,longitude:18.5773360}, 150, 30, Microsoft.Maps.SpatialMath.KM), {fillColor: 'rgba(156,2,156,1)', strokeColor: 'rgba(63,76,107,0.7)', strokeThickness: 2, zIndex:1}); map.entities.push(polygons); });
I was able to solve this with user layers
https://msdn.microsoft.com/en-us/library/mt712656.asp
did this to polygons an poly lines and now have joy.
var polygons = new Array(); var layerpolygons = new Microsoft.Maps.Layer(); Microsoft.Maps.loadModule("Microsoft.Maps.SpatialMath", function () { polygons[0] = new Microsoft.Maps.Polygon( Microsoft.Maps.SpatialMath.getRegularPolygon({latitude:-33.9949890,longitude:18.5989740}, 150, 30, Microsoft.Maps.SpatialMath.KM), {fillColor: 'rgba(156,2,156,1)', strokeColor: 'rgba(63,76,107,0.7)', strokeThickness: 2, zIndex:1}); polygons[1] = new Microsoft.Maps.Polygon( Microsoft.Maps.SpatialMath.getRegularPolygon({latitude:-33.9900460,longitude:18.5773360}, 150, 30, Microsoft.Maps.SpatialMath.KM), {fillColor: 'rgba(156,2,156,1)', strokeColor: 'rgba(63,76,107,0.7)', strokeThickness: 2, zIndex:1}); layerpolygons.add(polygons); }); map.layers.insert(layerpolygons);zindex can now be set with
layerpolygons.setZIndex(10000)
and
layerpolylines.setZIndex(10001)
这篇关于多边形和折线分层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!