Constructor
# new Viewer(id, options)
场景类
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string
|
唯一id |
options |
object
|
场景参数,参考Cesium.Viewer |
Members
Methods
# addBaseLayer(baseLayer, options) → {Viewer}
设置基础图层
Parameters:
| Name | Type | Description |
|---|---|---|
baseLayer |
Cesium.ImageryLayer
|
图层 |
options |
Object
|
图层属性 |
- 当前对象
# addLayerGroup(layerGroup) → {Viewer}
添加图层组
Parameters:
| Name | Type | Description |
|---|---|---|
layerGroup |
Object
|
图层组 |
- 当前对象
# changeBaseLayer(index) → {Viewer}
切换图层
Parameters:
| Name | Type | Description |
|---|---|---|
index |
number
|
图层index |
- 当前对象
# changeSceneMode(sceneMode, duration) → {Viewer}
切换模式
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
sceneMode |
number
|
2(2d),3(3d),2.5(2.5d) |
|
duration |
number
|
0 | 切换时间 |
- 当前对象
# eachLayer(method, context) → {Viewer}
遍历图层
Parameters:
| Name | Type | Description |
|---|---|---|
method |
function
|
回调 |
context |
Context
|
上下文 |
- 当前对象
# flyTo(target, duration:-) → {Viewer}
飞向目标点
Parameters:
| Name | Type | Description |
|---|---|---|
target |
Object
|
飞向的目标点 |
duration:- |
Object
|
飞行参数 |
- 当前对象
# flyToBounds(bounds, completeCallback, duration) → {Viewer}
定位到一个四角坐标
Parameters:
| Name | Type | Description |
|---|---|---|
bounds |
Object
|
四角坐标 |
completeCallback |
function
|
定位完成回调 |
duration |
number
|
定位时间间隔 |
- 当前对象
# flyToPosition(position, completeCallback, duration) → {Viewer}
定位到坐标点上
Parameters:
| Name | Type | Description |
|---|---|---|
position |
Position
|
定位目标点 |
completeCallback |
function
|
定位完成回调 |
duration |
number
|
定位时间间隔 |
- 当前对象
# getImageryLayerInfo(windowPosition) → {Object}
获取射线拾取的信息
Parameters:
| Name | Type | Description |
|---|---|---|
windowPosition |
Cesium.Cartesian2
|
点击点的平面坐标 |
- 射线拾取信息
Object
# getLayer(id) → {Layer|undefined}
通过id获取图层
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string
|
图层id |
- 获取的图层或者undefined
Layer
|
undefined
# getLayerGroup(id) → {Object|undefined}
通过id获取图层组
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string
|
图层组id |
图层组
Object
|
undefined
# hasLayer(layer) → {boolean}
判断是否有指定图层
Parameters:
| Name | Type | Description |
|---|---|---|
layer |
Layer
|
指定图层 |
- 是否有指定图层
boolean
# off(type, callback, context) → {Viewer}
取消事件
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string
|
事件类型 |
callback |
function
|
事件回调 |
context |
Context
|
上下文 |
- 当前对象
# on(type, callback, context) → {Viewer}
事件
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string
|
事件类型 |
callback |
function
|
事件回调 |
context |
Context
|
上下文 |
- 当前对象
# once(type, callback, context) → {Viewer}
once事件
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string
|
事件类型 |
callback |
function
|
事件回调 |
context |
Context
|
上下文 |
- 当前对象
# reomveLayerGroup(layerGroup) → {Viewer}
移出图层组
Parameters:
| Name | Type | Description |
|---|---|---|
layerGroup |
Object
|
图层组 |
- 当前对象