浏览代码

add flyToBounds and zoomToBounds

tags/2.15.0
Caven Chen 3 年前
父节点
当前提交
8511036315
共有 1 个文件被更改,包括 54 次插入0 次删除
  1. 54
    0
      modules/viewer/Viewer.js

+ 54
- 0
modules/viewer/Viewer.js 查看文件

return this return this
} }


/**
* Camera fly to bounds
* @param bounds
* @param heading
* @param pitch
* @param roll
* @param completeCallback
* @param duration
* @return {Viewer}
*/
flyToBounds(
bounds,
{ heading = 0, pitch = 0, roll = 0 },
completeCallback,
duration
) {
if (!bounds) {
return this
}
if (!Array.isArray(bounds)) {
bounds = bounds.split(',')
}
this.camera.flyTo({
destination: Cesium.Rectangle.fromDegrees(
bounds[0],
bounds[1],
bounds[2],
bounds[3]
),
orientation: {
heading: Cesium.Math.toRadians(heading),
pitch: Cesium.Math.toRadians(pitch),
roll: Cesium.Math.toRadians(roll)
},
complete: completeCallback,
duration: duration
})
return this
}

/**
*
* @param bounds
* @param heading
* @param pitch
* @param roll
* @param completeCallback
* @return {Viewer}
*/
zoomToBounds(bounds, { heading = 0, pitch = 0, roll = 0 }, completeCallback) {
this.flyToBounds(bounds, { heading, pitch, roll }, completeCallback)
return this
}

/** /**
* *
* @param type * @param type

正在加载...
取消
保存