English中文

Viewer

new Cesium.Viewer(container, options)

用于构建应用程序的基本小部件。它将所有标准 Cesium 小部件组合到一个可重用的包中。该小部件始终可以使用 mixins 进行扩展,这会添加对各种应用程序有用的功能。 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.
名称 Name 类型 Type 说明 Description
container Element | string 将包含小部件的 DOM 元素或 ID。 The DOM element or ID that will contain the widget.
options Viewer.ConstructorOptions 可选 optional 描述初始化选项的对象 Object describing initialization options
抛出: Throws:
  • DeveloperError :文档中不存在 ID 为“container”的元素。 : Element with id "container" does not exist in the document.
  • DeveloperError :不使用 BaseLayerPicker 小部件时,options.selectedImageryProviderViewModel 不可用,请指定 options.baseLayer。 : options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget, specify options.baseLayer instead.
  • DeveloperError : options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget, specify options.terrainProvider instead.
示例: Example:
// Initialize the viewer widget with several custom options and mixins.
try {
  const viewer = new Cesium.Viewer("cesiumContainer", {
    // Start in Columbus Viewer
    sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
    // Use Cesium World Terrain
    terrain: Cesium.Terrain.fromWorldTerrain(),
    // Hide the base layer picker
    baseLayerPicker: false,
    // Use OpenStreetMaps
    baseLayer: new Cesium.ImageryLayer(new Cesium.OpenStreetMapImageryProvider({
      url: "https://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()
  });
} catch (error) {
  console.log(error);
}

// 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);
});
演示: Demo:
另见: See:

成员 Members

allowDataSourcesToSuspendAnimation : boolean

获取或设置数据源是否可以暂时暂停动画以避免向用户显示不完整的图片。例如,如果在后台处理异步基元,则在几何体准备好之前,时钟将不会前进。 Gets or sets whether or not data sources can temporarily pause animation in order to avoid showing an incomplete picture to the user. For example, if asynchronous primitives are being processed in the background, the clock will not advance until the geometry is ready.
获取动画小部件。 Gets the Animation widget.
获取 BaseLayerPicker。 Gets the BaseLayerPicker.

readonly bottomContainer : Element

获取包含以下内容的窗口底部区域的 DOM 元素 Gets the DOM element for the area at the bottom of the window containing the CreditDisplay 以及可能的其他事情。 and potentially other things.
拿到相机。 Gets the camera.

readonly canvas : HTMLCanvasElement

获取画布。 Gets the canvas.
获取CesiumWidget。 Gets the CesiumWidget.
获取时钟。 Gets the clock.
获取或设置要跟踪查看者时钟的数据源。 Gets or sets the data source to track with the viewer's clock.
获取时钟视图模型。 Gets the clock view model.

readonly container : Element

获取父容器。 Gets the parent container.
管理要在屏幕和灯箱中显示的制作人员列表。 Manages the list of credits to display on screen and in the lightbox.
获取用于的显示 Gets the display used for DataSource visualization.
得到的集合为 Gets the set of DataSource 要可视化的实例。 instances to be visualized.
获取场景的默认椭球体。 Gets the default ellipsoid for the scene.
默认值: Default Value: Ellipsoid.default
获取未绑定到特定数据源的实体的集合。这是一个快捷方式 Gets the collection of entities not tied to a particular data source. This is a shortcut to dataSourceDisplay.defaultDataSource.entities.
获取全屏按钮。 Gets the FullscreenButton.
获取地理编码器。 Gets the Geocoder.
获取 HomeButton。 Gets the HomeButton.
获取将在地球上渲染的图像图层的集合。 Gets the collection of image layers that will be rendered on the globe.
获取信息框。 Gets the info box.
获取导航帮助按钮。 Gets the NavigationHelpButton.
获取后处理阶段。 Gets the post-process stages.
获取 ProjectionPicker。 Gets the ProjectionPicker.

resolutionScale : number

获取或设置渲染分辨率的比例因子。小于 1.0 的值可以提高功能较弱的设备上的性能,而大于 1.0 的值将以更高的分辨率渲染,然后按比例缩小,从而提高视觉保真度。例如,如果小部件的布局尺寸为 640x480,则将此值设置为 0.5 将导致场景以 320x240 渲染,然后放大,而设置为 2.0 将导致场景以 1280x960 渲染,然后缩小。 Gets or sets a scaling factor for rendering resolution. Values less than 1.0 can improve performance on less powerful devices while values greater than 1.0 will render at a higher resolution and then scale down, resulting in improved visual fidelity. For example, if the widget is laid out at a size of 640x480, setting this value to 0.5 will cause the scene to be rendered at 320x240 and then scaled up while setting it to 2.0 will cause the scene to be rendered at 1280x960 and then scaled down.
默认值: Default Value: 1.0
获取场景。 Gets the scene.
获取场景模式选择器。 Gets the SceneModePicker.
获取屏幕空间事件处理程序。 Gets the screen space event handler.

selectedEntity : Entity|undefined

获取或设置要显示选择指示符的对象实例。如果用户交互地选择一个 Cesium3DTilesFeature 实例,那么该属性将包含一个瞬态实体实例,其属性名为“feature”,该属性就是所选择的实例。 Gets or sets the object instance for which to display a selection indicator. If a user interactively picks a Cesium3DTilesFeature instance, then this property will contain a transient Entity instance with a property named "feature" that is the instance that was picked.

readonly selectedEntityChanged : Event

获取所选实体更改时引发的事件。 Gets the event that is raised when the selected entity changes.
获取选择指示器。 Gets the selection indicator.
获取场景的阴影贴图 Get the scene's shadow map
确定光源是否投射阴影。 Determines if shadows are cast by light sources.

targetFrameRate : number

获取或设置小部件的目标帧速率 Gets or sets the target frame rate of the widget when useDefaultRenderLoop 是真的。如果未定义,则浏览器的 requestAnimationFrame 实现确定帧速率。如果定义,该值必须大于 0。高于底层 requestAnimationFrame 实现的值将无效。 is true. If undefined, the browser's requestAnimationFrame implementation determines the frame rate. If defined, this value must be greater than 0. A value higher than the underlying requestAnimationFrame implementation will have no effect.
地形提供者为地球提供表面几何形状。 The terrain provider providing surface geometry for the globe.
确定地形是否从光源投射或产生阴影。 Determines if the terrain casts or shadows from light sources.
获取时间轴小部件。 Gets the Timeline widget.

trackedEntity : Entity|undefined

获取或设置相机当前正在跟踪的Entity实例。 Gets or sets the Entity instance currently being tracked by the camera.

readonly trackedEntityChanged : Event

获取当跟踪的实体发生更改时引发的事件。 Gets the event that is raised when the tracked entity changes.

useBrowserRecommendedResolution : boolean

布尔标志,指示是否使用浏览器推荐的分辨率。如果为 true,则忽略浏览器的设备像素比并使用 1.0,从而有效地基于 CSS 像素而不是设备像素进行渲染。这可以提高具有高像素密度的功能较弱的设备的性能。当为 false 时,渲染将以设备像素为单位。 Boolean flag indicating if the browser's recommended resolution is used. If true, the browser's device pixel ratio is ignored and 1.0 is used instead, effectively rendering based on CSS pixels instead of device pixels. This can improve performance on less powerful devices that have high pixel density. When false, rendering will be in device pixels. Viewer#resolutionScale 无论该标志为真还是假,都仍然有效。 will still take effect whether this flag is true or false.
默认值: Default Value: true

useDefaultRenderLoop : boolean

获取或设置此小部件是否应控制渲染循环。如果为 true,小部件将使用 requestAnimationFrame 来执行小部件的渲染和调整大小,以及驱动模拟时钟。如果设置为 false,则必须手动调用 Gets or sets whether or not this widget should control the render loop. If true the widget will use requestAnimationFrame to perform rendering and resizing of the widget, as well as drive the simulation clock. If set to false, you must manually call the resize, render 方法作为自定义渲染循环的一部分。如果渲染过程中出现错误, methods as part of a custom render loop. If an error occurs during rendering, Scene's renderError 将引发事件并且该属性将设置为 false。必须将其设置回 true 才能在错误发生后继续渲染。 event will be raised and this property will be set to false. It must be set back to true to continue rendering after the error.
获取 VRButton。 Gets the VRButton.

方法 Methods

销毁小部件。如果从布局中永久删除小部件,则应调用。 Destroys the widget. Should be called if permanently removing the widget from layout.

extend(mixin, options)

使用提供的 mixin 扩展基本查看器功能。 mixin 可以向提供的查看器实例添加附加属性、功能或其他行为。 Extends the base viewer functionality with the provided mixin. A mixin may add additional properties, functions, or other behavior to the provided viewer instance.
名称 Name 类型 Type 说明 Description
mixin Viewer.ViewerMixin 要添加到此实例的查看器混合。 The Viewer mixin to add to this instance.
options object 可选 optional 要传递给 mixin 函数的选项对象。 The options object to be passed to the mixin function.
另见: See:

flyTo(target, options)Promise.<boolean>

将相机飞行到提供的一个或多个实体或数据源。如果数据源仍在加载过程中或可视化仍在加载中,则此方法会在执行飞行之前等待数据准备就绪。 Flies the camera to the provided entity, entities, or data source. If the data source is still in the process of loading or the visualization is otherwise still loading, this method waits for the data to be ready before performing the flight.

偏移量是以边界球体中心为中心的局部东西向参考系中的航向/俯仰/范围。航向角和俯仰角在当地的东西向参考系中定义。航向是与 y 轴的角度并朝 x 轴增加。俯仰角是相对于 xy 平面的旋转。正俯仰角位于平面上方。负俯仰角位于平面下方。范围是距中心的距离。如果范围为零,则将计算一个范围,使得整个边界球体可见。 The offset is heading/pitch/range in the local east-north-up reference frame centered at the center of the bounding sphere. The heading and the pitch angles are defined in the local east-north-up reference frame. The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch angles are above the plane. Negative pitch angles are below the plane. The range is the distance from the center. If the range is zero, a range will be computed such that the whole bounding sphere is visible.

在 2D 中,必须有一个自顶向下的视图。相机将放置在目标上方,俯视。目标上方的高度将是范围。航向将根据偏移量确定。如果无法根据偏移确定航向,则航向将为北。 In 2D, there must be a top down view. The camera will be placed above the target looking down. The height above the target will be the range. The heading will be determined from the offset. If the heading cannot be determined from the offset, the heading will be north.

名称 Name 类型 Type 说明 Description
target Entity | Array.<Entity> | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | Promise.<(Entity|Array.<Entity>|EntityCollection|DataSource|ImageryLayer|Cesium3DTileset|TimeDynamicPointCloud|VoxelPrimitive)> 要查看的实体、实体数组、实体集合、数据源、Cesium3DTileset、点云或图像层。您还可以传递解析为前面提到的类型之一的承诺。 The entity, array of entities, entity collection, data source, Cesium3DTileset, point cloud, or imagery layer to view. You can also pass a promise that resolves to one of the previously mentioned types.
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
duration number 3.0 可选 optional 飞行的持续时间(以秒为单位)。 The duration of the flight in seconds.
maximumHeight number 可选 optional 飞行高峰时的最大高度。 The maximum height at the peak of the flight.
offset HeadingPitchRange 可选 optional 以目标为中心的局部东西向参考系中距目标的偏移量。 The offset from the target in the local east-north-up reference frame centered at the target.
返回: Returns:
如果飞行成功,则 Promise 解析为 true;如果目标当前未在场景中可视化或飞行被取消,则解析为 false。 //TODO: 清理实体提及 A Promise that resolves to true if the flight was successful or false if the target is not currently visualized in the scene or the flight was cancelled. //TODO: Cleanup entity mentions
这迫使小部件重新考虑其布局,包括小部件大小和信用放置。 This forces the widget to re-think its layout, including widget sizes and credit placement.

isDestroyed()boolean

返回: Returns:
如果对象已被销毁,则为 true,否则为 false。 true if the object has been destroyed, false otherwise.
渲染场景。该函数会自动调用,除非 Renders the scene. This function is called automatically unless useDefaultRenderLoop 设置为 false; is set to false;
调整小部件的大小以匹配容器大小。该函数会根据需要自动调用,除非 Resizes the widget to match the container size. This function is called automatically as needed unless useDefaultRenderLoop 设置为 false。 is set to false.

zoomTo(target, offset)Promise.<boolean>

异步设置相机以查看提供的一个或多个实体或数据源。如果数据源仍在加载过程中或可视化仍在加载,则此方法将等待数据准备好后再执行缩放。 Asynchronously sets the camera to view the provided entity, entities, or data source. If the data source is still in the process of loading or the visualization is otherwise still loading, this method waits for the data to be ready before performing the zoom.

偏移量是以边界球体中心为中心的局部东西向参考系中的航向/俯仰/范围。航向角和俯仰角在当地的东西向参考系中定义。航向是与 y 轴的角度并朝 x 轴增加。俯仰角是相对于 xy 平面的旋转。正俯仰角位于平面上方。负俯仰角位于平面下方。范围是距中心的距离。如果范围为零,则将计算一个范围,使得整个边界球体可见。 The offset is heading/pitch/range in the local east-north-up reference frame centered at the center of the bounding sphere. The heading and the pitch angles are defined in the local east-north-up reference frame. The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch angles are above the plane. Negative pitch angles are below the plane. The range is the distance from the center. If the range is zero, a range will be computed such that the whole bounding sphere is visible.

在 2D 中,必须有一个自顶向下的视图。相机将放置在目标上方,俯视。目标上方的高度将是范围。航向将根据偏移量确定。如果无法根据偏移确定航向,则航向将为北。 In 2D, there must be a top down view. The camera will be placed above the target looking down. The height above the target will be the range. The heading will be determined from the offset. If the heading cannot be determined from the offset, the heading will be north.

名称 Name 类型 Type 说明 Description
target Entity | Array.<Entity> | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | Promise.<(Entity|Array.<Entity>|EntityCollection|DataSource|ImageryLayer|Cesium3DTileset|TimeDynamicPointCloud|VoxelPrimitive)> 要查看的实体、实体数组、实体集合、数据源、Cesium3DTileset、点云或图像层。您还可以传递解析为前面提到的类型之一的承诺。 The entity, array of entities, entity collection, data source, Cesium3DTileset, point cloud, or imagery layer to view. You can also pass a promise that resolves to one of the previously mentioned types.
offset HeadingPitchRange 可选 optional 距局部东西向参考系中实体中心的偏移量。 The offset from the center of the entity in the local east-north-up reference frame.
返回: Returns:
如果缩放成功,则 Promise 解析为 true;如果目标当前未在场景中可视化或缩放被取消,则解析为 false。 A Promise that resolves to true if the zoom was successful or false if the target is not currently visualized in the scene or the zoom was cancelled.

类型定义 Type Definitions

Cesium.Viewer.ConstructorOptions

查看器构造函数的初始化选项 Initialization options for the Viewer constructor
属性: Properties:
名称 Name 类型 Type Attributes 默认值 Default 说明 Description
animation boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建动画小部件。 If set to false, the Animation widget will not be created.
baseLayerPicker boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建 BaseLayerPicker 小部件。 If set to false, the BaseLayerPicker widget will not be created.
fullscreenButton boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建 FullscreenButton 小部件。 If set to false, the FullscreenButton widget will not be created.
vrButton boolean <可选> &lt;optional>
false 如果设置为 true,将创建 VRButton 小部件。 If set to true, the VRButton widget will be created.
geocoder boolean | IonGeocodeProviderType | Array.<GeocoderService> <可选> &lt;optional>
IonGeocodeProviderType.DEFAULT 使用地理编码器小组件进行搜索时要使用的地理编码服务。如果设置为 false,则不会创建地理编码器小部件。 The geocoding service or services to use when searching with the Geocoder widget. If set to false, the Geocoder widget will not be created.
homeButton boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建 HomeButton 小部件。 If set to false, the HomeButton widget will not be created.
infoBox boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建 InfoBox 小部件。 If set to false, the InfoBox widget will not be created.
sceneModePicker boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建 SceneModePicker 小部件。 If set to false, the SceneModePicker widget will not be created.
selectionIndicator boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建 SelectionIndicator 小部件。 If set to false, the SelectionIndicator widget will not be created.
timeline boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建时间轴小部件。 If set to false, the Timeline widget will not be created.
navigationHelpButton boolean <可选> &lt;optional>
true 如果设置为 false,则不会创建导航帮助按钮。 If set to false, the navigation help button will not be created.
navigationInstructionsInitiallyVisible boolean <可选> &lt;optional>
true 如果导航说明最初应该可见,则为 true;如果在用户明确单击按钮之前不应显示导航说明,则为 false。 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 <可选> &lt;optional>
false When true,每个几何实例将仅以 3D 形式渲染以节省 GPU 内存。 , each geometry instance will only be rendered in 3D to save GPU memory.
shouldAnimate boolean <可选> &lt;optional>
false true 如果时钟默认尝试提前模拟时间, if the clock should attempt to advance simulation time by default, false 否则。该选项优先于设置 otherwise. This option takes precedence over setting Viewer#clockViewModel.
clockViewModel ClockViewModel <可选> &lt;optional>
新的 ClockViewModel(时钟) new ClockViewModel(clock) 用于控制当前时间的时钟视图模型。 The clock view model to use to control current time.
selectedImageryProviderViewModel ProviderViewModel <可选> &lt;optional>
当前基础图像层的视图模型,如果未提供,则使用第一个可用的基础层。仅当“baseLayerPicker”设置为 true 时,此值才有效。 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 `baseLayerPicker` is set to true.
imageryProviderViewModels Array.<ProviderViewModel> <可选> &lt;optional>
createDefaultImageryProviderViewModels() 可从 BaseLayerPicker 中选择的 ProviderViewModel 数组。仅当“baseLayerPicker”设置为 true 时,此值才有效。 The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if `baseLayerPicker` is set to true.
selectedTerrainProviderViewModel ProviderViewModel <可选> &lt;optional>
当前基础地形图层的视图模型,如果未提供,则使用第一个可用的基础图层。仅当“baseLayerPicker”设置为 true 时,此值才有效。 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 `baseLayerPicker` is set to true.
terrainProviderViewModels Array.<ProviderViewModel> <可选> &lt;optional>
createDefaultTerrainProviderViewModels() 可从 BaseLayerPicker 中选择的 ProviderViewModel 数组。仅当“baseLayerPicker”设置为 true 时,此值才有效。 The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if `baseLayerPicker` is set to true.
baseLayer ImageryLayer | false <可选> &lt;optional>
ImageryLayer.fromWorldImagery() 应用于地球的最底层图像层。如果设置为 The bottommost imagery layer applied to the globe. If set to false,不会添加任何图像提供者。仅当“baseLayerPicker”设置为 false 时此值才有效。当“globe”设置为 false 时无法使用。 , no imagery provider will be added. This value is only valid if `baseLayerPicker` is set to false. Cannot be used when `globe` is set to false.
ellipsoid Ellipsoid <可选> &lt;optional>
Ellipsoid.default 默认椭球体。 The default ellipsoid.
terrainProvider TerrainProvider <可选> &lt;optional>
新的 EllipsoidTerrainProvider() new EllipsoidTerrainProvider() 要使用的地形提供者 The terrain provider to use
terrain Terrain <可选> &lt;optional>
处理异步地形提供者的地形对象。仅当 options.terrainProvider 未定义时才能指定。 A terrain object which handles asynchronous terrain provider. Can only specify if options.terrainProvider is undefined.
skyBox SkyBox | false <可选> &lt;optional>
用于渲染星星的天空盒。当 The skybox used to render the stars. When undefined 和使用的WGS84椭球体,使用默认的星星。如果设置为 and the WGS84 ellipsoid used, the default stars are used. If set to false,不会添加天空盒、太阳或月亮。 , no skyBox, Sun, or Moon will be added.
skyAtmosphere SkyAtmosphere | false <可选> &lt;optional>
蓝色的天空,以及地球边缘周围的光芒。使用 WGS84 椭球体时启用。设置为 Blue sky, and the glow around the Earth's limb. Enabled when the WGS84 ellipsoid used. Set to false 将其关闭。 to turn it off.
fullscreenElement Element | string <可选> &lt;optional>
document.body 按下全屏按钮时要置于全屏模式的元素或 id。 The element or id to be placed into fullscreen mode when the full screen button is pressed.
useDefaultRenderLoop boolean <可选> &lt;optional>
true 如果此小部件应控制渲染循环,则为 true,否则为 false。 True if this widget should control the render loop, false otherwise.
targetFrameRate number <可选> &lt;optional>
使用默认渲染循环时的目标帧速率。 The target frame rate when using the default render loop.
showRenderLoopErrors boolean <可选> &lt;optional>
true 如果为 true,则如果发生渲染循环错误,此小部件将自动向用户显示包含错误的 HTML 面板。 If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs.
useBrowserRecommendedResolution boolean <可选> &lt;optional>
true 如果为 true,则以浏览器建议的分辨率渲染并忽略 If true, render at the browser's recommended resolution and ignore window.devicePixelRatio.
automaticallyTrackDataSourceClocks boolean <可选> &lt;optional>
true 如果为 true,则此小部件将自动跟踪新添加的数据源的时钟设置,并在数据源的时钟发生变化时进行更新。如果您想独立配置时钟,请将此设置为 false。 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 ContextOptions <可选> &lt;optional>
上下文和 WebGL 创建属性传递给 Context and WebGL creation properties passed to Scene.
sceneMode SceneMode <可选> &lt;optional>
SceneMode.SCENE3D 初始场景模式。 The initial scene mode.
mapProjection MapProjection <可选> &lt;optional>
新的地理投影(选项.ellipsoid) new GeographicProjection(options.ellipsoid) 在 2D 和哥伦布视图模式下使用的地图投影。 The map projection to use in 2D and Columbus View modes.
globe Globe | false <可选> &lt;optional>
新地球仪(选项.椭球体) new Globe(options.ellipsoid) 在场景中使用的地球仪。如果设置为 The globe to use in the scene. If set to false,不会添加地球仪,并且默认隐藏天空大气。 , no globe will be added and the sky atmosphere will be hidden by default.
orderIndependentTranslucency boolean <可选> &lt;optional>
true 如果为 true 并且配置支持它,则使用顺序无关的半透明。 If true and the configuration supports it, use order independent translucency.
creditContainer Element | string <可选> &lt;optional>
将包含的 DOM 元素或 ID 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 <可选> &lt;optional>
将包含由创建的信用弹出窗口的 DOM 元素或 ID 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 <可选> &lt;optional>
新的数据源集合() 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.
shadows boolean <可选> &lt;optional>
false 确定光源是否投射阴影。 Determines if shadows are cast by light sources.
terrainShadows ShadowMode <可选> &lt;optional>
ShadowMode.RECEIVE_ONLY 确定地形是否投射或接收来自光源的阴影。 Determines if the terrain casts or receives shadows from light sources.
mapMode2D MapMode2D <可选> &lt;optional>
MapMode2D.INFINITE_SCROLL 确定 2D 地图是否可旋转或可在水平方向无限滚动。 Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction.
projectionPicker boolean <可选> &lt;optional>
false 如果设置为 true,将创建 ProjectionPicker 小部件。 If set to true, the ProjectionPicker widget will be created.
blurActiveElementOnCanvasFocus boolean <可选> &lt;optional>
true 如果为 true,则当单击查看器的画布时,活动元素将变得模糊。当单击画布仅用于检索位置或实体数据而不实际意味着将画布设置为活动元素时,将此设置为 false 非常有用。 If true, the active element will blur when the viewer's canvas is clicked. Setting this to false is useful for cases when the canvas is clicked only for retrieving position or an entity data without actually meaning to set the canvas to be the active element.
requestRenderMode boolean <可选> &lt;optional>
false 如果为 true,则仅在需要时才会渲染帧,具体取决于场景内的变化。启用可减少应用程序的 CPU/GPU 使用率,并在移动设备上使用更少的电池,但需要使用 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 在此模式下显式渲染新帧。在许多情况下,在 API 其他部分更改场景后,这是必要的。参见 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 <可选> &lt;optional>
0.0 如果 requestRenderMode 为 true,则该值定义请求渲染之前允许的模拟时间的最大变化。参见 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.
depthPlaneEllipsoidOffset number <可选> &lt;optional>
0.0 调整深度平面以解决椭球零高程以下的渲染伪影。 Adjust the DepthPlane to address rendering artefacts below ellipsoid zero elevation.
msaaSamples number <可选> &lt;optional>
4 如果提供,该值控制多重采样抗锯齿的速率。典型的多重采样率为每像素 2 个、4 个,有时甚至 8 个样本。较高的 MSAA 采样率可能会影响性能,但会提高视觉质量。该值仅适用于支持多重采样渲染目标的 WebGL2 上下文。设置为 1 以禁用 MSAA。 If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets. Set to 1 to disable MSAA.

Cesium.Viewer.ViewerMixin(viewer, options)

通过附加功能增强 Viewer 实例的函数。 A function that augments a Viewer instance with additional functionality.
名称 Name 类型 Type 说明 Description
viewer Viewer 查看器实例。 The viewer instance.
options object 要传递给 mixin 函数的选项对象。 Options object to be passed to the mixin function.
另见: See:
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.