瀏覽代碼

add history-track state

tags/2.15.0
Caven Chen 3 年之前
父節點
當前提交
5988b0a1d7
共有 1 個檔案被更改,包括 12 行新增0 行删除
  1. 12
    0
      modules/history-track/TrackController.js

+ 12
- 0
modules/history-track/TrackController.js 查看文件



import { Cesium } from '@dc-modules/namespace' import { Cesium } from '@dc-modules/namespace'
import { SceneEventType, TrackEventType } from '@dc-modules/event' import { SceneEventType, TrackEventType } from '@dc-modules/event'
import State from '@dc-modules/state/State'
import TrackViewMode from './TrackViewMode' import TrackViewMode from './TrackViewMode'


class TrackController { class TrackController {
this._viewMode = undefined this._viewMode = undefined
this._viewOption = {} this._viewOption = {}
this._stopTime = undefined this._stopTime = undefined
this._state = State.INITIALIZED
} }


get delegate() { get delegate() {
return this._delegete.entities return this._delegete.entities
} }


get state() {
return this._state
}

/** /**
* @private * @private
*/ */
this._stopTime = undefined this._stopTime = undefined
this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this) this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this)
this._viewer.on(SceneEventType.POST_RENDER, this._onPostRender, this) this._viewer.on(SceneEventType.POST_RENDER, this._onPostRender, this)
this._state = State.PLAY
return this return this
} }


this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY) this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY)
this._viewer.delegate.trackedEntity = undefined this._viewer.delegate.trackedEntity = undefined
this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this) this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this)
this._state = State.PAUSE
return this return this
} }


* *
*/ */
restore() { restore() {
if (this._state !== State.PAUSE) {
return this
}
if (this._stopTime) { if (this._stopTime) {
let now = Cesium.JulianDate.now() let now = Cesium.JulianDate.now()
Object.keys(this._cache).forEach(key => { Object.keys(this._cache).forEach(key => {
} }
this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this) this._viewer.off(SceneEventType.POST_RENDER, this._onPostRender, this)
this._viewer.on(SceneEventType.POST_RENDER, this._onPostRender, this) this._viewer.on(SceneEventType.POST_RENDER, this._onPostRender, this)
this._state = State.PLAY
return this return this
} }



Loading…
取消
儲存