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來擴展窗口小部件,這可以添加對各種應用程序有用的功能。

Name Type Description
container Element| String The DOM element or ID that will contain the widget.
options Object Object with the following properties:
Name Type Default Description
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,則此值定義在請求呈現之前允許的模擬時間的最大更改。 請參閱使用顯式渲染提高性能。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM