From e5ca2970563ad110170747735a3a7c7b11e9f519 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Wed, 15 Nov 2023 17:03:54 +0800
Subject: [PATCH] 显示目标点

---
 src/components/GMap.vue                    |    3 +++
 src/api/wayline.ts                         |    4 ++--
 src/pages/page-web/projects/tsa.vue        |    1 -
 src/components/g-map/DroneControlPanel.vue |   36 +++++++++++++++++++++++++++++++++---
 4 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/src/api/wayline.ts b/src/api/wayline.ts
index 09ea683..0a4c80f 100644
--- a/src/api/wayline.ts
+++ b/src/api/wayline.ts
@@ -221,9 +221,9 @@
   distance?:number
 }
 
-export const flyByArea = async function (sn:string,dockPoint:Point,jsonPath:any,radius:number,deviceSn:string): Promise<IWorkspaceResponse<any>> {
+export const flyByArea = async function (sn:string,dockPoint:Point,jsonPath:any,radius:number,deviceSn:string,payloadIndex:string): Promise<IWorkspaceResponse<any>> {
   const url = `${HTTP_PREFIX}/workspaces/${sn}/jobs/${deviceSn}/flyByArea`
-  const result = await request.post(url,{dockPoint:dockPoint,jsonPath:jsonPath,radius:radius})
+  const result = await request.post(url,{dockPoint:dockPoint,jsonPath:jsonPath,radius:radius,payloadIndex:payloadIndex})
   return result.data
 }
 
diff --git a/src/components/GMap.vue b/src/components/GMap.vue
index c398f0d..9ca136d 100644
--- a/src/components/GMap.vue
+++ b/src/components/GMap.vue
@@ -1251,6 +1251,9 @@
       }
       cesium.addEllipse(ellipseSetting)
       cesium.flyTo(ellipseSetting, 5, 20000)
+
+      // 加载图斑
+      cesium.loadGeoJson('../src/assets/jsonData/jkj(1).json')
     })
 
     function draw (type: MapDoodleType, bool: boolean) {
diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue
index 5fdf36e..51159b7 100644
--- a/src/components/g-map/DroneControlPanel.vue
+++ b/src/components/g-map/DroneControlPanel.vue
@@ -319,13 +319,16 @@
 import { useDockControl } from './use-dock-control'
 import { flyByArea, Point } from '/@/api/wayline'
 import { parseJsonFile } from '/@/utils/geo-utils'
-
+import { cesiumOperation } from '/@/hooks/use-cesium-tsa'
+import * as Cesium from 'cesium'
 const props = defineProps<{
     sn: string,
     deviceInfo: DeviceInfoType,
     payloads: null | PayloadInfo[],
     modelValue: Boolean,
 }>()
+
+const cesiumFunc = cesiumOperation()
 
 const store = useMyStore()
 const clientId = computed(() => {
@@ -499,6 +502,9 @@
   const deviceSn = props.deviceInfo.dock.basic_osd.sub_device?.device_sn
   const jsonPath = 'src/main/resources/jkj(1).json'
   const sn = props.sn
+
+  console.log(payloadSelectInfo, '-------------')
+  const payloadIndex = payloadSelectInfo.payloadIndex
   // const jsonData = await parseJsonFile('../src/assets/jsonData/jkj(1).json')
 
   // const features = jsonData.features
@@ -517,8 +523,32 @@
   //   list.push(areaList)
   // })
 
-  flyByArea(sn, dockPoint, jsonPath, radius, deviceSn).then(res => {
-    console.log(res, '----------------')
+  flyByArea(sn, dockPoint, jsonPath, radius, deviceSn, payloadIndex).then(res => {
+    const targetPoint = res.data
+    // 获取到点之后在图上绘点
+    targetPoint.forEach((point, index) => {
+      const setting = {
+        longitude: point.lon,
+        latitude: point.lat,
+        point: {
+          pixelSize: 8,
+          outlineWidth: 2,
+          color: Cesium.Color.RED,
+          outlineColor: Cesium.Color.BLACK,
+        },
+        label: {
+          text: '位置' + (index + 1),
+          outlineWidth: 20,
+          font: '14px sans-serif',
+          heightReference: 80,
+          pixelOffset: new Cesium.Cartesian2(0, -35),
+          fillColor: Cesium.Color.BLACK
+        },
+        id: 'target' + index,
+      }
+
+      cesiumFunc.addPoint(setting)
+    })
   })
 }
 
diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index a162a80..4f52479 100644
--- a/src/pages/page-web/projects/tsa.vue
+++ b/src/pages/page-web/projects/tsa.vue
@@ -420,7 +420,6 @@
     cesium.addPoint(setting)
     // cesium.flyTo(setting)
   }
-  cesium.loadGeoJson('../src/assets/jsonData/jkj(1).json')
 }, {
   deep: true,
 })

--
Gitblit v1.9.3