new CesiumWidget
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
|
Throws:
-
DeveloperError : container is required.
-
DeveloperError : Element with id "container" does not exist in the document.
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://cesium.agi.com/smallterrain', credit : 'Terrain data courtesy Analytical Graphics, Inc.' }) });
Members
-
canvas :Canvas
-
Gets the canvas.
-
centralBody :CentralBody
-
Gets the primary central body.
-
clock :Clock
-
Gets the clock.
-
container :Element
-
Gets the parent container.
-
creditContainer :Element
-
Gets the credit container.
-
scene :Scene
-
Gets the scene.
-
sceneTransitioner :SceneTransitioner
-
Gets the scene transitioner.
-
screenSpaceEventHandler :ScreenSpaceEventHandler
-
Gets the screen space event handler.
-
useDefaultRenderLoop :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
-
destroy
-
Destroys the widget. Should be called if permanently removing the widget from layout.
-
isDestroyed
-
Returns:
Boolean true if the object has been destroyed, false otherwise. -
render
-
Renders the scene. This function is called automatically unless
useDefaultRenderLoop
is set to false; -
resize
-
Updates the canvas size, camera aspect ratio, and viewport size. This function is called automatically as needed unless
useDefaultRenderLoop
is set to false.