Skip to content

xgis-cesium v0.1.7


xgis-cesium / XViewer

Class: XViewer ​

Defined in: src/core/XViewer.ts:48

扩展的Viewer

Extends ​

  • CesiumWidget

Constructors ​

new XViewer() ​

new XViewer(container, options?): XViewer

Defined in: src/core/XViewer.ts:82

Parameters ​

container ​

string | Element

options? ​

Returns ​

XViewer

Overrides ​

Cesium.CesiumWidget.constructor

Properties ​

allowDataSourcesToSuspendAnimation ​

allowDataSourcesToSuspendAnimation: boolean

Defined in: node_modules/@cesium/engine/index.d.ts:44798

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.

Inherited from ​

Cesium.CesiumWidget.allowDataSourcesToSuspendAnimation


camera ​

readonly camera: Camera

Defined in: node_modules/@cesium/engine/index.d.ts:44742

Gets the camera.

Inherited from ​

Cesium.CesiumWidget.camera


canvas ​

readonly canvas: HTMLCanvasElement

Defined in: node_modules/@cesium/engine/index.d.ts:44701

Gets the canvas.

Inherited from ​

Cesium.CesiumWidget.canvas


clock ​

readonly clock: Clock

Defined in: node_modules/@cesium/engine/index.d.ts:44750

Gets the clock.

Inherited from ​

Cesium.CesiumWidget.clock


clockTrackedDataSource ​

clockTrackedDataSource: DataSource

Defined in: node_modules/@cesium/engine/index.d.ts:44810

Gets or sets the data source to track with the widget's clock.

Inherited from ​

Cesium.CesiumWidget.clockTrackedDataSource


container ​

readonly container: Element

Defined in: node_modules/@cesium/engine/index.d.ts:44697

Gets the parent container.

Inherited from ​

Cesium.CesiumWidget.container


creditContainer ​

readonly creditContainer: Element

Defined in: node_modules/@cesium/engine/index.d.ts:44705

Gets the credit container.

Inherited from ​

Cesium.CesiumWidget.creditContainer


creditDisplay ​

creditDisplay: CreditDisplay

Defined in: node_modules/@cesium/engine/index.d.ts:44725

Manages the list of credits to display on screen and in the lightbox.

Inherited from ​

Cesium.CesiumWidget.creditDisplay


creditViewport ​

readonly creditViewport: Element

Defined in: node_modules/@cesium/engine/index.d.ts:44709

Gets the credit viewport

Inherited from ​

Cesium.CesiumWidget.creditViewport


CurrentBasicID ​

CurrentBasicID: string = "Single"

Defined in: src/core/XViewer.ts:66


dataSourceDisplay ​

readonly dataSourceDisplay: DataSourceDisplay

Defined in: node_modules/@cesium/engine/index.d.ts:44729

Gets the display used for DataSource visualization.

Inherited from ​

Cesium.CesiumWidget.dataSourceDisplay


dataSources ​

readonly dataSources: DataSourceCollection

Defined in: node_modules/@cesium/engine/index.d.ts:44738

Gets the set of DataSource instances to be visualized.

Inherited from ​

Cesium.CesiumWidget.dataSources


ellipsoid ​

readonly ellipsoid: Ellipsoid

Defined in: node_modules/@cesium/engine/index.d.ts:44746

Gets the default ellipsoid for the scene.

Inherited from ​

Cesium.CesiumWidget.ellipsoid


entities ​

readonly entities: EntityCollection

Defined in: node_modules/@cesium/engine/index.d.ts:44734

Gets the collection of entities not tied to a particular data source. This is a shortcut to [dataSourceDisplay.defaultDataSource.entities]CesiumWidget#dataSourceDisplay.

Inherited from ​

Cesium.CesiumWidget.entities


ImageryLayerMapList ​

ImageryLayerMapList: Map<string, ImageryLayer>

Defined in: src/core/XViewer.ts:64


imageryLayers ​

readonly imageryLayers: ImageryLayerCollection

Defined in: node_modules/@cesium/engine/index.d.ts:44717

Gets the collection of image layers that will be rendered on the globe.

Inherited from ​

Cesium.CesiumWidget.imageryLayers


resolutionScale ​

resolutionScale: number

Defined in: node_modules/@cesium/engine/index.d.ts:44782

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.

Inherited from ​

Cesium.CesiumWidget.resolutionScale


scene ​

readonly scene: Scene

Defined in: node_modules/@cesium/engine/index.d.ts:44713

Gets the scene.

Inherited from ​

Cesium.CesiumWidget.scene


screenSpaceEventHandler ​

readonly screenSpaceEventHandler: ScreenSpaceEventHandler

Defined in: node_modules/@cesium/engine/index.d.ts:44754

Gets the screen space event handler.

Inherited from ​

Cesium.CesiumWidget.screenSpaceEventHandler


targetFrameRate ​

targetFrameRate: number

Defined in: node_modules/@cesium/engine/index.d.ts:44761

Gets or sets the target frame rate of the widget when useDefaultRenderLoop 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.

Inherited from ​

Cesium.CesiumWidget.targetFrameRate


terrainProvider ​

terrainProvider: TerrainProvider

Defined in: node_modules/@cesium/engine/index.d.ts:44721

The terrain provider providing surface geometry for the globe.

Inherited from ​

Cesium.CesiumWidget.terrainProvider


trackedEntity ​

trackedEntity: Entity

Defined in: node_modules/@cesium/engine/index.d.ts:44802

Gets or sets the Entity instance currently being tracked by the camera.

Inherited from ​

Cesium.CesiumWidget.trackedEntity


trackedEntityChanged ​

readonly trackedEntityChanged: Event

Defined in: node_modules/@cesium/engine/index.d.ts:44806

Gets the event that is raised when the tracked entity changes.

Inherited from ​

Cesium.CesiumWidget.trackedEntityChanged


useBrowserRecommendedResolution ​

useBrowserRecommendedResolution: boolean

Defined in: node_modules/@cesium/engine/index.d.ts:44791

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. CesiumWidget#resolutionScale will still take effect whether this flag is true or false.

Inherited from ​

Cesium.CesiumWidget.useBrowserRecommendedResolution


useDefaultRenderLoop ​

useDefaultRenderLoop: boolean

Defined in: node_modules/@cesium/engine/index.d.ts:44773

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

Inherited from ​

Cesium.CesiumWidget.useDefaultRenderLoop

Accessors ​

BasicIDList ​

Get Signature ​

get BasicIDList(): string[]

Defined in: src/core/XViewer.ts:264

底图ID列表

Returns ​

string[]


cameraPosition ​

Get Signature ​

get cameraPosition(): Position

Defined in: src/core/XViewer.ts:347

相机位置

Returns ​

Position


compass ​

Get Signature ​

get compass(): Compass

Defined in: src/core/XViewer.ts:250

Returns ​

Compass


contextMenu ​

Get Signature ​

get contextMenu(): ContextMenu

Defined in: src/core/XViewer.ts:161

Returns ​

ContextMenu


distanceLegend ​

Get Signature ​

get distanceLegend(): DistanceLegend

Defined in: src/core/XViewer.ts:242

Returns ​

DistanceLegend


drawTool ​

Get Signature ​

get drawTool(): DrawTool

Defined in: src/core/XViewer.ts:278

绘制工具

Returns ​

DrawTool


editTool ​

Get Signature ​

get editTool(): EditTool

Defined in: src/core/XViewer.ts:289

编辑工具

Returns ​

EditTool


effect ​

Get Signature ​

get effect(): Effect

Defined in: src/core/XViewer.ts:268

Returns ​

Effect


hawkeyeMap ​

Get Signature ​

get hawkeyeMap(): HawkeyeMap

Defined in: src/core/XViewer.ts:199

Returns ​

HawkeyeMap


ImageryLayerHelper ​

Get Signature ​

get ImageryLayerHelper(): ImageryLayerManager

Defined in: src/core/XViewer.ts:329

栅格图层管理

Returns ​

ImageryLayerManager


isBasicVisible ​

Get Signature ​

get isBasicVisible(): boolean

Defined in: src/core/XViewer.ts:788

获取 底图的可见性

Returns ​

boolean

Set Signature ​

set isBasicVisible(isShow): void

Defined in: src/core/XViewer.ts:794

改变底图的可见性

Parameters ​
isShow ​

boolean

Returns ​

void


layerContainer ​

Get Signature ​

get layerContainer(): HTMLElement

Defined in: src/core/XViewer.ts:300

图层容器DIV

Returns ​

HTMLElement


loadingMask ​

Get Signature ​

get loadingMask(): LoadingMask

Defined in: src/core/XViewer.ts:208

Returns ​

LoadingMask


locationBar ​

Get Signature ​

get locationBar(): LocationBar

Defined in: src/core/XViewer.ts:233

Returns ​

LocationBar


mapSplit ​

Get Signature ​

get mapSplit(): MapSplit

Defined in: src/core/XViewer.ts:185

Returns ​

MapSplit


mapSwitch ​

Get Signature ​

get mapSwitch(): MapSwitch

Defined in: src/core/XViewer.ts:177

Returns ​

MapSwitch


Get Signature ​

get popup(): Popup

Defined in: src/core/XViewer.ts:153

Returns ​

Popup


requestRenderMode ​

Get Signature ​

get requestRenderMode(): boolean

Defined in: src/core/XViewer.ts:416

获取当前requestRenderMode, true,要求场景主动刷新 false,场景自动刷新

Returns ​

boolean

Set Signature ​

set requestRenderMode(val): void

Defined in: src/core/XViewer.ts:424

获取当前requestRenderMode, true,要求场景主动刷新 false,场景自动刷新

Parameters ​
val ​

boolean

Returns ​

void


resolution ​

Get Signature ​

get resolution(): number

Defined in: src/core/XViewer.ts:362

分辨率

Returns ​

number


sceneSplit ​

Get Signature ​

get sceneSplit(): SceneSplit

Defined in: src/core/XViewer.ts:224

Returns ​

SceneSplit


TDTKey ​

Get Signature ​

get TDTKey(): string

Defined in: src/core/XViewer.ts:313

一个天地图Key值(随机的一个)

Returns ​

string


TDTKeys ​

Set Signature ​

set TDTKeys(value): void

Defined in: src/core/XViewer.ts:320

Parameters ​
value ​

string[]

Returns ​

void


tilesetSplit ​

Get Signature ​

get tilesetSplit(): TilesetSplit

Defined in: src/core/XViewer.ts:216

Returns ​

TilesetSplit


tooltip ​

Get Signature ​

get tooltip(): Tooltip

Defined in: src/core/XViewer.ts:169

Returns ​

Tooltip


viewBounds ​

Get Signature ​

get viewBounds(): Rectangle

Defined in: src/core/XViewer.ts:381

视野范围

Returns ​

Rectangle


viewerEvent ​

Get Signature ​

get viewerEvent(): ViewerEvent

Defined in: src/core/XViewer.ts:1120

对外绑定事件对象

Returns ​

ViewerEvent


Weather ​

Get Signature ​

get Weather(): Weather

Defined in: src/core/XViewer.ts:1044

天气对象

Returns ​

Weather


widgetContainer ​

Get Signature ​

get widgetContainer(): HTMLElement

Defined in: src/core/XViewer.ts:306

组件容器DIV

Returns ​

HTMLElement


zoom ​

Get Signature ​

get zoom(): number

Defined in: src/core/XViewer.ts:400

当前级别

Returns ​

number

Methods ​

addBaseLayer() ​

addBaseLayer(baseLayerProvider, layerOptions): XViewer

Defined in: src/core/XViewer.ts:754

添加地图 .

Parameters ​

baseLayerProvider ​

Promise<any>

layerOptions ​

ConstructorOptions = {}

Returns ​

XViewer


addImageryLayer() ​

addImageryLayer(providerPromise, layerID?, layerOptions?, index?): string

Defined in: src/core/XViewer.ts:809

添加影像图层

Parameters ​

providerPromise ​

Promise<any>

影像图层Provider

layerID? ​

string

制定图层ID

layerOptions? ​

ConstructorOptions = {}

index? ​

number

索引ID

Returns ​

string


addWindLayer() ​

addWindLayer(windJsonURL, windOptions?): void

Defined in: src/core/XViewer.ts:1053

添加风图层

Parameters ​

windJsonURL ​

string

windOptions? ​

any

Returns ​

void


appendBasicLayer() ​

appendBasicLayer(basicID, layerOptions, providerOptions?): void

Defined in: src/core/XViewer.ts:734

增量添加多个底图

Parameters ​

basicID ​

string = EnumBasicLayerID.Single

layerOptions ​

ConstructorOptions = {}

providerOptions? ​

any

Returns ​

void


changeCameraFocus() ​

changeCameraFocus(cameraFocusType): void

Defined in: src/core/XViewer.ts:449

切换相机视角

Parameters ​

cameraFocusType ​

EnumCameraFocus = EnumCameraFocus.God

Returns ​

void


changeImageryLayerIndex() ​

changeImageryLayerIndex(layerID, index): void

Defined in: src/core/XViewer.ts:850

改变 影像图层的索引顺序

Parameters ​

layerID ​

string

图层ID

index ​

number

索引ID

Returns ​

void


changeMouseMode() ​

changeMouseMode(mouseMode): XViewer

Defined in: src/core/XViewer.ts:676

Changes Mouse Mode,0:Default,1: Change the tiltEventTypes to CameraEventType.RIGHT_DRAG

Parameters ​

mouseMode ​

any

Returns ​

XViewer


changeSceneMode() ​

changeSceneMode(sceneMode, duration): XViewer

Defined in: src/core/XViewer.ts:467

切换场景模式,2:2D,2.5:2.5D,3:3D

Parameters ​

sceneMode ​

number

duration ​

number = 0

Returns ​

XViewer


clearBasicLayer() ​

clearBasicLayer(): void

Defined in: src/core/XViewer.ts:778

移除底图

Returns ​

void


clearImageryLayer() ​

clearImageryLayer(): void

Defined in: src/core/XViewer.ts:842

移除所有影像图层

Returns ​

void


clearLayers() ​

clearLayers(): void

Defined in: src/core/XViewer.ts:1023

Returns ​

void


destroy() ​

destroy(): XViewer

Defined in: src/core/XViewer.ts:1166

Destroy方法重载

Returns ​

XViewer

Overrides ​

Cesium.CesiumWidget.destroy


exportScene() ​

exportScene(name): XViewer

Defined in: src/core/XViewer.ts:632

导出场景为图片

Parameters ​

name ​

string

Returns ​

XViewer


flyTo() ​

flyTo(target, options?): Promise<boolean>

Defined in: node_modules/@cesium/engine/index.d.ts:44881

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.

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.

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.

Parameters ​

target ​

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.

Entity | EntityCollection | DataSource | Entity[] | Cesium3DTileset | ImageryLayer | TimeDynamicPointCloud | Promise<Entity | EntityCollection | DataSource | Entity[] | Cesium3DTileset | ImageryLayer | TimeDynamicPointCloud | VoxelPrimitive>

options? ​

Object with the following properties:

duration? ​

number

The duration of the flight in seconds.

maximumHeight? ​

number

The maximum height at the peak of the flight.

offset? ​

HeadingPitchRange

The offset from the target in the local east-north-up reference frame centered at the target.

Returns ​

Promise<boolean>

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

Inherited from ​

Cesium.CesiumWidget.flyTo


flyToBounds() ​

flyToBounds(bounds, param1, completeCallback?, duration?): XViewer

Defined in: src/core/XViewer.ts:579

飞行岛某一范围

Parameters ​

bounds ​

string | number[]

param1 ​
heading? ​

number = 0

pitch? ​

number = 0

roll? ​

number = 0

completeCallback? ​

FlightCompleteCallback

duration? ​

number = 0

Returns ​

XViewer


flyToPosition() ​

flyToPosition(position0, completeCallback?, duration?): XViewer

Defined in: src/core/XViewer.ts:527

相机飞到某个位置

Parameters ​

position0 ​

string | number[] | Cartesian3 | Cartographic | Position | { lat: any; lng: any; }

completeCallback? ​

FlightCompleteCallback

duration? ​

number = 0

Returns ​

XViewer


flyToTarget() ​

flyToTarget(target, duration?): XViewer

Defined in: src/core/XViewer.ts:513

飞向实体

Parameters ​

target ​

any

duration? ​

number

Returns ​

XViewer


getBasicLayers() ​

getBasicLayers(): Map<string, ImageryLayer>

Defined in: src/core/XViewer.ts:770

获取所有底图,对应的图层对象

Returns ​

Map<string, ImageryLayer>


getCatesian3ByPick() ​

getCatesian3ByPick(windowPosition): Cartesian3

Defined in: src/core/XViewer.ts:1221

拾取位置点 (笛卡尔,世界坐标系)

Parameters ​

windowPosition ​

Cartesian2

屏幕坐标点

Returns ​

Cartesian3


GetHeightByZoom() ​

GetHeightByZoom(zoom): number

Defined in: src/core/XViewer.ts:498

根据级别,获取相机高度

Parameters ​

zoom ​

number

级别

Returns ​

number


getImageryLayer() ​

getImageryLayer(layerID): ImageryLayer

Defined in: src/core/XViewer.ts:828

根据ID,获取某个影像图层对象

Parameters ​

layerID ​

string

Returns ​

ImageryLayer

影像图层对象


getLayer() ​

getLayer(layerID): Layer

Defined in: src/core/XViewer.ts:943

获取图层对象

Parameters ​

layerID ​

string

图层ID

Returns ​

Layer


getLayerGroup() ​

getLayerGroup(layerGroupID): LayerGroup

Defined in: src/core/XViewer.ts:876

获取图层组

Parameters ​

layerGroupID ​

string

图层组ID

Returns ​

LayerGroup


getLayers() ​

getLayers(): any[]

Defined in: src/core/XViewer.ts:960

获取所有图层

Returns ​

any[]


getOffset() ​

getOffset(): object

Defined in: src/core/XViewer.ts:1199

Returns ​

object

x ​

x: number = 0

y ​

y: number = 0


GetZoomByHeight() ​

GetZoomByHeight(cameraHeight?): number

Defined in: src/core/XViewer.ts:483

根据高度获取地图级别

Parameters ​

cameraHeight? ​

number

相机高度,默认为当前相机的高度

Returns ​

number


hasLayer() ​

hasLayer(layer): Layer

Defined in: src/core/XViewer.ts:975

判断是否含有某个图层

Parameters ​

layer ​

Layer

Returns ​

Layer


isDestroyed() ​

isDestroyed(): boolean

Defined in: node_modules/@cesium/engine/index.d.ts:44824

Returns ​

boolean

true if the object has been destroyed, false otherwise.

Inherited from ​

Cesium.CesiumWidget.isDestroyed


off() ​

off(type, callback, context?): XViewer

Defined in: src/core/XViewer.ts:1155

Parameters ​

type ​

any

callback ​

Function

context? ​

any

Returns ​

XViewer


on() ​

on(type, callback, context?): XViewer

Defined in: src/core/XViewer.ts:1130

Parameters ​

type ​

any

callback ​

Function

context? ​

any

Returns ​

XViewer


once() ​

once(type, callback, context?): XViewer

Defined in: src/core/XViewer.ts:1143

Parameters ​

type ​

any

callback ​

Function

context? ​

any

Returns ​

XViewer


removeImageryLayer() ​

removeImageryLayer(layerID): void

Defined in: src/core/XViewer.ts:836

移除影像图层

Parameters ​

layerID ​

string

Returns ​

void


removeLayerByID() ​

removeLayerByID(layerID): void

Defined in: src/core/XViewer.ts:1007

根据图层ID,移除图层

Parameters ​

layerID ​

string

图层ID

Returns ​

void


removeLayerGroupByID() ​

removeLayerGroupByID(layerGroupID): boolean

Defined in: src/core/XViewer.ts:904

移除图层组

Parameters ​

layerGroupID ​

string

Returns ​

boolean


removeWindLayer() ​

removeWindLayer(): void

Defined in: src/core/XViewer.ts:1106

移除风图层

Returns ​

void


render() ​

render(): void

Defined in: node_modules/@cesium/engine/index.d.ts:44840

Renders the scene. This function is called automatically unless useDefaultRenderLoop is set to false;

Returns ​

void

Inherited from ​

Cesium.CesiumWidget.render


resize() ​

resize(): void

Defined in: node_modules/@cesium/engine/index.d.ts:44835

Updates the canvas size, camera aspect ratio, and viewport size. This function is called automatically as needed unless useDefaultRenderLoop is set to false.

Returns ​

void

Inherited from ​

Cesium.CesiumWidget.resize


setBasicLayer() ​

setBasicLayer(basicID, layerOptions, providerOptions?): void

Defined in: src/core/XViewer.ts:703

切换底图

Parameters ​

basicID ​

string = EnumBasicLayerID.Single

底图标识

layerOptions ​

ConstructorOptions = {}

providerOptions? ​

any

Returns ​

void


setOptions() ​

setOptions(options): XViewer

Defined in: src/core/XViewer.ts:655

Sets viewer options

Parameters ​

options ​

any

Returns ​

XViewer


setPitchRange() ​

setPitchRange(min, max): XViewer

Defined in: src/core/XViewer.ts:666

Sets camera pitch range

Parameters ​

min ​

number = -90

max ​

number = -20

Returns ​

XViewer


setTerrain() ​

setTerrain(terrain?): XViewer

Defined in: src/core/XViewer.ts:689

切换三维地形

Parameters ​

terrain? ​

Promise<TerrainProvider>

可空,默认为Promise.resolve(new Cesium.EllipsoidTerrainProvider())

Returns ​

XViewer


showErrorPanel() ​

showErrorPanel(title, message?, error?): void

Defined in: node_modules/@cesium/engine/index.d.ts:44820

Show an error panel to the user containing a title and a longer error message, which can be dismissed using an OK button. This panel is displayed automatically when a render loop error occurs, if showRenderLoopErrors was not false when the widget was constructed.

Parameters ​

title ​

string

The title to be displayed on the error panel. This string is interpreted as text.

message? ​

string

A helpful, user-facing message to display prior to the detailed error information. This string is interpreted as HTML.

error? ​

string

The error to be displayed on the error panel. This string is formatted using formatError and then displayed as text.

Returns ​

void

Inherited from ​

Cesium.CesiumWidget.showErrorPanel


ViewToChina() ​

ViewToChina(): XViewer

Defined in: src/core/XViewer.ts:432

初始视野范围为中国

Returns ​

XViewer


zoomIn() ​

zoomIn(): void

Defined in: src/core/XViewer.ts:1266

放大一级

Returns ​

void


zoomOut() ​

zoomOut(): void

Defined in: src/core/XViewer.ts:1273

缩小一级

Returns ​

void


zoomTo() ​

zoomTo(target, offset?): Promise<boolean>

Defined in: node_modules/@cesium/engine/index.d.ts:44859

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.

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.

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.

Parameters ​

target ​

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.

Entity | EntityCollection | DataSource | Entity[] | Cesium3DTileset | ImageryLayer | TimeDynamicPointCloud | Promise<Entity | EntityCollection | DataSource | Entity[] | Cesium3DTileset | ImageryLayer | TimeDynamicPointCloud | VoxelPrimitive>

offset? ​

HeadingPitchRange

The offset from the center of the entity in the local east-north-up reference frame.

Returns ​

Promise<boolean>

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.

Inherited from ​

Cesium.CesiumWidget.zoomTo


zoomToBounds() ​

zoomToBounds(bounds, param1, completeCallback?): XViewer

Defined in: src/core/XViewer.ts:618

缩放到某一范围

Parameters ​

bounds ​

string | number[]

param1 ​
heading? ​

number = 0

pitch? ​

number = 0

roll? ​

number = 0

completeCallback? ​

FlightCompleteCallback

Returns ​

XViewer


zoomToPosition() ​

zoomToPosition(position, completeCallback?): XViewer

Defined in: src/core/XViewer.ts:557

相机缩放到某个位置

Parameters ​

position ​

string | number[] | Cartesian3 | Cartographic | Position | { lat: any; lng: any; }

completeCallback? ​

FlightCompleteCallback

Returns ​

XViewer