From aec00ecc093be803860c8675cbe1c4c776a7cb4e Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Tue, 19 Mar 2024 17:49:21 +0800
Subject: [PATCH] update: 新建航线、事件编辑、kmz文件问题修改
---
src/components/waylinetool/index.vue | 31 ++++++++++++++++++++++++++-----
1 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/components/waylinetool/index.vue b/src/components/waylinetool/index.vue
index b9be2f4..74e1c71 100644
--- a/src/components/waylinetool/index.vue
+++ b/src/components/waylinetool/index.vue
@@ -61,6 +61,8 @@
const store = useMyStore()
+const prefix = import.meta.env.VITE_MEDIAPANEL_API_URL
+
const getResource = (name: string) => {
return new URL(`/src/assets/icons/${name}`, import.meta.url).href
}
@@ -82,6 +84,7 @@
key: string,
icon: string,
title: string,
+ distinguish?: string,
param: popoverParamType[],
event: Function,
selected?: boolean
@@ -266,6 +269,7 @@
// 云台偏航角
{
key: 'gimbalRotate',
+ distinguish: 'yaw',
icon: getResource('waylinetool/holderyaw.png'),
title: '云台偏航角',
param: [
@@ -332,6 +336,7 @@
// 云台俯仰角
{
key: 'gimbalRotate',
+ distinguish: 'pitch',
icon: getResource('waylinetool/holdertilt.png'),
title: '云台俯仰角',
param: [
@@ -512,8 +517,7 @@
* @return {*} void
*/
const readKmzFile = (kmzPath: string) => {
- const [, address] = kmzPath.split('cloud-bucket')
- return axios.get(import.meta.env.VITE_MEDIAPANEL_API_URL + address, { responseType: 'arraybuffer' })
+ return axios.get(kmzPath, { responseType: 'arraybuffer' })
.then(fileRes => fileRes.data)
.then(kmzData => JsZip.loadAsync(kmzData)) // 解压kmz文件
.then(kmzZip => kmzZip)
@@ -548,14 +552,20 @@
const funcRegx = /<wpml:actionActuatorFunc>([\s\S]*?)<\/wpml:actionActuatorFunc>/g
const funcs = (points[currentPosition.value] || '').match(funcRegx)
const funcNameRegx = /<wpml:actionActuatorFunc>(.*?)<\/wpml:actionActuatorFunc>/
-
const shootTypeRegx = /<wpml:shootType>([\s\S]*?)<\/wpml:shootType>/g
const shootType = (points[currentPosition.value] || '').match(shootTypeRegx)
const shootTypeValueRegx = /<wpml:shootType>(.*?)<\/wpml:shootType>/
+
+ // 云台正则
+ const actionRegx = /<wpml:action>([\s\S]*?)<\/wpml:action>/g
+ const actions = (points[currentPosition.value] || '').match(actionRegx)
+ const gimbalPitchRotateAngleRegx = /<wpml:gimbalPitchRotateAngle>(.*?)<\/wpml:gimbalPitchRotateAngle>/
+ const gimbalYawRotateAngleRegx = /<wpml:gimbalYawRotateAngle>(.*?)<\/wpml:gimbalYawRotateAngle>/
+
btnList.value.forEach(sBtn => {
funcs?.forEach((func: string) => {
const funcName = func.match(funcNameRegx) || []
- if (funcName[1] === sBtn.key) {
+ if (funcName[1] === sBtn.key && !sBtn.distinguish) {
sBtn.selected = true
}
})
@@ -565,6 +575,17 @@
sBtn.selected = true
}
})
+ if (sBtn.distinguish) {
+ const action = actions?.find((action: string) => action.includes('<wpml:actionActuatorFunc>gimbalRotate</wpml:actionActuatorFunc>'))
+ const pitchAngle = action?.match(gimbalPitchRotateAngleRegx) || []
+ const yawAngle = action?.match(gimbalYawRotateAngleRegx) || []
+ if (!!Number(pitchAngle[1]) && sBtn.distinguish === 'pitch') {
+ sBtn.selected = true
+ }
+ if (!!Number(yawAngle[1]) && sBtn.distinguish === 'yaw') {
+ sBtn.selected = true
+ }
+ }
})
settingDefaultValue(content)
})
@@ -575,7 +596,7 @@
const regx = /<Placemark>([\s\S]*?)<\/Placemark>/g
const points = content.match(regx) || []
// 当前选中的点
- const currentPoint = points[currentPosition.value]
+ const currentPoint = points[currentPosition.value] || ''
const actionRegx = /<wpml:action>([\s\S]*?)<\/wpml:action>/g
const actionsKML = currentPoint.match(actionRegx)
btnList.value.forEach((sBtn: sBtn) => {
--
Gitblit v1.9.3