CesiumWidget

CesiumWidget

new

A widget containing a Cesium scene.

Parameters:
Name Type Argument Description
container Element | String The DOM element or ID that will contain the widget.
options Object <optional>
Configuration options for the widget.
Properties
Name Type Argument Default Description
clock Clock <optional>
new Clock() The clock to use to control current time.
imageryProvider ImageryProvider <optional>
new BingMapsImageryProvider() The imagery provider to serve as the base layer. If set to false, no imagery provider will be added.
terrainProvider TerrainProvider <optional>
new EllipsoidTerrainProvider The terrain provider.
skyBox SkyBox <optional>
The skybox used to render the stars. When undefined, the default stars are used.
sceneMode SceneMode <optional>
SceneMode.SCENE3D The initial scene mode.
useDefaultRenderLoop Boolean <optional>
true True if this widget should control the render loop, false otherwise.
showRenderLoopErrors Boolean <optional>
true If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs.
contextOptions Object <optional>
undefined Context and WebGL creation properties corresponding to Context#options.
Throws:
Example
// 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.
var widget = new Cesium.CesiumWidget('cesiumContainer');

//Widget with OpenStreetMaps imagery provider and Cesium terrain provider hosted by AGI.
var widget = new Cesium.CesiumWidget('cesiumContainer', {
    imageryProvider : new Cesium.OpenStreetMapImageryProvider(),
    terrainProvider : new Cesium.CesiumTerrainProvider({
        url : 'http://cesiumjs.org/smallterrain',
        credit : 'Terrain data courtesy Analytical Graphics, Inc.'
    }),
    // Use high-res stars downloaded from https://github.com/AnalyticalGraphicsInc/cesium-assets
    skyBox : new Cesium.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'
        }
    })
});
Source:

Members

:Canvas

Gets the canvas.

:CentralBody

Gets the primary central body.

:Clock

Gets the clock.

:Element

Gets the parent container.

:Element

Gets the credit container.

:Scene

Gets the scene.

:SceneTransitioner

Gets the scene transitioner.

:ScreenSpaceEventHandler

Gets the screen space event handler.

:Boolean

Gets or sets whether or not this widget should control the render loop. If set to 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.

Methods

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

Returns:
Boolean true if the object has been destroyed, false otherwise.

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

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

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.

Parameters:
Name Type Description
title String The title to be displayed on the error panel.
error String The error to be displayed on the error panel. Optional.