From 41d6d603ed9a59aea02385aed30e6aa2aabf1840 Mon Sep 17 00:00:00 2001
From: GULIMMO <2820890765@qq.com>
Date: Thu, 16 Nov 2023 16:33:52 +0800
Subject: [PATCH] 目标点连线

---
 src/components/g-map/DroneControlPanel.vue |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue
index 51159b7..7747c6d 100644
--- a/src/components/g-map/DroneControlPanel.vue
+++ b/src/components/g-map/DroneControlPanel.vue
@@ -525,8 +525,10 @@
 
   flyByArea(sn, dockPoint, jsonPath, radius, deviceSn, payloadIndex).then(res => {
     const targetPoint = res.data
+    console.log('targetPoint====', targetPoint)
     // 获取到点之后在图上绘点
     targetPoint.forEach((point, index) => {
+      console.log(point)
       const setting = {
         longitude: point.lon,
         latitude: point.lat,
@@ -546,8 +548,49 @@
         },
         id: 'target' + index,
       }
-
       cesiumFunc.addPoint(setting)
+      // 根据点画连线
+      let polylineSetting = {}
+      if (index === (targetPoint.length - 1)) {
+        polylineSetting = {
+          polyline: {
+            positions: Cesium.Cartesian3.fromDegreesArrayHeights([
+              point.lon,
+              point.lat,
+              0,
+              targetPoint[0].lon,
+              targetPoint[0].lat,
+              0
+            ]),
+            width: 10,
+            arcType: Cesium.ArcType.NONE,
+            material: new Cesium.PolylineArrowMaterialProperty(
+              Cesium.Color.RED
+            ),
+          },
+          id: 'fxTarget' + index
+        }
+      } else {
+        polylineSetting = {
+          polyline: {
+            positions: Cesium.Cartesian3.fromDegreesArrayHeights([
+              point.lon,
+              point.lat,
+              0,
+              targetPoint[index + 1].lon,
+              targetPoint[index + 1].lat,
+              0
+            ]),
+            width: 10,
+            arcType: Cesium.ArcType.NONE,
+            material: new Cesium.PolylineArrowMaterialProperty(
+              Cesium.Color.RED
+            ),
+          },
+          id: 'fxTarget' + index
+        }
+      }
+      cesiumFunc.addPolyline(polylineSetting)
     })
   })
 }

--
Gitblit v1.9.3