- {Element|String} container The DOM element or ID that will contain the widget.
- The options object takes the following properties
- {Clock} [options.clock=new Clock()] The clock to use to control current time.
- {ImageryProvider} [options.imageryProvider=new BingMapsImageryProvider()] The imagery provider to serve as the base layer. If set to false, no imagery provider will be added.
- {TerrainProvider} [options.terrainProvider=new EllipsoidTerrainProvider] The terrain provider.
- {SkyBox} [options.skyBox] The skybox used to render the stars. When undefined, the default stars are used. If set to false, no skyBox, Sun, or Moon will be added.
- {SkyAtmosphere} [options.skyAtmosphere] Blue sky, and the glow around the Earth's limb. Set to false to turn it off.
- {SceneMode} [options.sceneMode=SceneMode.SCENE3D] The initial scene mode.
- {Boolean} [options.scene3DOnly=false] When true, each geometry instance will only be rendered in 3D to save GPU memory.
- {Boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency.
- {MapProjection} [options.mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes.
- {Globe} [options.globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set to false, no globe will be added.
- {Boolean} [options.useDefaultRenderLoop=true] True if this widget should control the render loop, false otherwise.
- {Number} [options.targetFrameRate] The target frame rate when using the default render loop.
- {Boolean} [options.showRenderLoopErrors=true] If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs.
- {Object} [options.contextOptions] Context and WebGL creation properties corresponding to options passed to Scene
- {Element|String} [options.creditContainer] The DOM element or ID that will contain the CreditDisplay If not specified, the credits are added
to the bottom of the widget itself.
- {Number} [options.terrainExaggeration=1.0] A scalar used to exaggerate the terrain. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.
exception {DeveloperError} Element with id "container" does not exist in the document.
// For each example, include a link to CesiumWidget.css stylesheet in HTML head,
// and in the body, include:
//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 : Cesium.createOpenStreetMapImageryProvider(),
terrainProvider : new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/world'
}),
// 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'
}
}),
// Show Columbus View map with Web Mercator projection
sceneMode : Cesium.SceneMode.COLUMBUS_VIEW,
mapProjection : new Cesium.WebMercatorProjection()
});
A widget containing a Cesium scene.
alias CesiumWidget
- {Element|String} container The DOM element or ID that will contain the widget. - The options object takes the following properties - {Clock} [options.clock=new Clock()] The clock to use to control current time. - {ImageryProvider} [options.imageryProvider=new BingMapsImageryProvider()] The imagery provider to serve as the base layer. If set to
false
, no imagery provider will be added. - {TerrainProvider} [options.terrainProvider=new EllipsoidTerrainProvider] The terrain provider. - {SkyBox} [options.skyBox] The skybox used to render the stars. Whenundefined
, the default stars are used. If set tofalse
, no skyBox, Sun, or Moon will be added. - {SkyAtmosphere} [options.skyAtmosphere] Blue sky, and the glow around the Earth's limb. Set tofalse
to turn it off. - {SceneMode} [options.sceneMode=SceneMode.SCENE3D] The initial scene mode. - {Boolean} [options.scene3DOnly=false] Whentrue
, each geometry instance will only be rendered in 3D to save GPU memory. - {Boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency. - {MapProjection} [options.mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes. - {Globe} [options.globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set tofalse
, no globe will be added. - {Boolean} [options.useDefaultRenderLoop=true] True if this widget should control the render loop, false otherwise. - {Number} [options.targetFrameRate] The target frame rate when using the default render loop. - {Boolean} [options.showRenderLoopErrors=true] If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs. - {Object} [options.contextOptions] Context and WebGL creation properties corresponding tooptions
passed to Scene - {Element|String} [options.creditContainer] The DOM element or ID that will contain the CreditDisplay If not specified, the credits are added to the bottom of the widget itself. - {Number} [options.terrainExaggeration=1.0] A scalar used to exaggerate the terrain. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.exception {DeveloperError} Element with id "container" does not exist in the document.
demo Sandcastle Cesium Widget Demo
// For each example, include a link to CesiumWidget.css stylesheet in HTML head, // and in the body, include: //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 : Cesium.createOpenStreetMapImageryProvider(), terrainProvider : new Cesium.CesiumTerrainProvider({ url : 'https://assets.agi.com/stk-terrain/world' }), // 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' } }), // Show Columbus View map with Web Mercator projection sceneMode : Cesium.SceneMode.COLUMBUS_VIEW, mapProjection : new Cesium.WebMercatorProjection() });