-
cancelFly()
-
取消相机飞行操作
-
dispose()
-
释放相机
-
flyTo(opts)
-
相机飞行至指定位置
Parameters:
| Name |
Type |
Description |
opts |
Object
|
Properties
| Name |
Type |
Argument |
Default |
Description |
target |
Tiles3DLayer
|
GltfLayer
|
DivLayer
|
Cartesian3
|
|
|
目标对象 |
orientation |
Object
|
<optional>
|
|
方向和向上属性或航向、俯仰和滚动属性
Properties
| Name |
Type |
Argument |
Description |
heading |
Number
|
<optional>
|
偏航角,单位:弧度 |
pitch |
Number
|
<optional>
|
俯仰角,单位:弧度 |
roll |
Number
|
<optional>
|
翻滚角,单位:弧度 |
|
duration |
Number
|
<optional>
|
|
飞行时间,单位:秒 |
distFactor |
Number
|
<optional>
|
1
|
距离因子 |
complete |
function
|
|
|
飞行完成后的回调, 默认undefined; |
|
-
flyToBoundingSphere(options)
-
相机飞行定位到包围球
Parameters:
| Name |
Type |
Argument |
Default |
Description |
options |
Object
|
|
|
Properties
| Name |
Type |
Argument |
Description |
center |
Array
|
<optional>
|
包围球中心点 |
radius |
Number
|
<optional>
|
包围球半径 |
|
opts.duration |
Number
|
<optional>
|
3
|
飞行时间,单位:秒 |
options.bbox |
Array
|
<optional>
|
|
包围盒(包围球参数同时存在,优先包围球定位) |
options.offset |
Object
|
<optional>
|
|
以目标为中心的局部东-北-上坐标系中,目标位置的偏移量。例如:{heading: 0, pitch: -90, range: 1000}
Properties
| Name |
Type |
Argument |
Description |
heading |
Number
|
<optional>
|
朝向角,单位:角度 |
pitch |
Number
|
<optional>
|
俯仰角,单位:角度 |
range |
Number
|
<optional>
|
距离,单位:米 |
|
-
getCameraInfo()
-
当前视角的信息获取
Returns:
相机信息,字段包含:lon, lat, height, x, y, z, heading, pitch, roll
-
Type
-
Object
-
getCaptureImg()
-
当前快照的获取
Returns:
快照的信息
-
Type
-
Image
-
getCurrentViewInfo()
-
当前视角拾取后的信息获取
Returns:
视角的信息{location,orientation,cartographic}
-
Type
-
Object
-
lookAt(target, offset)
-
使用目标和偏移设置相机位置和方向
Parameters:
| Name |
Type |
Description |
target |
Cartesian3
|
目标位置 |
offset |
Cartesian3
|
HeadingPitchRange
|
以目标为中心的本地东北上参考系中与目标的偏移 |
-
pickEllipsoid(cartesian2)
-
通过屏幕坐标拾取场景坐标,不包含地形和模型等场景空间坐标
Parameters:
| Name |
Type |
Description |
cartesian2 |
Cesium.Cartesian2
|
屏幕坐标 |
Returns:
椭球面笛卡尔坐标
-
Type
-
Cesium.Cartesian3
-
print()
-
打印相机信息
-
setView(options)
-
设置相机位置、方向
Parameters:
| Name |
Type |
Description |
options |
Object
|
具有以下属性的对象:
Properties
| Name |
Type |
Argument |
Description |
destination |
Cartesian3
|
Rectangle
|
<optional>
|
相机在 WGS84(世界)坐标中的最终位置,或从自上而下视图可见的矩形。 |
orientation |
Object
|
<optional>
|
包含方向和向上属性或航向、俯仰和滚动属性的对象。
Properties
| Name |
Type |
Argument |
Description |
heading |
Number
|
<optional>
|
偏航角。 |
pitch |
Number
|
<optional>
|
俯仰角。 |
roll |
Number
|
<optional>
|
翻滚角。 |
|
|
Example
// 1. 使用自顶向下视图设置位置
viewer.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0)
});
// 2 设置航向、俯仰和横滚视图
viewer.camera.setView({
destination : cartesianPosition,
orientation: {
heading : Cesium.Math.toRadians(90.0),
pitch : Cesium.Math.toRadians(-90),
roll : 0.0
}
});
// 3. 改变航向、俯仰和侧倾,相机位置保持不变
viewer.camera.setView({
orientation: {
heading : Cesium.Math.toRadians(90.0),
pitch : Cesium.Math.toRadians(-90),
roll : 0.0
}
});
// 4. 具有自顶向下视图的视图矩形
viewer.camera.setView({
destination : Cesium.Rectangle.fromDegrees(west, south, east, north)
});
-
startRotate(center, duration, clockWise, loop)
-
开启相机旋转功能
Parameters:
| Name |
Type |
Default |
Description |
center |
Cartographic
|
|
围绕地表指定点旋转,例:{longitude:120,latitude:26};默认:围绕地球中心旋转 |
duration |
Number
|
60
|
旋转一周所需时长,单位秒 |
clockWise |
Boolean
|
true
|
旋转方向,true代表顺时针,false代表逆时针,默认为顺时针方向 |
loop |
Boolean
|
true
|
是否循环,默认:true |
-
stopRotate()
-
停止相机旋转功能
-
zoomIn( [amount])
-
放大
Parameters:
| Name |
Type |
Argument |
Default |
Description |
amount |
Number
|
<optional>
|
1000
|
移动量. Defaults to defaultZoomAmount. |
-
zoomOut( [amount])
-
缩小
Parameters:
| Name |
Type |
Argument |
Default |
Description |
amount |
Number
|
<optional>
|
1000
|
移动量. Defaults to defaultZoomAmount. |