Quellcode durchsuchen

实现导入切换 更改干扰机制

xyh vor 1 Jahr
Ursprung
Commit
0bfd6d8e51
1 geänderte Dateien mit 44 neuen und 19 gelöschten Zeilen
  1. 44 19
      src/views/simulation/index.vue

+ 44 - 19
src/views/simulation/index.vue

@@ -165,6 +165,7 @@ export default {
   methods: {
     async getJson(row) {
       this.order = 1;
+      this.finish = false;
       this.messageList = [];
       this.nameIdList = [];
       this.satelliteRange = [];
@@ -178,6 +179,8 @@ export default {
       let fileInfoArr = JSON.parse(fileInfoStr);
       this.$data._viewer2D.entities.removeAll();
       this.$data._viewer3D.entities.removeAll();
+      // this.$data._viewer2D.clock.onTick.removeEventListener();
+      // this.$data._viewer3D.clock.onTick.removeEventListener();
       await axios
         .get("http://127.0.0.1:8084/admin/online/onlineOperation/downloadDatasource/main", {
           params: {
@@ -574,10 +577,38 @@ export default {
         color = 'Red'
         modelUrl = missileModel
         size = 100
-        this.missileList[name] = {
-          disturb: 20,
-          id: this.id
+        for(let i = 0;i < this.jsonData.redunit.length;i++)
+        {
+          if(name === this.jsonData.redunit[i].name){
+            let disturb = 10
+            for(let key in this.jsonData.redunit[i].components_json)
+            {
+              if(this.jsonData.redunit[i].components_json[key].method === '间接采样转发干扰')
+              {
+                disturb = disturb*2.0
+              }
+              if(this.jsonData.redunit[i].components_json[key].method === '噪声调频干扰')
+              {
+                disturb = disturb*1.5
+              }
+              if(this.jsonData.redunit[i].components_json[key].method === '噪声调幅干扰')
+              {
+                disturb = disturb*1.3
+              }
+              if(this.jsonData.redunit[i].components_json[key].method === '噪声直放干扰')
+              {
+                disturb = disturb*1.8
+              }
+             
+            }
+            
+            this.missileList[name] = {
+            disturb: disturb,
+            id: this.id
         }
+          }
+        }
+       
       }
       else if (type == 'blue') {
         color = 'Blue'
@@ -813,7 +844,7 @@ export default {
           currentTime,
           this.$data._viewer3D.clock.startTime
         ); // 获取从起始时间到当前时间的秒数
-        if (parseInt(elapsedTime) % stepTime === 0 && parseInt(elapsedTime) !== 0) {
+        if (parseInt(elapsedTime) % stepTime === 0 && parseInt(elapsedTime) !== 0 && this.$data._viewer3D.clock.shouldAnimate ) {
           // 当从起始时间到当前时间的秒数是 stepTime 的倍数时,发送请求
           this.requestDataAndUpdateModel3D(startTime, elapsedTime);
         }
@@ -969,11 +1000,7 @@ export default {
           for (let i = 0; i < this.nameIdList.length; i++) {
             if (this.thaadList[this.nameIdList[i].name] != null || this.thaadList[this.nameIdList[i].name] != undefined) {
               //查看在雷达原侦察范围内有几颗导弹
-              let missileNum = this.howManyMissile(this.$data._viewer2D, this.thaadList[this.nameIdList[i].name].id, this.nameIdList[i].name)
-              let health = 100.0
-              for (let j = 0; j < missileNum; j++) {
-                health = health * 0.8
-              }
+              let health = this.howManyMissile(this.$data._viewer2D, this.thaadList[this.nameIdList[i].name].id, this.nameIdList[i].name)
               if (this.thaadList[this.nameIdList[i].name].health != health) {
                 //修改健康值并修改范围
                 let mark = true
@@ -992,6 +1019,7 @@ export default {
             this.$data._viewer2D.clock.shouldAnimate = false;
             this.dialogVisible = true
             this.finish = true
+
           }
 
           //更新模型位置
@@ -1019,13 +1047,9 @@ export default {
           }
           for (let i = 0; i < this.nameIdList.length; i++) {
             if (this.thaadList[this.nameIdList[i].name] != null || this.thaadList[this.nameIdList[i].name] != undefined) {
-              //查看在雷达原侦察范围内有几颗导弹
-              let missileNum = this.howManyMissile(this.$data._viewer3D, this.thaadList[this.nameIdList[i].name].id, this.nameIdList[i].name)
-              let health = 100.0
-              //变化健康值
-              for (let j = 0; j < missileNum; j++) {
-                health = health * 0.8
-              }
+              //查看在雷达原侦察范围内有几颗导弹并变化健康值
+              let health = this.howManyMissile(this.$data._viewer3D, this.thaadList[this.nameIdList[i].name].id, this.nameIdList[i].name)
+              
               if (this.thaadList[this.nameIdList[i].name].health != health) {
                 //修改健康值并修改范围
                 let mark = true
@@ -1046,6 +1070,7 @@ export default {
             this.$data._viewer3D.clock.shouldAnimate = false;
             this.dialogVisible = true
             this.finish = true
+            this.$data._viewer3D.clock.onTick.removeEventListener();
           }
 
           //更新模型位置
@@ -1091,14 +1116,14 @@ export default {
     howManyMissile(viewer, id, name) {
       let radar = viewer.entities.getById(id)
       let radarPos = radar.position._value
-      let num = 0
+      let health = 100
       for (let key in this.missileList) {
         let missilePos = viewer.entities.getById(this.missileList[key].id).position._value
         if (this.Cesium.Cartesian3.distance(radarPos, missilePos) <= this.thaadList[name].range) {//距离小于range
-          num++
+          health = health * (100-this.missileList[key].disturb) * 0.01
         }
       }
-      return num;
+      return health;
     },
     //判断导弹是否被拦截
     judgeMissile(viewer, time) {