| ) | ) | ||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get currentDistance() { | |||||
| return distance(Parse.parsePositions(this._pathPositions)) | |||||
| } | |||||
| get currentPosition() { | |||||
| const [pos] = this._pathPositions.slice(-1) | |||||
| return Parse.parsePosition(pos) | |||||
| } | |||||
| get allDistance() { | |||||
| return distance(this._positions) | |||||
| } | |||||
| get trackId() { | get trackId() { | ||||
| return this._id | return this._id | ||||
| this._positionIndex + 1 === this._positions.length | this._positionIndex + 1 === this._positions.length | ||||
| ) | ) | ||||
| this._positionIndex++ | this._positionIndex++ | ||||
| // 无限循环 | |||||
| if ( | |||||
| this._options.loop && | |||||
| this._positionIndex === this._positions.length | |||||
| ) { | |||||
| this._restart() | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| this._setCameraView(viewer, viewOption) | this._setCameraView(viewer, viewOption) | ||||
| } | } | ||||
| /** | |||||
| * 重头开始播放动画 | |||||
| */ | |||||
| _restart() { | |||||
| this._startTime = Cesium.JulianDate.now() | |||||
| this._resetTimeLine({}) | |||||
| } | |||||
| /** | /** | ||||
| * Sets camera position | * Sets camera position | ||||
| * @param viewer | * @param viewer |
| this._activedTrack && (this._activedTrack.viewed = false) | this._activedTrack && (this._activedTrack.viewed = false) | ||||
| this._activedTrack = undefined | this._activedTrack = undefined | ||||
| this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this) | this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this) | ||||
| this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY) | |||||
| this._viewer.delegate.trackedEntity = undefined | |||||
| return this | return this | ||||
| } | } | ||||
| } | } |
| getValue(time, result) { | getValue(time, result) { | ||||
| result = Cesium.defaultValue(result, {}) | result = Cesium.defaultValue(result, {}) | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| getValue(time, result) { | getValue(time, result) { | ||||
| result = Cesium.defaultValue(result, {}) | result = Cesium.defaultValue(result, {}) | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result = {} | result = {} | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result = {} | result = {} | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result = {} | result = {} | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result = {} | result = {} | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| getValue(time, result) { | getValue(time, result) { | ||||
| result = Cesium.defaultValue(result, {}) | result = Cesium.defaultValue(result, {}) | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result = {} | result = {} | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.count = this.count | |||||
| result.gradient = this.gradient | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| result.count = Cesium.Property.getValueOrUndefined(this._count, time) | |||||
| result.gradient = Cesium.Property.getValueOrUndefined(this._gradient, time) | |||||
| return result | return result | ||||
| } | } | ||||
| getValue(time, result) { | getValue(time, result) { | ||||
| result = Cesium.defaultValue(result, {}) | result = Cesium.defaultValue(result, {}) | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| getValue(time, result) { | getValue(time, result) { | ||||
| result = Cesium.defaultValue(result, {}) | result = Cesium.defaultValue(result, {}) | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result = {} | result = {} | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result = {} | result = {} | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.percent = this._percent | |||||
| result.gradient = this._gradient | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| result.percent = Cesium.Property.getValueOrUndefined(this._percent, time) | |||||
| result.gradient = Cesium.Property.getValueOrUndefined(this._gradient, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | result.image = Cesium.Property.getValueOrUndefined(this._image, time) | ||||
| result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | result.image = Cesium.Property.getValueOrUndefined(this._image, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| getValue(time, result) { | getValue(time, result) { | ||||
| result = Cesium.defaultValue(result, {}) | result = Cesium.defaultValue(result, {}) | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| getValue(time, result) { | getValue(time, result) { | ||||
| result = Cesium.defaultValue(result, {}) | result = Cesium.defaultValue(result, {}) | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| getValue(time, result) { | getValue(time, result) { | ||||
| result = Cesium.defaultValue(result, {}) | result = Cesium.defaultValue(result, {}) | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | result.image = Cesium.Property.getValueOrUndefined(this._image, time) | ||||
| result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | result.image = Cesium.Property.getValueOrUndefined(this._image, time) | ||||
| result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| } | } | ||||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | result.color = Cesium.Property.getValueOrUndefined(this._color, time) | ||||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | result.image = Cesium.Property.getValueOrUndefined(this._image, time) | ||||
| result.speed = this._speed | |||||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||||
| return result | return result | ||||
| } | } | ||||
| import { Cesium } from '../../namespace' | import { Cesium } from '../../namespace' | ||||
| export default function midCartesian(start, end) { | export default function midCartesian(start, end) { | ||||
| let c1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(start) | |||||
| let c2 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(end) | |||||
| let cm = new Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5) | |||||
| return Cesium.Ellipsoid.WGS84.cartographicToCartesian(cm) | |||||
| return Cesium.Cartesian3.midpoint(start, end, new Cesium.Cartesian3()) | |||||
| } | } |
| ...this._style, | ...this._style, | ||||
| hierarchy: new Cesium.CallbackProperty(() => { | hierarchy: new Cesium.CallbackProperty(() => { | ||||
| if (this._positions.length > 2) { | if (this._positions.length > 2) { | ||||
| return new Cesium.PolygonHierarchy(this._positions) | |||||
| return new Cesium.PolygonHierarchy( | |||||
| this._positions.map((item) => item.clone()) | |||||
| ) | |||||
| } else { | } else { | ||||
| return null | return null | ||||
| } | } |
| */ | */ | ||||
| start(measure, options) { | start(measure, options) { | ||||
| this._startHook(measure, options) | this._startHook(measure, options) | ||||
| this._startLabel.label.heightReference = | |||||
| Cesium.HeightReference.CLAMP_TO_GROUND | |||||
| this._resultLabel.label.heightReference = | |||||
| Cesium.HeightReference.CLAMP_TO_GROUND | |||||
| new DrawPolyline({ | new DrawPolyline({ | ||||
| material: options.material || Cesium.Color.YELLOW.withAlpha(0.6), | material: options.material || Cesium.Color.YELLOW.withAlpha(0.6), | ||||
| depthFailMaterial: | depthFailMaterial: |