From 28de79b44655118b1deffb5c9a8b06ec2904905b Mon Sep 17 00:00:00 2001 From: suerprisePlus <15810472099@163.com> Date: 星期四, 13 六月 2024 17:38:24 +0800 Subject: [PATCH] 功能添加 --- src/assets/js/tool/palyTools.js | 174 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/assets/js/tool/palyTools.js b/src/assets/js/tool/palyTools.js index 8ddf1c0..69e11a4 100644 --- a/src/assets/js/tool/palyTools.js +++ b/src/assets/js/tool/palyTools.js @@ -1,87 +1,87 @@ -import configTool from "@/assets/js/tool/configTool"; -import store from "@/store"; -const palyTools = { - playIndex: 0, - isPlay: false, - data: null, - time: null, - depthTestAgainstTerrain: null, - Init(res) { - if (res.sourceType != "demoAnimation") return; - this.data = res.animationDatas; - this.playIndex = 0; - this.isPlay = true; - this.playStart(); - this.depthTestAgainstTerrain = Viewer.scene.globe.depthTestAgainstTerrain; - if (this.depthTestAgainstTerrain) { - Viewer.scene.globe.depthTestAgainstTerrain = false; - } - }, - stop() { - clearTimeout(this.time); - this.time = null; - this.playIndex = 0; - this.isPlay = false; - Viewer.scene.globe.depthTestAgainstTerrain = this.depthTestAgainstTerrain; - this.depthTestAgainstTerrain = null; - }, - playStart() { - if (this.playIndex > this.data.length - 1) { - this.stop(); - return; - } else if (!this.isPlay) { - return; - } - - let thisPlay = this.data[this.playIndex]; - - if (thisPlay.type === "浣嶇疆") { - let position = thisPlay.view; - Viewer.camera.flyTo({ - destination: Cesium.Cartesian3.fromDegrees( - position.lon, - position.lat, - position.height - ), - orientation: { - heading: Cesium.Math.toRadians(position.heading), - pitch: Cesium.Math.toRadians(position.pitch), - roll: 0, - }, - }); - } else if (thisPlay.type === "鎿嶄綔") { - let show; - if (thisPlay.actionType === "鏄剧ず瀵硅薄") { - show = true; - } else if (thisPlay.actionType === "闅愯棌瀵硅薄") { - show = false; - } - store.state.setAnimation = { - info: thisPlay.selectInfo, - show: show, - }; - } - let time = 0; - if (thisPlay.type === "浣嶇疆") { - time = 3; - } - if (thisPlay.time) { - this.timeOut(() => { - // 瀹氭椂 - this.playIndex++; - this.playStart(); - }, thisPlay.time + time); - } else { - this.timeOut(() => { - // 瀹氭椂 - this.playIndex++; - this.playStart(); - }, time); - } - }, - timeOut(callback, time) { - clearTimeout(this.time); - this.time = setTimeout(callback, time * 1000); - }, -}; -export default palyTools; +import configTool from "@/assets/js/tool/configTool"; +import store from "@/store"; +const palyTools = { + playIndex: 0, + isPlay: false, + data: null, + time: null, + depthTestAgainstTerrain: null, + Init(res) { + if (res.sourceType != "demoAnimation") return; + this.data = res.animationDatas; + this.playIndex = 0; + this.isPlay = true; + this.playStart(); + this.depthTestAgainstTerrain = Viewer.scene.globe.depthTestAgainstTerrain; + if (this.depthTestAgainstTerrain) { + Viewer.scene.globe.depthTestAgainstTerrain = false; + } + }, + stop() { + clearTimeout(this.time); + this.time = null; + this.playIndex = 0; + this.isPlay = false; + Viewer.scene.globe.depthTestAgainstTerrain = this.depthTestAgainstTerrain; + this.depthTestAgainstTerrain = null; + }, + playStart() { + if (this.playIndex > this.data.length - 1) { + this.stop(); + return; + } else if (!this.isPlay) { + return; + } + + let thisPlay = this.data[this.playIndex]; + + if (thisPlay.type === "浣嶇疆") { + let position = thisPlay.view; + Viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees( + position.lon, + position.lat, + position.height + ), + orientation: { + heading: Cesium.Math.toRadians(position.heading), + pitch: Cesium.Math.toRadians(position.pitch), + roll: 0, + }, + }); + } else if (thisPlay.type === "鎿嶄綔") { + let show; + if (thisPlay.actionType === "鏄剧ず瀵硅薄") { + show = true; + } else if (thisPlay.actionType === "闅愯棌瀵硅薄") { + show = false; + } + store.state.setAnimation = { + info: thisPlay.selectInfo, + show: show, + }; + } + let time = 0; + if (thisPlay.type === "浣嶇疆") { + time = 3; + } + if (thisPlay.time) { + this.timeOut(() => { + // 瀹氭椂 + this.playIndex++; + this.playStart(); + }, thisPlay.time + time); + } else { + this.timeOut(() => { + // 瀹氭椂 + this.playIndex++; + this.playStart(); + }, time); + } + }, + timeOut(callback, time) { + clearTimeout(this.time); + this.time = setTimeout(callback, time * 1000); + }, +}; +export default palyTools; -- Gitblit v1.9.3