Hi!
I’m having a problem when I’m drawing polygons and polylines. I can’t draw polylines over polygons:
My code:
*function PolygonCesium(positions, color){
var polygon = new Cesium.Polygon();
polygon.material.uniforms.color = color;
polygon.positions = positions;
primitives.add(polygon);
}
function PolylineCesium(positions, color){
var polylines = new Cesium.PolylineCollection();
primitives.add(polylines);
var polyline = polylines.add({
positions : positions,
material : Cesium.Material.fromType(‘Color’)
});
polyline.material.uniforms.color = color;
} *
function geoToCart(x, y) {
return ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(x, y, 0));
}
PolygonCesium([geoToCart(-94, 1.5), geoToCart(-93, 1.5), geoToCart(-94, 2.5)], new Cesium.Color(1,0,0,1)); // RED POLYGON
PolylineCesium([geoToCart(-95, 1), geoToCart(-92.5, 3)], new Cesium.Color(1,1,0,1)); // YELLOW POLYLINE
PolygonCesium([geoToCart(-94.5, 1.5), geoToCart(-93, 3.5), geoToCart(-93, 2.5)], new Cesium.Color(0,0,1,1)); // BLUE POLYGON
PolylineCesium([geoToCart(-93.5, 1), geoToCart(-93.5, 3)], new Cesium.Color(0,1,0,1)); // GREEN POLYLINE
In the primitives array the order is ok:
Using raise and lower functions of ComposePrimitive doesn’t work.
Can someone help me?
Thanks
[
](https://lh6.googleusercontent.com/-YkgB67pcWjM/U3s4RFfKZqI/AAAAAAAAAF0/z-ePM0QaLl8/s1600/array.png)