Browse Source

完善 Position 以便支持各类类型的位置信息

tags/1.13.2
Caven Chen 4 years ago
parent
commit
c9578a3cab
1 changed files with 7 additions and 9 deletions
  1. 7
    9
      src/core/position/Position.js

+ 7
- 9
src/core/position/Position.js View File

@@ -9,12 +9,12 @@ const { Cesium } = DC.Namespace

class Position {
constructor(lng, lat, alt, heading, pitch, roll) {
this._lng = lng || 0
this._lat = lat || 0
this._alt = alt || 0
this._heading = heading || 0
this._pitch = pitch || 0
this._roll = roll || 0
this._lng = +lng || 0
this._lat = +lat || 0
this._alt = +alt || 0
this._heading = +heading || 0
this._pitch = +pitch || 0
this._roll = +roll || 0
}

set lng(lng) {
@@ -195,9 +195,7 @@ class Position {
static fromCoordArray(arr) {
let position = new Position()
if (Array.isArray(arr)) {
position.lng = arr[0] || 0
position.lat = arr[1] || 0
position.alt = arr[2] || 0
position = this.fromArray(arr)
}
return position
}

Loading…
Cancel
Save