viewerEntityMixin(viewer)
A mixin which adds behavior to the Viewer widget for dealing with Entity instances.
This allows for entities to be tracked with the camera, either by the viewer clicking
on them, or by setting the trackedEntity property.
Rather than being called directly, this function is normally passed as
a parameter to
Viewer#extend
, as shown in the example below.
Name | Type | Description |
---|---|---|
viewer |
Viewer | The viewer instance. |
Throws:
-
DeveloperError : trackedEntity is already defined by another mixin.
-
DeveloperError : selectedEntity is already defined by another mixin.
Example:
// Add support for working with Entity instances to the Viewer.
var entity = ... //A Cesium.Entity instance
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.extend(Cesium.viewerEntityMixin);
viewer.trackedEntity = entity; //Camera will now track entity
viewer.selectedEntity = entity; //Selection will now appear over object