Koishi před 1 týdnem
rodič
revize
06cf06f078

+ 9 - 4
src/components/timeControl/index.vue

@@ -61,6 +61,12 @@ export default {
         return "";
       },
     },
+    showControl: {
+      type: Boolean,
+      default: () => {
+        return false;
+      },
+    },
     viewer: {
       type: Object,
       default: () => {
@@ -153,7 +159,7 @@ export default {
 
   methods: {
     handleKeyDown(event) {
-      if (!this.isPlay && this.cv.scene.id) {
+      if (!this.isPlay && this.cv?.scene?.id) {
         let changeLayer = false;
         const scrollRange = this.sTimeRange[1] + 1 - (this.sTimeRange[0] + 1);
         if (event.key.toLowerCase() === "a") {
@@ -295,8 +301,7 @@ export default {
             this.percentage = p >= 100 ? 100 : p;
             this.switchMapLayer();
           },
-          // this.controlMode === "wind" ? 20000 : 2000
-          500
+          this.controlMode === "wind" ? 20000 : 2000
         );
       } else {
         clearInterval(this.progressTimmer);
@@ -403,7 +408,7 @@ export default {
         this.windLayer.destroy();
       }
 
-      if (this.controlMode) {
+      if (this.controlMode && this.showControl) {
         if (this.isPlay) {
           clearInterval(this.progressTimmer);
           this.progressTimmer = null;

+ 4 - 4
src/kLayer/index.js

@@ -898,10 +898,10 @@ var WindParticlesComputing = class {
     return result;
   }
   destroy() {
-    Object.values(this.windTextures).forEach((texture) => texture.destroy());
-    Object.values(this.particlesTextures).forEach((texture) => texture.destroy());
-    Object.values(this.primitives).forEach((primitive) => primitive.destroy());
-    this.frameRateMonitor.destroy();
+    Object.values(this.windTextures).forEach((texture) => texture && texture.destroy());
+    Object.values(this.particlesTextures).forEach((texture) => texture && texture.destroy());
+    Object.values(this.primitives).forEach((primitive) => primitive && primitive.destroy());
+    this.frameRateMonitor && this.frameRateMonitor.destroy();
   }
 };
 

+ 8 - 0
src/store/index.js

@@ -2,6 +2,7 @@ import { createStore } from 'vuex';
 
 // 默认状态
 const state = {
+  viewer: null,
   activeModel: {},
   modelList: [
     {
@@ -404,16 +405,23 @@ const mutations = {
   setActiveModel(state, newData) {
     state.activeModel = newData;
   },
+  setViewer(state, newData) {
+    state.viewer = newData;
+  },
 };
 
 const actions = {
   setActiveModel(context, newData) {
     context.commit("setActiveModel", newData);
   },
+  setViewer(context, newData) {
+    context.commit("setViewer", newData);
+  },
 };
 
 const getters = {
   topology: state => state.topology,
+  viewer: state => state.viewer,
 }
 
 export default createStore({

+ 44 - 11
src/views/cesium.vue

@@ -83,6 +83,8 @@
       ref="weatherView"
       :basicGeoJson="basicGeoJson"
       :showControl="showControl"
+      :modeType="controlMode"
+      :cesiumViewer="viewer"
       @coverOnChange="coverOnChange"
       @resetChangeWind="resetChangeWind"
       @resetChangeStation="resetChangeStation"
@@ -244,6 +246,7 @@ export default {
       controlMode: "",
       cityWeather: {},
       showControl: false,
+      adLayers: [],
     };
   },
 
@@ -292,25 +295,51 @@ export default {
       this.showAllStation(this.viewer, showStation);
     },
     coverOnChange(val) {
-      if(val.name === "回放") {
+      if (val.name === "回放") {
         this.showControl = !this.showControl;
+        clearInterval(this.cloudintervalId);
+        clearInterval(this.rainintervalId);
+        clearInterval(this.tempintervalId);
+        this.cloudintervalId = null;
+        this.rainintervalId = null;
+        this.tempintervalId = null;
+        if (this.windLayer) {
+          this.removeWindLayer();
+        }
+        if (this.cloudLayer || this.cloudImagesLayer.length > 0) {
+          this.removeCloudLayer();
+        }
+        if (this.rainLayer || this.rainImagesLayer.length > 0) {
+          this.removeRainLayer();
+        }
+        if (this.temperatureLayer || this.tempImagesLayer.length > 0) {
+          this.removeTemperatureLayer();
+        }
       } else if (val.name === "风场图") {
         this.controlMode = this.controlMode === "wind" ? "" : "wind";
-        this.switchWindLayer(val.check);
+        if (!this.showControl) {
+          this.switchWindLayer(val.check);
+        }
       } else if (val.name === "云层图") {
         this.controlMode = this.controlMode === "cloud" ? "" : "cloud";
-        this.switchCloudLayer(val.check);
+        if (!this.showControl) {
+          this.switchCloudLayer(val.check);
+        }
       } else if (val.name === "降雨图") {
         this.controlMode = this.controlMode === "rain" ? "" : "rain";
-        this.switchRainLayer(val.check);
+        if (!this.showControl) {
+          this.switchRainLayer(val.check);
+        }
       } else if (val.name === "温度图") {
         this.controlMode = this.controlMode === "temp" ? "" : "temp";
-        this.switchTemperatureLayerr(val.check);
+        if (!this.showControl) {
+          this.switchTemperatureLayerr(val.check);
+        }
       } else {
         ElMessage({
-          message: '暂无数据',
-          type: 'warning',
-        })
+          message: "暂无数据",
+          type: "warning",
+        });
       }
     },
     test() {
@@ -1086,7 +1115,6 @@ export default {
         },
         duration: 1.0,
         complete() {
-          // 为什么要加这个?因为破库地球没完全加载完成时如果执行了监听鼠标滑动事件会光速报错滑跪
           if (!that.loadDone) {
             that.initEventInputAction();
             that.loadDone = true;
@@ -1271,6 +1299,10 @@ export default {
       // 当前显示的图片索引
       let currentImageIndex = -1; // 初始为-1,表示没有图片显示
 
+      this.adLayers?.forEach((ele) => {
+        this.viewer.imageryLayers.remove(ele);
+      });
+
       // 创建所有图片图层并添加到Viewer,初始时全部隐藏
       await imageUrls.forEach((url) => {
         const provider = new Cesium.SingleTileImageryProvider({
@@ -1289,6 +1321,7 @@ export default {
         imageLayers.push(Layer);
         ImagesLayers.push(Layer);
       });
+      this.adLayers = imageLayers;
       function showNextImage() {
         // 隐藏当前图片
         if (currentImageIndex >= 0 && currentImageIndex < imageLayers.length) {
@@ -1305,8 +1338,8 @@ export default {
       }
 
       // 设置切换间隔(毫秒),例如每5秒切换一次
-      const intervalMs = 5000;
-      intervalId = setInterval(showNextImage, intervalMs);
+      // const intervalMs = 5000;
+      // intervalId = setInterval(showNextImage, intervalMs);
 
       // 初始显示第一张图片
       showNextImage();

+ 36 - 10
src/views/weatherComponents/weatherView.vue

@@ -103,7 +103,11 @@
     </aside> -->
     <div
       class="weatherMesAll animate__animated"
-      :class="showControl || showWeatherMessage ? 'animate__backOutLeft' : 'animate__backInLeft'"
+      :class="
+        showControl || showWeatherMessage
+          ? 'animate__backOutLeft'
+          : 'animate__backInLeft'
+      "
     >
       <!-- 按钮功能 -->
       <div class="btnms">
@@ -331,7 +335,11 @@
     <!-- 节能减排  -->
     <aside
       class="sidebar-left3 panel animate__animated"
-      :class="showControl || showWeatherMessage ? 'animate__backOutLeft' : 'animate__backInLeft'"
+      :class="
+        showControl || showWeatherMessage
+          ? 'animate__backOutLeft'
+          : 'animate__backInLeft'
+      "
     >
       <div class="model-bg">
         <div class="titles">
@@ -456,7 +464,11 @@
     <div class="bottom-bar">
       <div
         class="panel animate__animated"
-        :class="showControl || showWeatherMessage ? 'animate__backOutDown' : 'animate__backInUp'"
+        :class="
+          showControl || showWeatherMessage
+            ? 'animate__backOutDown'
+            : 'animate__backInUp'
+        "
       >
         <div class="ycTop">
           <span class="title"> 24小时预报&nbsp;(滚轮缩放图表预览区域) </span>
@@ -484,7 +496,7 @@
       </div>
       <div
         class="panel qxBox animate__animated"
-        :class="showControl ? 'animate__bounceInUp' : 'animate__bounceOutDown'"
+        :class="controlMode ? 'animate__bounceInUp' : 'animate__bounceOutDown'"
         :style="controlModeReady ? '' : 'bottom:-500px'"
       >
         <div class="ycTop">
@@ -505,8 +517,9 @@
         <div class="cBox">
           <timeControl
             class="timeControl"
-            :mode="controlMode"
-            :viewer="cesiumViewer"
+            :mode="mode"
+            :viewer="viewer"
+            :showControl="showControl"
           />
         </div>
       </div>
@@ -546,10 +559,12 @@ export default {
       type: Boolean,
       default: false,
     },
+
     currentHeight: {
       type: Number,
       default: 0,
     },
+
     cesiumViewer: {
       type: Object,
       default: () => {
@@ -558,10 +573,16 @@ export default {
         };
       },
     },
+
     showControl: {
       type: Boolean,
       default: false,
     },
+
+    modeType: {
+      type: String,
+      default: "",
+    },
   },
 
   computed: {
@@ -593,10 +614,15 @@ export default {
     showControl(val) {
       this.controlMode = val;
     },
+
+    modeType(val) {
+      this.mode = val;
+    },
   },
 
   data() {
     return {
+      mode: "",
       coverDatas: [
         {
           svg: `<svg viewBox="0 0 1024 1024" width="1.5em" height="1.5em">
@@ -606,7 +632,7 @@ export default {
           name: "回放",
           use: true,
           check: false,
-        }
+        },
       ],
       cover2Datas: [
         {
@@ -871,7 +897,7 @@ export default {
       dateRange: [],
       controlMode: false,
       controlModeReady: false,
-      showWeatherMessage: false
+      showWeatherMessage: false,
     };
   },
 
@@ -886,10 +912,10 @@ export default {
         );
         this.cityWeather.city = city.province;
         this.stationName = this.cityWeather.city;
-        console.log("2222==>>>", this.cityWeather);
       });
     }
     this.controlMode = this.showControl;
+    this.mode = this.modeType;
     setTimeout(() => {
       this.controlModeReady = true;
     }, 1000);
@@ -934,7 +960,7 @@ export default {
     coverOnChange(it, type) {
       if (it.use) {
         it.check = !it.check;
-        this.showWeatherMessage = it.check
+        this.showWeatherMessage = it.check;
         if (!type) {
           this.cover2Datas.forEach((iv) => {
             if (it.name !== iv.name) {