-
+
\ No newline at end of file
diff --git a/src/views/demo/workmanagement/workplan/components/airPoint.vue b/src/views/demo/workmanagement/workplan/components/airPoint.vue
index 955c9b2..2cf5760 100644
--- a/src/views/demo/workmanagement/workplan/components/airPoint.vue
+++ b/src/views/demo/workmanagement/workplan/components/airPoint.vue
@@ -215,7 +215,7 @@ import {missionConfigOptions,folderConfigOptions} from '../waylineConfig/index.
const emits = defineEmits(["setFlyPoint","checkPoint","exitDraw"])
-const props = defineProps(["airPoints","airInfo","polygonAirForm"])
+const props = defineProps(["airPoints","airInfo","polygonAirForm","airRoute"])
const areaOptionsShow = ref(false);
const airInfo = ref({
@@ -276,7 +276,7 @@ const pointInfo = ref({
"executeHeight": 172.948656023051,
"waypointSpeed": 10,
"waypointHeadingParam": {
- "waypointHeadingMode": "followWayline",
+ "waypointHeadingMode": "followWayline", // 偏航角模式
"waypointHeadingAngle": 0,
"waypointPoiPoint": "0.000000,0.000000,0.000000",
"waypointHeadingAngleEnable": 0,
@@ -341,8 +341,17 @@ const pointInfo = ref({
"waypointWorkType": 0
})
+// 处理航点数据
const handlerPointInfo = ()=>{
+
+ if(props.airPoints?.length<=0){
+ message.warning("请添加航点!");
+ return null;
+ }
props.airPoints?.forEach((item,index)=>{
+
+ console.log("item123",item);
+
let point = {
"Point": {
"coordinates": item.lng+","+item.lat
@@ -352,7 +361,7 @@ const handlerPointInfo = ()=>{
"waypointSpeed": 10,
"waypointHeadingParam": {
"waypointHeadingMode": "followWayline", // 飞行器偏航角模式 :
- "waypointHeadingAngle": 0, // 飞行器偏航角 [-180, 180] 当且仅当“wpml:waypointHeadingMode”为“smoothTransition”时必需
+ "waypointHeadingAngle": item.aircraftHorizontalAngle, // 飞行器偏航角 [-180, 180] 当且仅当“wpml:waypointHeadingMode”为“smoothTransition”时必需
"waypointPoiPoint": "0.000000,0.000000,0.000000", // 兴趣点 仅当wpml:waypointHeadingMode为towardPOI时必需
"waypointHeadingAngleEnable": 0,
"waypointHeadingPathMode": "followBadArc", // 飞行器偏航角转动方向
@@ -408,18 +417,21 @@ const handlerPointInfo = ()=>{
}
]
},
- "waypointGimbalHeadingParam": { // 云台参数
- "waypointGimbalPitchAngle": 0, // 云台 垂直俯仰角参数 [-90, -30]
- "waypointGimbalYawAngle": 0 // 云台 水平偏航角度
+ "waypointGimbalHeadingParam": {
+ "waypointGimbalPitchAngle": item.cameraVerticalAngle, // 云台 垂直俯仰角参数 [-90, -30]
+ "waypointGimbalYawAngle": 0 // 云台 水平偏航角度
},
"isRisky": 0,
"waypointWorkType": 0
}
folder.value.Placemark.push(point);
})
+
+ return true;
+
}
-// waylines.json文件
+// waylines.json 数据
const waylinesJson = ref(
{
"kml": {
@@ -431,33 +443,30 @@ const waylinesJson = ref(
}
)
-// 退出绘制
-const backPage = ()=>{
- emits("exitDraw")
-}
+
// 保存航线
const saveAirLine = ()=>{
- handlerPointInfo();
+ let handlerResult = handlerPointInfo();
- const builder = new XMLBuilder();
+ if(handlerResult){
+ const builder = new XMLBuilder();
- let lineData = {...waylinesJson.value}
+ let lineData = {...waylinesJson.value}
- let obj = handlerPrefixWpml(lineData);
+ let obj = handlerPrefixWpml(lineData);
- let xmlString = builder.build(obj);
+ let xmlString = builder.build(obj);
- let xmlString2 = xmlString.replace(/<\/?\d+>/g, "")
+ let xmlString2 = xmlString.replace(/<\/?\d+>/g, "")
- let xmlString3 = xmlString2.replace("
",``)
+ let xmlString3 = xmlString2.replace("",``)
- console.log("xmlString3",xmlString3);
+ handlerCreateFile(xmlString3);
+ }
-return null;
- handlerCreateFile(xmlString3);
}
// 处理wmpl:前缀
@@ -489,7 +498,7 @@ const handlerPrefixWpml = (obj) => {
// 保存表单
const submitForm = ref({
"id": "",
- "airLineName": null,
+ "airLineName": props.airRoute.name,
"airLineType": "waypoint",
"uavId": "",
"flyToFirstPointMode": "",
@@ -505,38 +514,31 @@ const submitForm = ref({
"wpml": ""
})
-// 生成xml文件
+// 生成xml文件,创建航线
const handlerCreateFile =async (content)=>{
-
const blob = new Blob([content], { type: 'wmpl/plain' });
-
// 创建FormData对象用于上传
const formData = new FormData();
-
formData.append('xmlFile', blob);
-
-
let res = await uploadXmlFile(formData);
-
if(res){
-
submitForm.value.wpml = res.path;
-
let addAirLineRes =await addAirLine(submitForm.value);
-
if(addAirLineRes){
-
message.success("操作成功!");
backPage();
}else{
message.error("操作失败!");
}
-
}else{
message.error("操作失败!");
-
}
+}
+
+// 退出绘制
+const backPage = ()=>{
+ emits("exitDraw")
}
diff --git a/src/views/demo/workmanagement/workplan/components/airPointConfig.vue b/src/views/demo/workmanagement/workplan/components/airPointConfig.vue
index 55a56ce..7bf6f09 100644
--- a/src/views/demo/workmanagement/workplan/components/airPointConfig.vue
+++ b/src/views/demo/workmanagement/workplan/components/airPointConfig.vue
@@ -184,4 +184,18 @@ const config = ref({
::v-deep .ant-slider .ant-slider-rail{
background:#fff!important;
}
+
+
+::v-deep .ant-input-number-input{
+ background:#3c3c3c!important ;
+ border:0px solid #ccc!important;
+ border-top-left-radius: 3px !important;
+ border-bottom-left-radius: 3px !important;
+ color:#fff!important;
+}
+
+::v-deep .ant-input-number-input::placeholder{
+ color:rgba(255, 255, 255, 0.533)!important;
+}
+
\ No newline at end of file
diff --git a/src/views/demo/workmanagement/workplan/components/airPolygon.vue b/src/views/demo/workmanagement/workplan/components/airPolygon.vue
index edc1ca6..8b59ea7 100644
--- a/src/views/demo/workmanagement/workplan/components/airPolygon.vue
+++ b/src/views/demo/workmanagement/workplan/components/airPolygon.vue
@@ -1,14 +1,16 @@
@@ -205,10 +204,12 @@
import {ref,defineEmits,defineProps} from 'vue'
import { SaveOutlined,LeftOutlined } from '@ant-design/icons-vue';
import {missionConfigOptions,folderConfigOptions} from '../waylineConfig/index.ts';
-
+import {uploadXmlFile,addAirLine} from '@/api/sys/workplan';
+import { message } from 'ant-design-vue';
+import { XMLParser, XMLBuilder } from 'fast-xml-parser';
const emits = defineEmits(["setFlyPoint","exitDraw"])
-const props = defineProps(["airInfo","polygonAirForm"])
+const props = defineProps(["airInfo","polygonAirForm","airPoints","airRoute"])
const airInfo = ref({
area:0.0,
@@ -266,9 +267,331 @@ const folder = ref({
"distance": 410.047576904297,
"duration": 80.3239784240723,
"autoFlightSpeed": 10,
- "Placemark": []
+ "Placemark":[]
})
+// 航点详细信息
+const pointInfo = {
+ "Point": {
+ "coordinates": "118.295430406842,35.1352868743403" // 坐标
+ },
+ "index": 0, // 序号
+ "executeHeight": 167, // 高度
+ "waypointSpeed": 12.7125370218057, // 飞行速度
+ "waypointHeadingParam": { // 飞行器参数
+ "waypointHeadingMode": "followWayline", // 偏航角模式 和航线角度一致
+ "waypointHeadingAngle": -96.9990577342362,
+ "waypointPoiPoint": "0.000000,0.000000,0.000000",
+ "waypointHeadingAngleEnable": 1,
+ "waypointHeadingPathMode": "followBadArc",
+ "waypointHeadingPoiIndex": 0
+ },
+ "waypointTurnParam": {
+ "waypointTurnMode": "toPointAndStopWithDiscontinuityCurvature",
+ "waypointTurnDampingDist": 0
+ },
+ "useStraightLine": 1,
+ "actionGroup": [
+ {
+ "#text": "z",
+ "actionGroupId": 0,
+ "actionGroupStartIndex": 0,
+ "actionGroupEndIndex": 13,
+ "actionGroupMode": "sequence",
+ "actionTrigger": {
+ "actionTriggerType": "betweenAdjacentPoints"
+ },
+ "action": [
+ {
+ "actionId": 0,
+ "actionActuatorFunc": "gimbalAngleLock"
+ },
+ {
+ "actionId": 1,
+ "actionActuatorFunc": "gimbalRotate",
+ "actionActuatorFuncParam": {
+ "gimbalHeadingYawBase": "aircraft",
+ "gimbalRotateMode": "absoluteAngle",
+ "gimbalPitchRotateEnable": 1,
+ "gimbalPitchRotateAngle": -90,
+ "gimbalRollRotateEnable": 0,
+ "gimbalRollRotateAngle": 0,
+ "gimbalYawRotateEnable": 0,
+ "gimbalYawRotateAngle": 0,
+ "gimbalRotateTimeEnable": 0,
+ "gimbalRotateTime": 10,
+ "payloadPositionIndex": 0
+ }
+ },
+ {
+ "actionId": 2,
+ "actionActuatorFunc": "startTimeLapse",
+ "actionActuatorFuncParam": {
+ "payloadPositionIndex": 0,
+ "useGlobalPayloadLensIndex": 0,
+ "payloadLensIndex": "visable",
+ "minShootInterval": 1.52472746372223
+ }
+ }
+ ]
+ },
+ {
+ "actionGroupId": 1,
+ "actionGroupStartIndex": 0,
+ "actionGroupEndIndex": 13,
+ "actionGroupMode": "sequence",
+ "actionTrigger": {
+ "actionTriggerType": "multipleTiming",
+ "actionTriggerParam": 2
+ },
+ "action": {
+ "actionId": 0,
+ "actionActuatorFunc": "gimbalRotate",
+ "actionActuatorFuncParam": {
+ "gimbalHeadingYawBase": "aircraft",
+ "gimbalRotateMode": "absoluteAngle",
+ "gimbalPitchRotateEnable": 1,
+ "gimbalPitchRotateAngle": -90,
+ "gimbalRollRotateEnable": 0,
+ "gimbalRollRotateAngle": 0,
+ "gimbalYawRotateEnable": 0,
+ "gimbalYawRotateAngle": 0,
+ "gimbalRotateTimeEnable": 0,
+ "gimbalRotateTime": 10,
+ "payloadPositionIndex": 0
+ }
+ }
+ }
+ ],
+ "waypointGimbalHeadingParam": {
+ "waypointGimbalPitchAngle": 0,
+ "waypointGimbalYawAngle": 0
+ },
+ "isRisky": 0,
+ "waypointWorkType": 0
+}
+
+
+// 处理航点数据
+const handlerPointInfo = ()=>{
+
+ if(props.airPoints?.length<=0){
+ message.warning("请添加航点!");
+ return null;
+ }
+ props.airPoints?.forEach((item,index)=>{
+ let point = {
+ "Point": {
+ "coordinates": item.lng+","+item.lat // 坐标
+ },
+ "index": index, // 序号
+ "executeHeight": 167, // 高度
+ "waypointSpeed": 12.7125370218057, // 飞行速度
+ "waypointHeadingParam": { // 飞行器参数
+ "waypointHeadingMode": "followWayline", // 偏航角模式 和航线角度一致
+ "waypointHeadingAngle": -96.9990577342362,
+ "waypointPoiPoint": "0.000000,0.000000,0.000000",
+ "waypointHeadingAngleEnable": 1,
+ "waypointHeadingPathMode": "followBadArc",
+ "waypointHeadingPoiIndex": 0
+ },
+ "waypointTurnParam": {
+ "waypointTurnMode": "toPointAndStopWithDiscontinuityCurvature",
+ "waypointTurnDampingDist": 0
+ },
+ "useStraightLine": 1,
+ "actionGroup": [
+ {
+ "#text": "z",
+ "actionGroupId": 0,
+ "actionGroupStartIndex": 0,
+ "actionGroupEndIndex": 13,
+ "actionGroupMode": "sequence",
+ "actionTrigger": {
+ "actionTriggerType": "betweenAdjacentPoints"
+ },
+ "action": [
+ {
+ "actionId": 0,
+ "actionActuatorFunc": "gimbalAngleLock"
+ },
+ {
+ "actionId": 1,
+ "actionActuatorFunc": "gimbalRotate",
+ "actionActuatorFuncParam": {
+ "gimbalHeadingYawBase": "aircraft",
+ "gimbalRotateMode": "absoluteAngle",
+ "gimbalPitchRotateEnable": 1,
+ "gimbalPitchRotateAngle": -90,
+ "gimbalRollRotateEnable": 0,
+ "gimbalRollRotateAngle": 0,
+ "gimbalYawRotateEnable": 0,
+ "gimbalYawRotateAngle": 0,
+ "gimbalRotateTimeEnable": 0,
+ "gimbalRotateTime": 10,
+ "payloadPositionIndex": 0
+ }
+ },
+ {
+ "actionId": 2,
+ "actionActuatorFunc": "startTimeLapse",
+ "actionActuatorFuncParam": {
+ "payloadPositionIndex": 0,
+ "useGlobalPayloadLensIndex": 0,
+ "payloadLensIndex": "visable",
+ "minShootInterval": 1.52472746372223
+ }
+ }
+ ]
+ },
+ {
+ "actionGroupId": 1,
+ "actionGroupStartIndex": 0,
+ "actionGroupEndIndex": 13,
+ "actionGroupMode": "sequence",
+ "actionTrigger": {
+ "actionTriggerType": "multipleTiming",
+ "actionTriggerParam": 2
+ },
+ "action": {
+ "actionId": 0,
+ "actionActuatorFunc": "gimbalRotate",
+ "actionActuatorFuncParam": {
+ "gimbalHeadingYawBase": "aircraft",
+ "gimbalRotateMode": "absoluteAngle",
+ "gimbalPitchRotateEnable": 1,
+ "gimbalPitchRotateAngle": -90,
+ "gimbalRollRotateEnable": 0,
+ "gimbalRollRotateAngle": 0,
+ "gimbalYawRotateEnable": 0,
+ "gimbalYawRotateAngle": 0,
+ "gimbalRotateTimeEnable": 0,
+ "gimbalRotateTime": 10,
+ "payloadPositionIndex": 0
+ }
+ }
+ }
+ ],
+ "waypointGimbalHeadingParam": {
+ "waypointGimbalPitchAngle": 0,
+ "waypointGimbalYawAngle": 0
+ },
+ "isRisky": 0,
+ "waypointWorkType": 0
+ }
+
+ folder.value.Placemark?.push(point);
+ })
+
+ return true;
+
+}
+
+// waylines.json 数据
+const waylinesJson = ref(
+ {
+ "kml": {
+ "Document": {
+ "missionConfig":missionConfig.value,
+ "Folder":folder.value
+ }
+ }
+ }
+)
+
+
+
+// 保存航线
+const saveAirLine = ()=>{
+
+ let handlerResult = handlerPointInfo();
+
+ if(handlerResult){
+ const builder = new XMLBuilder();
+
+ let lineData = {...waylinesJson.value}
+
+ let obj = handlerPrefixWpml(lineData);
+
+ let xmlString = builder.build(obj);
+
+ let xmlString2 = xmlString.replace(/<\/?\d+>/g, "")
+
+ let xmlString3 = xmlString2.replace("