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
containerElement| StringThe DOM element or ID that will contain the widget.
optionsObjectObject with the following properties:
NameTypeDefaultDescription
animationBooleantrueIf set to false, the Animation widget will not be created.  // 如果设置为false,则不会创建“动画”窗口小部件。
baseLayerPickerBooleantrueIf set to false, the BaseLayerPicker widget will not be created. // 如果设置为false,则不会创建BaseLayerPicker小部件。
fullscreenButtonBooleantrueIf set to false, the FullscreenButton widget will not be created. //  如果设置为false,则不会创建FullscreenButton小部件。
vrButtonBooleanfalseIf set to true, the VRButton widget will be created.  // 如果设置为true,则将创建VRButton小部件。
geocoderBoolean | Array.<GeocoderService>trueIf set to false, the Geocoder widget will not be created. // 如果设置为false,则不会创建Geocoder小部件
homeButtonBooleantrueIf set to false, the HomeButton widget will not be created. // 如果设置为false,则不会创建“主页按钮”窗口小部件。
infoBoxBooleantrueIf set to false, the InfoBox widget will not be created. // 如果设置为false,则不会创建InfoBox小部件。
sceneModePickerBooleantrueIf set to false, the SceneModePicker widget will not be created. // 如果设置为false,则不会创建SceneModePicker小部件。
selectionIndicatorBooleantrueIf set to false, the SelectionIndicator widget will not be created. // 如果设置为false,则不会创建SelectionIndicator小部件。
timelineBooleantrueIf set to false, the Timeline widget will not be created. // 如果设置为false,则不会创建时间轴窗口小部件。
navigationHelpButtonBooleantrueIf set to false, the navigation help button will not be created. //如果设置为false,则不会创建导航帮助按钮。
navigationInstructionsInitiallyVisibleBooleantrue

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。

scene3DOnlyBooleanfalse

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

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

shouldAnimateBooleanfalse

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。

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

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时,此值才有效。

imageryProviderViewModelsArray.<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时,此值才有效。

selectedTerrainProviderViewModelProviderViewModel 

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时,此值才有效

terrainProviderViewModelsArray.<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时,此值才有效。

imageryProviderImageryProvidercreateWorldImagery()

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

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

terrainProviderTerrainProvidernew EllipsoidTerrainProvider()

The terrain provider to use

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

skyBoxSkyBox 

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

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

skyAtmosphereSkyAtmosphere 

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

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

fullscreenElementElement | Stringdocument.body

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

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

useDefaultRenderLoopBooleantrue

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

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

targetFrameRateNumber 

The target frame rate when using the default render loop.

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

showRenderLoopErrorsBooleantrue

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

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

automaticallyTrackDataSourceClocksBooleantrue

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。

contextOptionsObject 

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

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

sceneModeSceneModeSceneMode.SCENE3DThe initial scene mode. // 初始场景模式。
mapProjectionMapProjectionnew GeographicProjection()

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

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

globeGlobenew Globe(mapProjection.ellipsoid)

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

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

orderIndependentTranslucencyBooleantrue

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

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

creditContainerElement | 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。 如果未指定,则将积分添加到窗口小部件的底部。

creditViewportElement | 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。 如果未指定,它将显示在窗口小部件本身上。

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

// 窗口小部件可视化的数据源集合。 如果提供了此参数,则假定实例由调用者拥有,并且在销毁查看器时不会销毁该实例。

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

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

shadowsBooleanfalse

Determines if shadows are cast by the sun.

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

terrainShadowsShadowModeShadowMode.RECEIVE_ONLY

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

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

mapMode2DMapMode2DMapMode2D.INFINITE_SCROLL

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

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

projectionPickerBooleanfalse

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

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

requestRenderModeBooleanfalse

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的其他部分中对场景进行更改后,在许多情况下这是必要的。 请参阅使用显式渲染提高性能。

maximumRenderTimeChangeNumber0.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,则此值定义在请求呈现之前允许的模拟时间的最大更改。 请参阅使用显式渲染提高性能。

转载于:https://www.cnblogs.com/d1012181765/p/11045272.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值