CesiumWidget

external class CesiumWidget(val container: Element, options: CesiumWidget.ConstructorOptions? = definedExternally)(source)

A widget containing a Cesium scene.

// For each example, include a link to CesiumWidget.css stylesheet in HTML head,
// and in the body, include: <div id="cesiumContainer"></div>

// Widget with no terrain and default Bing Maps imagery provider.
const widget = new CesiumWidget("cesiumContainer");

// Widget with ion imagery and Cesium World Terrain.
const widget2 = new CesiumWidget("cesiumContainer", {
baseLayer: ImageryLayer.fromWorldTerrain(),
terrain: Terrain.fromWorldTerrain()
skyBox: new SkyBox({
sources: {
positiveX: "stars/TychoSkymapII.t3_08192x04096_80_px.jpg",
negativeX: "stars/TychoSkymapII.t3_08192x04096_80_mx.jpg",
positiveY: "stars/TychoSkymapII.t3_08192x04096_80_py.jpg",
negativeY: "stars/TychoSkymapII.t3_08192x04096_80_my.jpg",
positiveZ: "stars/TychoSkymapII.t3_08192x04096_80_pz.jpg",
negativeZ: "stars/TychoSkymapII.t3_08192x04096_80_mz.jpg"
}
}),
// Show Columbus View map with Web Mercator projection
sceneMode: SceneMode.COLUMBUS_VIEW,
mapProjection: new WebMercatorProjection()
});

See also

Constructors

Link copied to clipboard
constructor(container: Element, options: CesiumWidget.ConstructorOptions? = definedExternally)

Types

Link copied to clipboard
Link copied to clipboard
interface FlyToOptions

Properties

Link copied to clipboard

Gets or sets whether or not data sources can temporarily pause animation in order to avoid showing an incomplete picture to the user. For example, if asynchronous primitives are being processed in the background, the clock will not advance until the geometry is ready.

Link copied to clipboard

Gets the camera.

Link copied to clipboard

Gets the canvas.

Link copied to clipboard

Gets the clock.

Link copied to clipboard

Gets or sets the data source to track with the widget's clock.

Link copied to clipboard

The DOM element that will contain the widget.

Link copied to clipboard

Gets the credit container.

Link copied to clipboard

Manages the list of credits to display on screen and in the lightbox.

Link copied to clipboard

Gets the credit viewport

Link copied to clipboard

Gets the display used for DataSource visualization.

Link copied to clipboard

Gets the set of DataSource instances to be visualized.

Link copied to clipboard

Gets the default ellipsoid for the scene.

Link copied to clipboard

Gets the collection of entities not tied to a particular data source. This is a shortcut to dataSourceDisplay.defaultDataSource.entities.

Link copied to clipboard

Gets the collection of image layers that will be rendered on the globe.

Link copied to clipboard

Gets or sets a scaling factor for rendering resolution. Values less than 1.0 can improve performance on less powerful devices while values greater than 1.0 will render at a higher resolution and then scale down, resulting in improved visual fidelity. For example, if the widget is laid out at a size of 640x480, setting this value to 0.5 will cause the scene to be rendered at 320x240 and then scaled up while setting it to 2.0 will cause the scene to be rendered at 1280x960 and then scaled down.

Link copied to clipboard

Gets the scene.

Link copied to clipboard

Gets the screen space event handler.

Link copied to clipboard

Gets or sets the target frame rate of the widget when useDefaultRenderLoop is true. If undefined, the browser's requestAnimationFrame implementation determines the frame rate. If defined, this value must be greater than 0. A value higher than the underlying requestAnimationFrame implementation will have no effect.

Link copied to clipboard

The terrain provider providing surface geometry for the globe.

Link copied to clipboard

Gets or sets the Entity instance currently being tracked by the camera.

Link copied to clipboard

Gets the event that is raised when the tracked entity changes.

Link copied to clipboard

Boolean flag indicating if the browser's recommended resolution is used. If true, the browser's device pixel ratio is ignored and 1.0 is used instead, effectively rendering based on CSS pixels instead of device pixels. This can improve performance on less powerful devices that have high pixel density. When false, rendering will be in device pixels. CesiumWidget.resolutionScale will still take effect whether this flag is true or false.

Link copied to clipboard

Gets or sets whether or not this widget should control the render loop. If true the widget will use requestAnimationFrame to perform rendering and resizing of the widget, as well as drive the simulation clock. If set to false, you must manually call the resize, render methods as part of a custom render loop. If an error occurs during rendering, Scene's renderError event will be raised and this property will be set to false. It must be set back to true to continue rendering after the error.

Functions

Link copied to clipboard
fun destroy()

Destroys the widget. Should be called if permanently removing the widget from layout.

Link copied to clipboard
suspend fun flyTo(target: Cesium3DTileset, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: DataSource, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: EntityCollection, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: ImageryLayer, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: TimeDynamicPointCloud, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: Promise<Cesium3DTileset>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: Promise<DataSource>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: Promise<EntityCollection>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: Promise<Entity>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: Promise<ImageryLayer>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: Promise<TimeDynamicPointCloud>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: Promise<VoxelPrimitive>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: Promise<ReadonlyArray<Entity>>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean
suspend fun flyTo(target: ReadonlyArray<Entity>, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean

suspend fun flyTo(target: Entity, options: CesiumWidget.FlyToOptions? = definedExternally): Boolean

Flies the camera to the provided entity, entities, or data source. If the data source is still in the process of loading or the visualization is otherwise still loading, this method waits for the data to be ready before performing the flight.

Link copied to clipboard
fun flyToAsync(target: Cesium3DTileset, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: DataSource, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Entity, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: EntityCollection, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: ImageryLayer, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: TimeDynamicPointCloud, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Promise<Cesium3DTileset>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Promise<DataSource>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Promise<EntityCollection>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Promise<Entity>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Promise<ImageryLayer>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Promise<TimeDynamicPointCloud>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Promise<VoxelPrimitive>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: Promise<ReadonlyArray<Entity>>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
fun flyToAsync(target: ReadonlyArray<Entity>, options: CesiumWidget.FlyToOptions? = definedExternally): Promise<Boolean>
Link copied to clipboard
Link copied to clipboard
fun render()

Renders the scene. This function is called automatically unless useDefaultRenderLoop is set to false;

Link copied to clipboard
fun resize()

Updates the canvas size, camera aspect ratio, and viewport size. This function is called automatically as needed unless useDefaultRenderLoop is set to false.

Link copied to clipboard
fun showErrorPanel(title: String, message: String? = definedExternally, error: String? = definedExternally)

Show an error panel to the user containing a title and a longer error message, which can be dismissed using an OK button. This panel is displayed automatically when a render loop error occurs, if showRenderLoopErrors was not false when the widget was constructed.

Link copied to clipboard
suspend fun zoomTo(target: Cesium3DTileset, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: DataSource, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: EntityCollection, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: ImageryLayer, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: TimeDynamicPointCloud, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: Promise<Cesium3DTileset>, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: Promise<DataSource>, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: Promise<EntityCollection>, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: Promise<Entity>, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: Promise<ImageryLayer>, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: Promise<TimeDynamicPointCloud>, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: Promise<VoxelPrimitive>, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: Promise<ReadonlyArray<Entity>>, offset: HeadingPitchRange? = definedExternally): Boolean
suspend fun zoomTo(target: ReadonlyArray<Entity>, offset: HeadingPitchRange? = definedExternally): Boolean

suspend fun zoomTo(target: Entity, offset: HeadingPitchRange? = definedExternally): Boolean

Asynchronously sets the camera to view the provided entity, entities, or data source. If the data source is still in the process of loading or the visualization is otherwise still loading, this method waits for the data to be ready before performing the zoom.

Link copied to clipboard
fun zoomToAsync(target: Cesium3DTileset, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: DataSource, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Entity, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: EntityCollection, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: ImageryLayer, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: TimeDynamicPointCloud, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Promise<Cesium3DTileset>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Promise<DataSource>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Promise<EntityCollection>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Promise<Entity>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Promise<ImageryLayer>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Promise<TimeDynamicPointCloud>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Promise<VoxelPrimitive>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: Promise<ReadonlyArray<Entity>>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>
fun zoomToAsync(target: ReadonlyArray<Entity>, offset: HeadingPitchRange? = definedExternally): Promise<Boolean>