|
|
|
@@ -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() |