浏览代码

fix: 修复 center.js 文件的 center 方法高程计算错误的BUG

tags/3.0.1
shenweiqun 2 年前
父节点
当前提交
61abd9df1d
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6
    1
      src/modules/math/center.js

+ 6
- 1
src/modules/math/center.js 查看文件



export default function center(positions) { export default function center(positions) {
if (positions && Array.isArray(positions)) { if (positions && Array.isArray(positions)) {
let heightMax = 0 // 位置最高的点的高度
positions.forEach(({ alt }) => (heightMax = Math.max(heightMax, alt)))

let boundingSphere = Cesium.BoundingSphere.fromPoints( let boundingSphere = Cesium.BoundingSphere.fromPoints(
Transform.transformWGS84ArrayToCartesianArray(positions) Transform.transformWGS84ArrayToCartesianArray(positions)
) )
return Transform.transformCartesianToWGS84(boundingSphere.center)
const position = Transform.transformCartesianToWGS84(boundingSphere.center)
position.alt = heightMax
return position
} }


return new Position() return new Position()

正在加载...
取消
保存