Wall entity callback syncronise problem.

I built an Entity editor using callbacks for the various properties being dynamically manipulated via mouse movements.

I have one shape the draws a curved wall, so when they adjust the start/end angle, the number of positions for the wall entity changes.

The wall properties positions, maximumHeights, miniumHeights all need to have the same number of entries in the array.

I have callbacks associated with each one of these properties.

Things work well when using minified, however, unminified I gives the following error, .

DeveloperError: options.positions and options.maximumHeights must have the same length

I would think it’s impossible to get three arrays to stay insync via callbacks. They are not in sync until all three callbacks have been called.

I am struggling to think of a way to overcome this problem.

Eric

Hello Eric,

Instead of using a CallbackProperty for each array, I think you’ll have to initialize a new WallGraphics each time you want the wall to change. Here is an example:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var entity = viewer.entities.add({
wall : {
positions : Cesium.Cartesian3.fromDegreesArrayHeights([-115.0, 44.0, 200000.0,
-90.0, 44.0, 200000.0]),
minimumHeights : [100000.0, 100000.0],
material : Cesium.Color.RED
}
});

viewer.zoomTo(entity);

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function(click) {
entity.wall = new Cesium.WallGraphics({
positions : Cesium.Cartesian3.fromDegreesArray([-115.0, 50.0,
-112.5, 50.0,
-110.0, 50.0,
-107.5, 50.0,
-105.0, 50.0,
-102.5, 50.0,
-100.0, 50.0,
-97.5, 50.0,
-95.0, 50.0,
-92.5, 50.0,
-90.0, 50.0]),
maximumHeights : [100000, 200000, 100000, 200000, 100000, 200000, 100000, 200000, 100000, 200000, 100000],
minimumHeights : [0, 100000, 0, 100000, 0, 100000, 0, 100000, 0, 100000, 0],
material : Cesium.Color.BLUE.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
});
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

``

I’m not sure if this is the best solution, so if someone has a better idea, please chime in =)

-Hannah