Cesium.Viewer

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://cesiumjs.org/releases/1.58/Build/Cesium/Cesium.js"></script>
<link href="https://cesiumjs.org/releases/1.58/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
</head>
<body>
<div id="cesiumContainer" style="width: 700px; height:400px"></div>
<script>
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4ZTU4ZThkYy01NTg1LTRhZjYtOGQ3Ny0'+
'3MTVlMTI4MzA5NjkiLCJpZCI6MTE4MjEsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1NTk4MDI0MDB9.FqelmTx7OeJdCLJ_b-PxdZSrSeC0Fd4cA1_os4RctVg';
var viewer = new Cesium.Viewer('cesiumContainer');
</script>
</body>
</html>

Cesium.Viewer 用于构建应用程序的基本小部件 它将所有标准Cesium小部件组合成一个可重用的包。 可以使用mixin来扩展窗口小部件,这可以添加对各种应用程序有用的功能。

NameTypeDescription
container Element| String The DOM element or ID that will contain the widget.
options Object Object with the following properties:
NameTypeDefaultDescription
animation Boolean true If set to false, the Animation widget will not be created.  // 如果设置为false,则不会创建“动画”窗口小部件。
baseLayerPicker Boolean true If set to false, the BaseLayerPicker widget will not be created. // 如果设置为false,则不会创建BaseLayerPicker小部件。
fullscreenButton Boolean true If set to false, the FullscreenButton widget will not be created. //  如果设置为false,则不会创建FullscreenButton小部件。
vrButton Boolean false If set to true, the VRButton widget will be created.  // 如果设置为true,则将创建VRButton小部件。
geocoder Boolean | Array.<GeocoderService> true If set to false, the Geocoder widget will not be created. // 如果设置为false,则不会创建Geocoder小部件
homeButton Boolean true If set to false, the HomeButton widget will not be created. // 如果设置为false,则不会创建“主页按钮”窗口小部件。
infoBox Boolean true If set to false, the InfoBox widget will not be created. // 如果设置为false,则不会创建InfoBox小部件。
sceneModePicker Boolean true If set to false, the SceneModePicker widget will not be created. // 如果设置为false,则不会创建SceneModePicker小部件。
selectionIndicator Boolean true If set to false, the SelectionIndicator widget will not be created. // 如果设置为false,则不会创建SelectionIndicator小部件。
timeline Boolean true If set to false, the Timeline widget will not be created. // 如果设置为false,则不会创建时间轴窗口小部件。
navigationHelpButton Boolean true If set to false, the navigation help button will not be created. //如果设置为false,则不会创建导航帮助按钮。
navigationInstructionsInitiallyVisible Boolean true

True if the navigation instructions should initially be visible, or false if the should not be shown until the user explicitly clicks the button.

// 如果导航说明最初应该可见,则为True;如果在用户明确单击按钮之前不应显示导航说明,则为false。

scene3DOnly Boolean false

When true, each geometry instance will only be rendered in 3D to save GPU memory.

// 如果为true,则每个几何实例仅以3D呈现以节省GPU内存。

shouldAnimate Boolean false

true if the clock should attempt to advance simulation time by default, false otherwise. This option takes precedence over setting Viewer#clockViewModel.

// 如果时钟默认情况下应尝试提前模拟时间,则为true,否则为false。 此选项优先于设置Viewer#clockViewModel。

clockViewModel ClockViewModel new ClockViewModel(options.clock) The clock view model to use to control current time. // 用于控制当前时间的时钟视图模型。
selectedImageryProviderViewModel ProviderViewModel  

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.

// 如果未提供第一个可用基础层,则使用当前基础图像层的视图模型。 仅当options.baseLayerPicker设置为true时,此值才有效。

imageryProviderViewModels Array.<ProviderViewModel> createDefaultImageryProviderViewModels()

The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if options.baseLayerPicker is set to true.

// 可从BaseLayerPicker中选择的ProviderViewModel数组。 仅当options.baseLayerPicker设置为true时,此值才有效。

selectedTerrainProviderViewModel ProviderViewModel  

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.

// 如果未提供第一个可用基础层,则使用当前基础地形图层的视图模型。 仅当options.baseLayerPicker设置为true时,此值才有效

terrainProviderViewModels Array.<ProviderViewModel> createDefaultTerrainProviderViewModels()

The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if options.baseLayerPicker is set to true.

//可从BaseLayerPicker中选择的ProviderViewModel数组。 仅当options.baseLayerPicker设置为true时,此值才有效。

imageryProvider ImageryProvider createWorldImagery()

The imagery provider to use. This value is only valid if options.baseLayerPicker is set to false.

// 要使用的图像提供程序。 仅当options.baseLayerPicker设置为false时,此值才有效。

terrainProvider TerrainProvider new EllipsoidTerrainProvider()

The terrain provider to use

// 要使用的地形提供程序

skyBox SkyBox  

The skybox used to render the stars. When undefined, the default stars are used.

// 用于渲染星星的天空盒。 未定义时,使用默认星号。

skyAtmosphere SkyAtmosphere  

Blue sky, and the glow around the Earth's limb. Set to false to turn it off.

// 蔚蓝的天空,以及地球四肢的光芒。 设置为false以将其关闭。

fullscreenElement Element | String document.body

The element or id to be placed into fullscreen mode when the full screen button is pressed.

// 按下全屏按钮时要放入全屏模式的元素或ID。

useDefaultRenderLoop Boolean true

True if this widget should control the render loop, false otherwise.

// 如果此窗口小部件应控制渲染循环,则为True,否则为false。

targetFrameRate Number  

The target frame rate when using the default render loop.

// 使用默认渲染循环时的目标帧速率。

showRenderLoopErrors Boolean true

If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs.

// 如果为true,则此窗口小部件将自动向包含错误的用户显示HTML面板(如果发生渲染循环错误)。

automaticallyTrackDataSourceClocks Boolean true

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.

// 如果为true,则此窗口小部件将自动跟踪新添加的DataSource的时钟设置,如果DataSource的时钟更改则更新。 如果要独立配置时钟,请将此项设置为false。

contextOptions Object  

Context and WebGL creation properties corresponding to options passed to Scene.

// 与传递给Scene的选项对应的Context和WebGL创建属性。

sceneMode SceneMode SceneMode.SCENE3D The initial scene mode. // 初始场景模式。
mapProjection MapProjection new GeographicProjection()

The map projection to use in 2D and Columbus View modes.

// 用于2D和Columbus View模式的地图投影。

globe Globe new Globe(mapProjection.ellipsoid)

The globe to use in the scene. If set to false, no globe will be added.

// 地球在场景中使用。 如果设置为false,则不会添加地球仪。

orderIndependentTranslucency Boolean true

If true and the configuration supports it, use order independent translucency.

// 如果为true且配置支持它,请使用与顺序无关的半透明度。

creditContainer Element | String  

The DOM element or ID that will contain the CreditDisplay. If not specified, the credits are added to the bottom of the widget itself.

// 包含CreditDisplay的DOM元素或ID。 如果未指定,则将积分添加到窗口小部件的底部。

creditViewport Element | String  

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.

// 将包含CreditDisplay创建的信用弹出窗口的DOM元素或ID。 如果未指定,它将显示在窗口小部件本身上。

dataSources DataSourceCollection new DataSourceCollection()

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.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.

// 用于夸大地形的标量。 请注意,地形夸大不会修改任何其他基元,因为它们相对于椭球定位。

shadows Boolean false

Determines if shadows are cast by the sun.

// 确定是否由太阳投射阴影。

terrainShadows ShadowMode ShadowMode.RECEIVE_ONLY

Determines if the terrain casts or receives shadows from the sun.

// 确定地形是否投射或接收来自太阳的阴影。

mapMode2D MapMode2D MapMode2D.INFINITE_SCROLL

Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction.

// 确定2D地图是可旋转的还是可以在水平方向上无限滚动。

projectionPicker Boolean false

If set to true, the ProjectionPicker widget will be created.

// 如果设置为true,则将创建ProjectionPicker小部件。

requestRenderMode Boolean false

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.

// 如果为true,则仅在需要时才渲染帧,这由场景内的更改确定。 启用会降低应用程序的CPU / GPU使用率并减少移动设备上的电量,但需要使用Scene#requestRender在此模式下显式呈现新帧。 在API的其他部分中对场景进行更改后,在许多情况下这是必要的。 请参阅使用显式渲染提高性能。

maximumRenderTimeChange Number 0.0

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.

// 如果requestRenderMode为true,则此值定义在请求呈现之前允许的模拟时间的最大更改。 请参阅使用显式渲染提高性能。

posted @ 2019-06-18 15:12  yiwenzhang  阅读(2183)  评论(0编辑  收藏  举报