Browse Source

Merge pull request #156 from ShenWeiQun/master

fix: 修复 center.js 文件的 center 方法高程计算错误的BUG
tags/3.0.1
Caven Chen 2 years ago
parent
commit
7e0d03550e
No account linked to committer's email address
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      src/modules/math/center.js

+ 6
- 1
src/modules/math/center.js View File

@@ -8,10 +8,15 @@ import Position from '../position/Position'

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

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

return new Position()

Loading…
Cancel
Save