Cesium 需要创建viewer,构建基础的场景信息。创建viewer的过程,包含很多参数,可以调节viewer的样式,或者展现出来的功能。今天具体探索一下这些参数的含义。
首先看一下,创建viewer的时候有哪些可选的参数。
Name | Type | Description | |||
container | Element | String | The DOM element or ID that will contain the widget. | |||
options | Object | optional Object with the following properties: | |||
Name | Type | Default | Description | ||
animation | Boolean | TRUE | optional If set to false, the Animation widget will not be created. | ||
baseLayerPicker | Boolean | TRUE | optional If set to false, the BaseLayerPicker widget will not be created. | ||
fullscreenButton | Boolean | TRUE | optional If set to false, the FullscreenButton widget will not be created. | ||
vrButton | Boolean | FALSE | optional If set to true, the VRButton widget will be created. | ||
geocoder | Boolean | Array. |
TRUE | optional If set to false, the Geocoder widget will not be created. | ||
homeButton | Boolean | TRUE | optional If set to false, the HomeButton widget will not be created. | ||
infoBox | Boolean | TRUE | optional If set to false, the InfoBox widget will not be created. | ||
sceneModePicker | Boolean | TRUE | optional If set to false, the SceneModePicker widget will not be created. | ||
selectionIndicator | Boolean | TRUE | optional If set to false, the SelectionIndicator widget will not be created. | ||
timeline | Boolean | TRUE | optional If set to false, the Timeline widget will not be created. | ||
navigationHelpButton | Boolean | TRUE | optional If set to false, the navigation help button will not be created. | ||
navigationInstructionsInitiallyVisible | Boolean | TRUE | optional True if the navigation instructions should initially be visible, or false if the should not be shown until the user explicitly clicks the button. | ||
scene3DOnly | Boolean | FALSE | optional When true, each geometry instance will only be rendered in 3D to save GPU memory. | ||
shouldAnimate | Boolean | FALSE | optional true if the clock should attempt to advance simulation time by default, false otherwise. This option takes precedence over setting Viewer#clockViewModel. | ||
clockViewModel | ClockViewModel | new ClockViewModel(options.clock) | optional The clock view model to use to control current time. | ||
selectedImageryProviderViewModel | ProviderViewModel | optional The view model for the current base imagery layer, if not supplied the first available base layer is used. This value is only valid if options.baseLayerPicker is set to true. | |||
imageryProviderViewModels | Array. |
createDefaultImageryProviderViewModels() | optional The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if options.baseLayerPicker is set to true. | ||
selectedTerrainProviderViewModel | ProviderViewModel | optional The view model for the current base terrain layer, if not supplied the first available base layer is used. This value is only valid if options.baseLayerPicker is set to true. | |||
terrainProviderViewModels | Array. |
createDefaultTerrainProviderViewModels() | optional The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if options.baseLayerPicker is set to true. | ||
imageryProvider | ImageryProvider | createWorldImagery() | optional The imagery provider to use. This value is only valid if options.baseLayerPicker is set to false. | ||
terrainProvider | TerrainProvider | new EllipsoidTerrainProvider() | optional The terrain provider to use | ||
skyBox | SkyBox | optional The skybox used to render the stars. When undefined, the default stars are used. | |||
skyAtmosphere | SkyAtmosphere | optional Blue sky, and the glow around the Earth's limb. Set to false to turn it off. | |||
fullscreenElement | Element | String | document.body | optional The element or id to be placed into fullscreen mode when the full screen button is pressed. | ||
useDefaultRenderLoop | Boolean | TRUE | optional True if this widget should control the render loop, false otherwise. | ||
targetFrameRate | Number | optional The target frame rate when using the default render loop. | |||
showRenderLoopErrors | Boolean | TRUE | optional If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs. | ||
useBrowserRecommendedResolution | Boolean | TRUE | optional If true, render at the browser's recommended resolution and ignore window.devicePixelRatio. | ||
automaticallyTrackDataSourceClocks | Boolean | TRUE | optional If true, this widget will automatically track the clock settings of newly added DataSources, updating if the DataSource's clock changes. Set this to false if you want to configure the clock independently. | ||
contextOptions | Object | optional Context and WebGL creation properties corresponding to options passed to Scene. | |||
sceneMode | SceneMode | SceneMode.SCENE3D | optional The initial scene mode. | ||
mapProjection | MapProjection | new GeographicProjection() | optional The map projection to use in 2D and Columbus View modes. | ||
globe | Globe | new Globe(mapProjection.ellipsoid) | optional The globe to use in the scene. If set to false, no globe will be added. | ||
orderIndependentTranslucency | Boolean | TRUE | optional If true and the configuration supports it, use order independent translucency. | ||
creditContainer | Element | String | optional The DOM element or ID that will contain the CreditDisplay. If not specified, the credits are added to the bottom of the widget itself. | |||
creditViewport | Element | String | optional The DOM element or ID that will contain the credit pop up created by the CreditDisplay. If not specified, it will appear over the widget itself. | |||
dataSources | DataSourceCollection | new DataSourceCollection() | optional The collection of data sources visualized by the widget. If this parameter is provided, the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed. | ||
terrainExaggeration | Number | 1 | optional 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. | ||
shadows | Boolean | FALSE | optional Determines if shadows are cast by light sources. | ||
terrainShadows | ShadowMode | ShadowMode.RECEIVE_ONLY | optional Determines if the terrain casts or receives shadows from light sources. | ||
mapMode2D | MapMode2D | MapMode2D.INFINITE_SCROLL | optional Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction. | ||
projectionPicker | Boolean | FALSE | optional If set to true, the ProjectionPicker widget will be created. | ||
requestRenderMode | Boolean | FALSE | optional If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling reduces the CPU/GPU usage of your application and uses less battery on mobile, but requires using Scene#requestRender to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See Improving Performance with Explicit Rendering. | ||
maximumRenderTimeChange | Number | 0 | optional If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See Improving Performance with Explicit Rendering. |
把这个参数翻译一下,就是
以上几类,基本和地图数据加载相关,比如支持自定义地图数据,自定义地形数据等
下面的好多都没有用过,也没有找到对应的效果,待后续完善