| @@ -67,6 +67,16 @@ class Track { | |||
| ) | |||
| 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() { | |||
| return this._id | |||
| @@ -217,12 +227,27 @@ class Track { | |||
| this._positionIndex + 1 === this._positions.length | |||
| ) | |||
| this._positionIndex++ | |||
| // 无限循环 | |||
| if ( | |||
| this._options.loop && | |||
| this._positionIndex === this._positions.length | |||
| ) { | |||
| this._restart() | |||
| } | |||
| } | |||
| } | |||
| } | |||
| this._setCameraView(viewer, viewOption) | |||
| } | |||
| /** | |||
| * 重头开始播放动画 | |||
| */ | |||
| _restart() { | |||
| this._startTime = Cesium.JulianDate.now() | |||
| this._resetTimeLine({}) | |||
| } | |||
| /** | |||
| * Sets camera position | |||
| * @param viewer | |||
| @@ -232,6 +232,8 @@ class TrackController { | |||
| this._activedTrack && (this._activedTrack.viewed = false) | |||
| this._activedTrack = undefined | |||
| this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this) | |||
| this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY) | |||
| this._viewer.delegate.trackedEntity = undefined | |||
| return this | |||
| } | |||
| } | |||
| @@ -17,7 +17,7 @@ class CircleBlurMaterialProperty extends MaterialProperty { | |||
| getValue(time, result) { | |||
| result = Cesium.defaultValue(result, {}) | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -17,7 +17,7 @@ class CircleDiffuseMaterialProperty extends MaterialProperty { | |||
| getValue(time, result) { | |||
| result = Cesium.defaultValue(result, {}) | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -19,7 +19,7 @@ class CircleFadeMaterialProperty extends MaterialProperty { | |||
| result = {} | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -19,7 +19,7 @@ class CirclePulseMaterialProperty extends MaterialProperty { | |||
| result = {} | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -19,7 +19,7 @@ class CircleScanMaterialProperty extends MaterialProperty { | |||
| result = {} | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -19,7 +19,7 @@ class CircleSpiralMaterialProperty extends MaterialProperty { | |||
| result = {} | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -17,7 +17,7 @@ class CircleVaryMaterialProperty extends MaterialProperty { | |||
| getValue(time, result) { | |||
| result = Cesium.defaultValue(result, {}) | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -29,9 +29,9 @@ class CircleWaveMaterialProperty extends MaterialProperty { | |||
| result = {} | |||
| } | |||
| 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 | |||
| } | |||
| @@ -17,7 +17,7 @@ class EllipsoidElectricMaterialProperty extends MaterialProperty { | |||
| getValue(time, result) { | |||
| result = Cesium.defaultValue(result, {}) | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -17,7 +17,7 @@ class EllipsoidTrailMaterialProperty extends MaterialProperty { | |||
| getValue(time, result) { | |||
| result = Cesium.defaultValue(result, {}) | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -19,7 +19,7 @@ class PolylineFlickerMaterialProperty extends MaterialProperty { | |||
| result = {} | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -25,9 +25,9 @@ class PolylineFlowMaterialProperty extends MaterialProperty { | |||
| result = {} | |||
| } | |||
| 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 | |||
| } | |||
| @@ -30,7 +30,7 @@ class PolylineImageTrailMaterialProperty extends MaterialProperty { | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | |||
| result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -24,7 +24,7 @@ class PolylineLightingTrailMaterialProperty extends MaterialProperty { | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -17,7 +17,7 @@ class RadarLineMaterialProperty extends MaterialProperty { | |||
| getValue(time, result) { | |||
| result = Cesium.defaultValue(result, {}) | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -17,7 +17,7 @@ class RadarSweepMaterialProperty extends MaterialProperty { | |||
| getValue(time, result) { | |||
| result = Cesium.defaultValue(result, {}) | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -17,7 +17,7 @@ class RadarWaveMaterialProperty extends MaterialProperty { | |||
| getValue(time, result) { | |||
| result = Cesium.defaultValue(result, {}) | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -28,7 +28,7 @@ class WallImageTrailMaterialProperty extends MaterialProperty { | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | |||
| result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -31,7 +31,7 @@ class WallLineTrailMaterialProperty extends MaterialProperty { | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | |||
| result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -24,7 +24,7 @@ class WallTrailMaterialProperty extends MaterialProperty { | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.image = Cesium.Property.getValueOrUndefined(this._image, time) | |||
| result.speed = this._speed | |||
| result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) | |||
| return result | |||
| } | |||
| @@ -5,8 +5,5 @@ | |||
| import { Cesium } from '../../namespace' | |||
| 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()) | |||
| } | |||
| @@ -22,7 +22,9 @@ class DrawPolygon extends Draw { | |||
| ...this._style, | |||
| hierarchy: new Cesium.CallbackProperty(() => { | |||
| if (this._positions.length > 2) { | |||
| return new Cesium.PolygonHierarchy(this._positions) | |||
| return new Cesium.PolygonHierarchy( | |||
| this._positions.map((item) => item.clone()) | |||
| ) | |||
| } else { | |||
| return null | |||
| } | |||
| @@ -108,10 +108,6 @@ class DistanceSurface extends MeasureBase { | |||
| */ | |||
| start(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({ | |||
| material: options.material || Cesium.Color.YELLOW.withAlpha(0.6), | |||
| depthFailMaterial: | |||