You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

center.js 573B

12345678910111213141516171819202122
  1. /*
  2. * @Author: Caven
  3. * @Date: 2020-04-24 14:43:39
  4. * @Last Modified by: Caven
  5. * @Last Modified time: 2020-05-15 08:58:38
  6. */
  7. import Transform from '../transform/Transform'
  8. import Position from '../position/Position'
  9. const { Cesium } = DC.Namespace
  10. export default function center(positions) {
  11. if (positions && Array.isArray(positions)) {
  12. let boundingSphere = Cesium.BoundingSphere.fromPoints(
  13. Transform.transformWGS84ArrayToCartesianArray(positions)
  14. )
  15. return Transform.transformCartesianToWGS84(boundingSphere.center)
  16. }
  17. return new Position()
  18. }