From 16fcff23e254e02bd0b09624e8dc44b6097dc6f9 Mon Sep 17 00:00:00 2001
From: xieb <vip_xiaobin810@163.com>
Date: Thu, 16 Nov 2023 10:23:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/demo' into demo
---
src/components/GMap.vue | 3 +
src/assets/jsonData/jkj(1).json | 1
src/api/wayline.ts | 4 +-
src/pages/page-web/projects/tsa.vue | 1
src/components/g-map/DroneControlPanel.vue | 66 ++++++++++++++++++++++++--------
5 files changed, 55 insertions(+), 20 deletions(-)
diff --git a/src/api/wayline.ts b/src/api/wayline.ts
index 5036b8a..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,areaList: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,areaList:areaList,radius:radius})
+ const result = await request.post(url,{dockPoint:dockPoint,jsonPath:jsonPath,radius:radius,payloadIndex:payloadIndex})
return result.data
}
diff --git "a/src/assets/jsonData/jkj\0501\051.json" "b/src/assets/jsonData/jkj\0501\051.json"
new file mode 100644
index 0000000..7797f65
--- /dev/null
+++ "b/src/assets/jsonData/jkj\0501\051.json"
@@ -0,0 +1 @@
+{"type":"FeatureCollection","crs":{"type":"name","properties":{"name":"EPSG:4326"}},"features":[{"type":"Feature","id":0,"geometry":{"type":"Polygon","coordinates":[[[115.86646556494736,28.634450296554235],[115.86425430209033,28.635738328540754],[115.86455173471609,28.633120921432976],[115.86697714906381,28.633843533997606],[115.86646556494736,28.634450296554235]]]},"properties":{"FID":0,"Id":0}},{"type":"Feature","id":1,"geometry":{"type":"Polygon","coordinates":[[[115.86400669060504,28.620271391369386],[115.86002109341996,28.616202513049245],[115.86637425430604,28.614203765804177],[115.86591204400565,28.617200102075913],[115.86400669060504,28.620271391369386]]]},"properties":{"FID":1,"Id":0}},{"type":"Feature","id":2,"geometry":{"type":"Polygon","coordinates":[[[115.83936693345481,28.616199931733206],[115.84128848946852,28.616084360149614],[115.84093157031771,28.618154491224743],[115.83814760094094,28.618654178035968],[115.83936693345481,28.616199931733206]]]},"properties":{"FID":2,"Id":0}},{"type":"Feature","id":3,"geometry":{"type":"Polygon","coordinates":[[[115.76493801956997,28.690367528093361],[115.76654812497384,28.688124702651749],[115.77111669010515,28.688505416412738],[115.7695938350613,28.690980055858802],[115.76493801956997,28.690367528093361]]]},"properties":{"FID":3,"Id":0}}]}
\ No newline at end of file
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 ec3722b..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(() => {
@@ -497,26 +500,55 @@
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
+ // 获取到点之后在图上绘点
+ 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,
}
- areaList.push(point)
- })
- list.push(areaList)
- })
- flyByArea(sn, dockPoint, list, radius, deviceSn).then(res => {
- console.log(res, '----------------')
+ cesiumFunc.addPoint(setting)
+ })
})
}
diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index 646bbe5..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/图斑_FeaturesToJSON(1).json')
}, {
deep: true,
})
--
Gitblit v1.9.3