From 17f7080566318474c2f8b16e4754a4da60d626b7 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Wed, 01 Nov 2023 00:26:54 +0800
Subject: [PATCH] 实时轨迹逻辑修改

---
 src/pages/page-web/projects/tsa.vue |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index 1206a08..e69b7af 100644
--- a/src/pages/page-web/projects/tsa.vue
+++ b/src/pages/page-web/projects/tsa.vue
@@ -351,19 +351,7 @@
         heading: data.deviceInfo[data.currentSn].attitude_head,
       }
       cesium.updateEntityPosition(data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude, 'drone_fly', orientation)
-      // 根据机场状态码判断是否实时更新轨迹航线
-      if (data.dockInfo[data.currentSn] && (data.dockInfo[data.currentSn].basic_osd.mode_code === 3 || data.dockInfo[data.currentSn].basic_osd.mode_code === 4 || data.dockInfo[data.currentSn].basic_osd.mode_code === 5)) {
-        console.log(data, '======', data.dockInfo[data.currentSn], '==========')
-        // 生成新的位置数组
-        const newPositions = Cesium.Cartesian3.fromDegreesArray([oldData.deviceInfo[data.currentSn].longitude, oldData.deviceInfo[data.currentSn].latitude, data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude])
-        previousPositions.value = previousPositions.value.concat(newPositions)
-        //  更新线段的位置
-        const drone_route = cesium.getEntityById('drone_route')
-        drone_route.polyline.positions = previousPositions.value
-      } else {
-        previousPositions.value = []
-        cesium.removeById('drone_route')
-      }
+      console.log(data, '======', data.dockInfo[data.currentSn], '==========')
     } else {
       // 无人机图标
       const setting = {
@@ -413,6 +401,21 @@
     cesium.addPoint(setting)
     // cesium.flyTo(setting)
   }
+  // 如果机场属性为3、4、5 则说明一定有无人机的信息数据
+  // 根据机场状态码判断是否实时更新轨迹航线
+  if (data.dockInfo[data.currentSn] && (data.dockInfo[data.currentSn].basic_osd.mode_code === 3 || data.dockInfo[data.currentSn].basic_osd.mode_code === 4 || data.dockInfo[data.currentSn].basic_osd.mode_code === 5)) {
+    // 生成新的位置数组
+    // oldData.deviceInfo[data.currentSn].longitude, oldData.deviceInfo[data.currentSn].latitude,
+    const newPositions = Cesium.Cartesian3.fromDegreesArray([data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude])
+    previousPositions.value = previousPositions.value.concat(newPositions)
+    //  更新线段的位置
+    const drone_route = cesium.getEntityById('drone_route')
+    drone_route.polyline.positions = previousPositions.value
+  } else {
+    // 清除实时轨迹
+    previousPositions.value = []
+    cesium.removeById('drone_route')
+  }
 }, {
   deep: true,
 })

--
Gitblit v1.9.3