var viewer = new Cesium.Viewer('cesiumContainer', { selectionIndicator : false, infoBox : false }); var scene = viewer.scene; var entity = viewer.entities.add({ polygon : { hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -115.0, 32.0, -107.0, 33.0, -102.0, 31.0, -102.0, 35.0]), material : Cesium.Color.RED } }); var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); handler.setInputAction(function(click) { var pickedObject = scene.pick(click.position); if (Cesium.defined(pickedObject) && (pickedObject.id === entity)) { var positions = entity.polygon.hierarchy.getValue(viewer.clock.currentTime); positions[0] = Cesium.Cartesian3.fromDegrees(-110.0, 37.0); entity.polygon.hierarchy = positions; } }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
Cesium – How to changes the polygon positions on left click ?
Leave a reply