based on the example in Sandcastle. for example, i want to show a point entity after geocoder and flyto? Thanks.
Whether you are using a custom geocoder or not, there is a complete event you can subscribe to. Here’s a simple example that does exactly what you want:
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var lastGeocode = viewer.entities.add({
point: {
pixelSize: 20,
heightReference : Cesium.HeightReference.CLAMP_TO_GROUND
}
});
var removeListener = viewer.geocoder.viewModel.complete.addEventListener(function(){
lastGeocode.position = viewer.scene.camera.positionWC;
});
can i change point to polygon geometry? i want to highlight feature
Do you simply mean, do a flyTo, then add a polygon? FlyTo has the ‘complete’ callback function, so just add it after (with a timeout to remove, or some other cleanup);
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0),
complete: function () {
// add your highlight here at the end of the journey
var highlight = viewer.entities.add({...});
setTimeout ( () => { viewer.entities.remove(highlight); }, 4000 );
}
});
Add a fancy opacity fader (quick in, slow out) for dramatic effect.
Cheers,
Alex