new Cesium.Viewer(container, options)
Widgets/Viewer/Viewer.js 325
A base widget for building applications. It composites all of the standard Cesium widgets into one reusable package. The widget can always be extended by using mixins, which add functionality useful for a variety of applications.
一个建造应用的基础控件。
它合成了全部的标准Cesium控件到一个可以重复使用的包。
这个控件常常可以通过使用mixins(混合)进行扩展。大概是混合标准控件的意思
它通常为各种应用添加有用的功能。
Name | Type | Description |
---|---|---|
container | Element,String | The DOM element or ID that will contain the widget. |
options | Viewer.ConstructorOptions | optional Object describing initialization options. |
DeveloperError : Element with id “container” does not exist in the document.
DeveloperError : options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget, specify options.imageryProvider instead.
DeveloperError : options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget, specify options.terrainProvider instead.
//Initialize the viewer widget with several custom options and mixins.
var viewer = new Cesium.Viewer('cesiumContainer', {
//Start in Columbus Viewer
sceneMode : Cesium.SceneMode.COLUMBUS_VIEW,
//Use Cesium World Terrain
terrainProvider : Cesium.createWorldTerrain(),
//Hide the base layer picker
baseLayerPicker : false,
//Use OpenStreetMaps
imageryProvider : new Cesium.OpenStreetMapImageryProvider({
url : 'https://a.tile.openstreetmap.org/'
}),
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
mapProjection : new Cesium.WebMercatorProjection()
});
//Add basic drag and drop functionality
viewer.extend(Cesium.viewerDragDropMixin);
//Show a pop-up alert if we encounter an error when processing a dropped file
viewer.dropError.addEventListener(function(dropHandler, name, error) {
console.log(error);
window.alert(error);
});
Cesium Sandcastle Hello World Demo
Animation
BaseLayerPicker
CesiumWidget
FullscreenButton
HomeButton
SceneModePicker
Timeline
viewerDragDropMixin
readonly camera : Camera
Widgets/Viewer/Viewer.js 1171
Gets the camera.
readonly clock : Clock
Widgets/Viewer/Viewer.js 1196
Gets the clock.
readonly entities : EntityCollection
Widgets/Viewer/Viewer.js 1054
Gets the collection of entities not tied to a particular data source. This is a shortcut to dataSourceDisplay.defaultDataSource.entities.
new Cesium.EntityCollection(owner)
DataSources/EntityCollection.js 5
An observable collection of Entity instances where each entity has a unique id.
DataSources/EntityCollection.js 271
Add an entity to the collection.
Name | Type | Description |
---|---|---|
entity | Entity or Entity.ConstructorOptions | The entity to be added. |
DataSources/EntityCollection.js 311
Removes an entity from the collection.
Name | Type | Description |
---|---|---|
entity | Entity | The entity to be removed. |
Returns:
true if the item was removed, false if it did not exist in the collection.
DataSources/EntityCollection.js 367
Removes all Entities from the collection.
The entity that was added.
DeveloperError : An entity with already exists in this collection.
trackedEntity : Entity|undefined
Widgets/Viewer/Viewer.js 1333
Gets or sets the Entity instance currently being tracked by the camera.