new CesiumViewerWidget
This Dojo widget wraps the full functionality of Cesium Viewer.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object | A list of options to pre-configure the widget. Names matching member fields/functions will override the default values. |
Members
-
animation :Animation
-
The animation widget.
-
autoStartRenderLoop :Boolean
-
If true, CesiumViewerWidget#startRenderLoop will be called automatically at the end of CesiumViewerWidget#startup.
- Default Value:
- true
-
baseLayerPicker :BaseLayerPicker
-
The BaseLayerPicker widget.
-
enableDragDrop :Boolean
-
Allow the user to drag-and-drop CZML files into this widget. This is read-only after construction.
- Default Value:
- false
-
enableWebGLDebugging :Boolean
-
Check for WebGL errors after every WebGL API call. Enabling this debugging feature comes at a substantial performance cost, halting and restarting the graphics pipeline hundreds of times per frame. But it can uncover problems that are otherwise very difficult to diagnose. This property is read-only after construction.
- Default Value:
- false
-
endUserOptions :Object
-
An object containing settings supplied by the end user, typically from the query string of the URL of the page with the widget.
Examples
var ioQuery = require('dojo/io-query'); var endUserOptions = {}; if (window.location.search) { endUserOptions = ioQuery.queryToObject(window.location.search.substring(1)); }var endUserOptions = { 'source' : 'file.czml', // The relative URL of the CZML file to load at startup. 'lookAt' : '123abc', // The CZML ID of the object to track at startup. 'theme' : 'lighter', // Use the dark-text-on-light-background theme. 'loop' : 0, // Disable looping at end time, pause there instead. 'stats' : 1, // Enable the FPS performance display. 'debug' : 1, // Full WebGL error reporting at substantial performance cost. }; -
fullscreen :FullscreenWidget
-
The fullscreen widget, configured to put only the viewer widget into fullscreen mode by default.
-
resizeWidgetOnWindowResize :Boolean
-
Register this widget's resize handler to get called every time the browser window resize event fires. This is read-only after construction. Generally this should be true for full-screen widgets, and true for fluid layouts where the widget is likely to change size at the same time as the window. The exception is, if you use a Dojo layout where this widget exists inside a Dojo ContentPane or similar, you should set this to false, because Dojo will perform its own layout calculations and call this widget's resize handler automatically. This can also be false for a fixed-size widget. If unsure, test the widget with this set to false, and if window resizes cause the globe to stretch, change this to true.
- Default Value:
- true
See:
-
sceneModePicker :SceneModePicker
-
The SceneModePicker widget.
-
showSkyBox :Boolean
-
Determines if a sky box with stars is drawn around the globe. This is read-only after construction.
- Default Value:
- true
See:
-
skyBoxBaseUrl :String
-
The base URL for the sky box.
-
timeline :Timeline
-
The timeline widget.
Methods
-
addCzml
-
Add CZML data to the viewer.
Parameters:
Name Type Description czmlCZML The CZML (as objects) to be processed and added to the viewer. sourcestring The filename or URI that was the source of the CZML collection. lookAtstring Optional. The ID of the object to center the camera on. -
centerCameraOnObject
-
Have the camera track a particular object.
Parameters:
Name Type Description selectedObjectObject The object to track, or undefinedto stop tracking. -
centerCameraOnPick
-
Have the camera track a particular object based on the result of a pick.
Parameters:
Name Type Description selectedObjectObject The object to track, or undefinedto stop tracking. -
enableStatistics
-
Enable or disable the FPS (Frames Per Second) perfomance display.
Parameters:
Name Type Description showStatisticsBoolean trueto enable it. -
handleDrop
-
This function is called when files are dropped on the widget, if drag-and-drop is enabled.
Parameters:
Name Type Description eventObject The drag-and-drop event containing the dropped file(s). -
highlightObject
-
Highlight an object in the scene, usually in response to a click or hover.
Parameters:
Name Type Description selectedObjectObject The object to highlight, or undefinedto un-highlight. -
initializeFrame
-
Initialize the current frame.
-
loadCzml
-
Asynchronously load and add CZML data to the viewer.
Parameters:
Name Type Description sourcestring The URI to load the CZML from. lookAtstring Optional. The ID of the object to center the camera on. -
onLeftDrag
-
Override this function to be notified when the left mouse button is dragged.
Parameters:
Name Type Description TheObject object with the start and end position of the mouse. -
onLeftMouseDown
-
Override this function to be notified when the left mouse button is pressed down.
Parameters:
Name Type Description TheObject object with the position of the mouse. -
onLeftMouseUp
-
Override this function to be notified when the left mouse button is released.
Parameters:
Name Type Description TheObject object with the position of the mouse. -
onObjectLeftDoubleClickSelected
-
Override this function to be notified when an object is left-double-clicked.
Parameters:
Name Type Description selectedObjectObject The object that was selected, or undefinedto de-select. -
onObjectMousedOver
-
Override this function to be notified when an object hovered by the mouse.
Parameters:
Name Type Description selectedObjectObject The object that was hovered, or undefinedif the mouse moved off. -
onObjectRightClickSelected
-
Override this function to be notified when an object is right-clicked.
Parameters:
Name Type Description selectedObjectObject The object that was selected, or undefinedto de-select. -
onObjectSelected
-
Override this function to be notified when an object is selected (left-click).
Parameters:
Name Type Description selectedObjectObject The object that was selected, or undefinedto de-select. -
onRightMouseDown
-
Override this function to be notified when the right mouse button is pressed down.
Parameters:
Name Type Description TheObject object with the position of the mouse. -
onRightMouseUp
-
Override this function to be notified when the right mouse button is released.
Parameters:
Name Type Description TheObject object with the position of the mouse. -
onSetupError
-
This function will get a callback in the event of setup failure, likely indicating a problem with WebGL support or the availability of a GL context.
Parameters:
Name Type Description widgetObject A reference to this widget errorObject The exception that was thrown during setup -
onZoom
-
Override this function to be notified when the right mouse button is dragged or mouse wheel is zoomed.
Parameters:
Name Type Description TheObject object with the start and end position of the mouse. -
removeAllCzml
-
Removes all CZML data from the viewer.
-
render
-
Render the widget's scene.
Parameters:
Name Type Description currentTimeJulianDate The date and time in the scene of the frame to be rendered -
resize
-
This function must be called when the widget changes size. It updates the canvas size, camera aspect ratio, and viewport size.
-
setLogoOffset
-
Set the positional offset of the logo of the streaming imagery provider.
Parameters:
Name Type Description logoOffsetXInteger The horizontal offset in screen space logoOffsetYInteger The vertical offset in screen space -
setTimeFromBuffer
-
Apply the animation settings from a CZML buffer.
-
showSkyAtmosphere
-
Enable or disable the "sky atmosphere" effect, which displays the limb of the Earth (seen from space) or blue sky (seen from inside the atmosphere).
Parameters:
Name Type Description showBoolean trueto enable the effect. -
startRenderLoop
-
This is a simple render loop that can be started if there is only one
CesiumViewerWidgeton your page. If you wish to customize your render loop, avoid this function and instead use code similar to the following example.Example
// This takes the place of startRenderLoop for a single widget. var widget = this; function updateAndRender() { widget.updateAndRender(); requestAnimationFrame(updateAndRender); } requestAnimationFrame(updateAndRender); -
startup
-
Call this after placing the widget in the DOM, to initialize the WebGL context, wire up event callbacks, begin requesting CZML, imagery, etc.
-
update
-
Call this function prior to rendering each animation frame, to prepare all CZML objects and other settings for the next frame.
Parameters:
Name Type Description currentTimeJulianDate The date and time in the scene of the frame to be rendered -
updateAndRender
-
Updates and renders the scene to reflect the current time.
-
viewHome
-
Reset the camera to the home view for the current scene mode.
