From 7d9fb50b4e444ba3afec098ad031e93b4e9ee9ee Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Wed, 29 Nov 2023 10:20:26 +0800
Subject: [PATCH] 航线库修改/api打包后可修改
---
src/components/g-map/DroneControlPanel.vue | 116 +++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 99 insertions(+), 17 deletions(-)
diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue
index ec3722b..dbd425d 100644
--- a/src/components/g-map/DroneControlPanel.vue
+++ b/src/components/g-map/DroneControlPanel.vue
@@ -319,13 +319,17 @@
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'
+import { start } from 'repl'
const props = defineProps<{
sn: string,
deviceInfo: DeviceInfoType,
payloads: null | PayloadInfo[],
modelValue: Boolean,
}>()
+
+const cesiumFunc = cesiumOperation()
const store = useMyStore()
const clientId = computed(() => {
@@ -497,26 +501,104 @@
lat: props.deviceInfo.dock.basic_osd.latitude
})
const deviceSn = props.deviceInfo.dock.basic_osd.sub_device?.device_sn
- const jsonData = await parseJsonFile('../src/assets/jsonData/图斑_FeaturesToJSON(1).json')
+ const jsonPath = 'src/main/resources/jkj(1).json'
const sn = props.sn
- const features = jsonData.features
- const list = []
- features.forEach(feature => {
- const areaList = []
- feature.geometry.coordinates[0].forEach(areaPoint => {
- console.log('areaPoint:', areaPoint)
- const point = {
- lon: areaPoint[0],
- lat: areaPoint[1]
+ console.log(payloadSelectInfo, '-------------')
+ const payloadIndex = payloadSelectInfo.payloadIndex
+ // const jsonData = await parseJsonFile('../src/assets/jsonData/jkj(1).json')
+
+ // const features = jsonData.features
+ // const list = []
+
+ // features.forEach(feature => {
+ // const areaList = []
+ // feature.geometry.coordinates[0].forEach(areaPoint => {
+ // console.log('areaPoint:', areaPoint)
+ // const point = {
+ // lon: areaPoint[0],
+ // lat: areaPoint[1]
+ // }
+ // areaList.push(point)
+ // })
+ // list.push(areaList)
+ // })
+
+ flyByArea(sn, dockPoint, jsonPath, radius, deviceSn, payloadIndex).then(res => {
+ const targetPoint = res.data || []
+ // 机场位置
+ const startPoint = {
+ lon: props.deviceInfo.dock.basic_osd.longitude,
+ lat: props.deviceInfo.dock.basic_osd.latitude
+ }
+ targetPoint.unshift(startPoint)
+ console.log('targetPoint====', targetPoint)
+ // 获取到点之后在图上绘点
+ targetPoint.forEach((point: { lon: number; lat: number }, index: number) => {
+ console.log(point)
+ 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,
}
- areaList.push(point)
+ 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)
})
- list.push(areaList)
- })
-
- flyByArea(sn, dockPoint, list, radius, deviceSn).then(res => {
- console.log(res, '----------------')
})
}
--
Gitblit v1.9.3