|
|
|
@ -587,109 +587,109 @@ const handlerPointInfo = ()=>{
|
|
|
|
|
|
|
|
|
|
let placemarkArray = [];
|
|
|
|
|
|
|
|
|
|
props.airPoints?.forEach((item,index)=>{
|
|
|
|
|
let point = {
|
|
|
|
|
"Point": {
|
|
|
|
|
"coordinates": item.lng+","+item.lat // 坐标
|
|
|
|
|
},
|
|
|
|
|
"index": index, // 序号
|
|
|
|
|
"executeHeight": item.alt, // 高度
|
|
|
|
|
"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
|
|
|
|
|
}
|
|
|
|
|
placemarkArray.push(point);
|
|
|
|
|
});
|
|
|
|
|
props.waylineWpmlConfig.Folder.Placemark = placemarkArray;
|
|
|
|
|
// props.airPoints?.forEach((item,index)=>{
|
|
|
|
|
// let point = {
|
|
|
|
|
// "Point": {
|
|
|
|
|
// "coordinates": item.lng+","+item.lat // 坐标
|
|
|
|
|
// },
|
|
|
|
|
// "index": index, // 序号
|
|
|
|
|
// "executeHeight": item.alt, // 高度
|
|
|
|
|
// "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
|
|
|
|
|
// }
|
|
|
|
|
// placemarkArray.push(point);
|
|
|
|
|
// });
|
|
|
|
|
// props.waylineWpmlConfig.Folder.Placemark = placemarkArray;
|
|
|
|
|
// folder.value.Placemark = placemarkArray;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@ -725,7 +725,11 @@ const saveAirLine = ()=>{
|
|
|
|
|
// 将template中的 missionConfig 赋值 给wayline
|
|
|
|
|
props.waylineWpmlConfig.missionConfig = JSON.parse(JSON.stringify(props.templateKmlConfig.missionConfig))
|
|
|
|
|
|
|
|
|
|
const builder = new XMLBuilder();
|
|
|
|
|
const builder = new XMLBuilder({
|
|
|
|
|
format: true, // 启用换行和缩进
|
|
|
|
|
indentBy: " ", // 缩进字符(默认2空格,可自定义为 \t 等)
|
|
|
|
|
suppressEmptyNode: true, // 可选:是否忽略空节点
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 带wpml前缀的 template json数据
|
|
|
|
|
let templateJson = {kml:{Document:props.templateKmlConfig}}
|
|
|
|
@ -759,9 +763,11 @@ const handlerPrefixWpml = (obj) => {
|
|
|
|
|
|
|
|
|
|
const newAttrs = {};
|
|
|
|
|
|
|
|
|
|
for (const attrName in obj[key]) {
|
|
|
|
|
for (const attrName in obj[key] ) {
|
|
|
|
|
|
|
|
|
|
// 检查属性名是否首字母小写
|
|
|
|
|
if (/^[a-z]/.test(attrName)) {
|
|
|
|
|
if (/^[a-z]/.test(attrName) && attrName != 'outerBoundaryIs' && attrName != 'coordinates') {
|
|
|
|
|
console.log("attrName",attrName);
|
|
|
|
|
newAttrs[`wpml:${attrName}`] = obj[key][attrName];
|
|
|
|
|
} else {
|
|
|
|
|
newAttrs[attrName] = obj[key][attrName];
|
|
|
|
@ -835,15 +841,13 @@ const handlerCreateFile =async (templateXml,waylineXml)=>{
|
|
|
|
|
const convertXmlToKmz =async (templateXml,waylineXml)=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const zip = new JSZip();
|
|
|
|
|
|
|
|
|
|
// 1. 创建 "wmpz" 文件夹
|
|
|
|
|
const wmpzFolder = zip.folder("wpmz");
|
|
|
|
|
|
|
|
|
|
// 2. 向文件夹中添加文件
|
|
|
|
|
|
|
|
|
|
wmpzFolder.file("wayline.wpml", waylineXml);
|
|
|
|
|
wmpzFolder.file("waylines.wpml", waylineXml);
|
|
|
|
|
wmpzFolder.file("template.kml", templateXml);
|
|
|
|
|
|
|
|
|
|
// 3. 生成 KMZ (ZIP) 文件
|
|
|
|
@ -1001,7 +1005,6 @@ const handlerWaylineWpml = () => {
|
|
|
|
|
// 处理基础配置
|
|
|
|
|
props.waylineWpmlConfig.missionConfig = JSON.parse(JSON.stringify(props.templateKmlConfig.missionConfig));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处理统计数据
|
|
|
|
|
handlerStatistics();
|
|
|
|
|
|
|
|
|
@ -1012,18 +1015,15 @@ const handlerWaylineWpml = () => {
|
|
|
|
|
|
|
|
|
|
// 航线计算数据处理
|
|
|
|
|
const handlerStatistics = () => {
|
|
|
|
|
|
|
|
|
|
props.waylineWpmlConfig.Folder.distance = props.airInfo.length;
|
|
|
|
|
props.waylineWpmlConfig.Folder.duration = props.airInfo.time;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理航线数据
|
|
|
|
|
const handelrAirPoint = () => {
|
|
|
|
|
|
|
|
|
|
// alert(props.templateKmlConfig.Folder.autoFlightSpeed);
|
|
|
|
|
|
|
|
|
|
props.airPoints.forEach((item,index)=>{
|
|
|
|
|
|
|
|
|
|
let point = null;
|
|
|
|
|
|
|
|
|
|
// 根据高度模式 设置高度
|
|
|
|
@ -1032,7 +1032,14 @@ const handelrAirPoint = () => {
|
|
|
|
|
// 计算间隔时间
|
|
|
|
|
let spaceTime = (calculateInterval(calculatParam.value.gsd,calculatParam.value.overlapX/100,uavModel['m4td']) / props.templateKmlConfig.Folder.autoFlightSpeed)
|
|
|
|
|
|
|
|
|
|
// 起飞点高度
|
|
|
|
|
let heightArr = props.waylineWpmlConfig.missionConfig.takeOffRefPoint.split(",");
|
|
|
|
|
|
|
|
|
|
height = heightArr[2]
|
|
|
|
|
|
|
|
|
|
console.log("起飞点高度",height);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处理第1个航点
|
|
|
|
|
if(index == 0){
|
|
|
|
|
point = {
|
|
|
|
@ -1040,7 +1047,7 @@ const handelrAirPoint = () => {
|
|
|
|
|
"coordinates":item.lng+","+item.lat
|
|
|
|
|
},
|
|
|
|
|
"index": item.id,
|
|
|
|
|
"executeHeight": item.alt,
|
|
|
|
|
"executeHeight": item.alt - height,
|
|
|
|
|
"waypointSpeed": props.templateKmlConfig.Folder.autoFlightSpeed,
|
|
|
|
|
"waypointHeadingParam": {
|
|
|
|
|
"waypointHeadingMode": "followWayline",
|
|
|
|
@ -1139,7 +1146,7 @@ const handelrAirPoint = () => {
|
|
|
|
|
"coordinates":item.lng+","+item.lat
|
|
|
|
|
},
|
|
|
|
|
"index": item.id,
|
|
|
|
|
"executeHeight": item.alt,
|
|
|
|
|
"executeHeight": item.alt - height,
|
|
|
|
|
"waypointSpeed": props.templateKmlConfig.Folder.autoFlightSpeed,
|
|
|
|
|
"waypointHeadingParam": {
|
|
|
|
|
"waypointHeadingMode": "followWayline",
|
|
|
|
@ -1190,7 +1197,7 @@ const handelrAirPoint = () => {
|
|
|
|
|
"coordinates":item.lng+","+item.lat
|
|
|
|
|
},
|
|
|
|
|
"index": item.id,
|
|
|
|
|
"executeHeight": item.alt,
|
|
|
|
|
"executeHeight": item.alt - height,
|
|
|
|
|
"waypointSpeed": props.templateKmlConfig.Folder.autoFlightSpeed,
|
|
|
|
|
"waypointHeadingParam": {
|
|
|
|
|
"waypointHeadingMode": "followWayline",
|
|
|
|
@ -1324,7 +1331,7 @@ const handelrAirPoint = () => {
|
|
|
|
|
"coordinates":item.lng+","+item.lat
|
|
|
|
|
},
|
|
|
|
|
"index": item.id,
|
|
|
|
|
"executeHeight": item.alt,
|
|
|
|
|
"executeHeight": item.alt - height,
|
|
|
|
|
"waypointSpeed": props.templateKmlConfig.Folder.autoFlightSpeed,
|
|
|
|
|
"waypointHeadingParam": {
|
|
|
|
|
"waypointHeadingMode": "followWayline",
|
|
|
|
@ -1351,7 +1358,6 @@ const handelrAirPoint = () => {
|
|
|
|
|
props.waylineWpmlConfig.Folder.Placemark.push(point);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
console.log(" props.waylineWpmlConfig", props.waylineWpmlConfig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|