var ellipseEntity = entities.add({
position: Cesium.Cartesian3.fromDegrees(coordArray[0], coordArray[1]),
ellipse: {
semiMinorAxis: radius,
semiMajorAxis: radius,
height: 0,
extrudedHeight: 10,
material: Cesium.Color.BLACK.withAlpha(1.0)
}
});
It works fine, and I can see a cylinder on the globe.
If I want to change the position of the cylinder after it's created, I can do this:
ellipseEntity.position = Cesium.Cartesian3.fromDegrees(newLon, newLat);
And the cylinder is repositioned as expected.
However, I'd like to do the same kind of thing with polygon vertices. I've tried this:
var flatPointArray = [ <new vertices> ];
entities.suspendEvents();
var positions = polygon._polygon._hierarchy;
positions.setValue(Cesium.Cartesian3.fromDegreesArray(flatPointArray));
polygon._show = true;
entities.resumeEvents();
polygon.polygon.material = Cesium.Color.YELLOW.withAlpha(1.0);
The original polygon appears just fine, but when I try to set the new vertices, it disappears from the scene.
I know that 'polygon' is valid and refers to the right entity because if I try to change *just* the material (and comment out the vertex update code), it reflects the color change.
But I can't seem to change the vertices.
Any ideas?
Thanks.
myEntity.polygon.hierarchy.positions = Cesium.Cartesian3.fromDegreesArray(flatPointArray);
polygon.hierarchy = new ConstantProperty(new PolygonHierarchy(coordinatesArrayToCartesianArray(positions, crsFunction), holes));That did the trick!
This works:
polygon.hierarchy = new Cesium.ConstantProperty(new Cesium.PolygonHierarchy(
Cesium.Cartesian3.fromDegreesArray(flatPointArray)));
Thanks so much for your quick reply!
Mike