|
|
|
@ -22,6 +22,7 @@
|
|
|
|
|
<airPolygon
|
|
|
|
|
@setFlyPoint="setFlyPoint"
|
|
|
|
|
:airInfo="airInfo"
|
|
|
|
|
:editModel="props.editMode"
|
|
|
|
|
:polygonAirForm="polygonAirForm"
|
|
|
|
|
:airLineForm="props.airLineForm"
|
|
|
|
|
:waylineInfo="props.waylineInfo"
|
|
|
|
@ -42,7 +43,7 @@
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref, onMounted, defineProps, watch, defineEmits } from 'vue';
|
|
|
|
|
import { message } from 'ant-design-vue';
|
|
|
|
|
import { GeojsonToWkt } from '@/components/MapboxMaps/src/WktGeojsonTransform';
|
|
|
|
|
import { GeojsonToWkt,WktToGeojson } from '@/components/MapboxMaps/src/WktGeojsonTransform';
|
|
|
|
|
import { buildUUID } from '@/utils/uuid';
|
|
|
|
|
import airPoint from './airPoint.vue';
|
|
|
|
|
import * as mars3d from 'mars3d';
|
|
|
|
@ -103,6 +104,97 @@
|
|
|
|
|
},
|
|
|
|
|
"waylineInfo":{
|
|
|
|
|
type:Object,
|
|
|
|
|
default: () => ({
|
|
|
|
|
"missionConfig":{
|
|
|
|
|
"flyToWaylineMode": "safely", // 爬升模式 safely pointToPoint
|
|
|
|
|
"finishAction": "goHome", // 航线结束动作
|
|
|
|
|
"exitOnRCLost": "executeLostAction", // 失控是否继续执行航线
|
|
|
|
|
"executeRCLostAction": "goBack", // 失控动作类型
|
|
|
|
|
"takeOffSecurityHeight": 20, // 安全起飞高度
|
|
|
|
|
"globalTransitionalSpeed": 15, // 全局航线过渡速度
|
|
|
|
|
"globalRTHHeight": 100, // 全局返航高度
|
|
|
|
|
"droneInfo": { // 飞行器机型信息
|
|
|
|
|
"droneEnumValue": 100,
|
|
|
|
|
"droneSubEnumValue": 1
|
|
|
|
|
},
|
|
|
|
|
"autoRerouteInfo": { // 航线绕行
|
|
|
|
|
"transitionalAutoRerouteMode": 1,
|
|
|
|
|
"missionAutoRerouteMode": 1
|
|
|
|
|
},
|
|
|
|
|
"waylineAvoidLimitAreaMode": 0,
|
|
|
|
|
"payloadInfo": { // 负载机型信息
|
|
|
|
|
"payloadEnumValue": 99, // 负载机型主类型
|
|
|
|
|
"payloadSubEnumValue": 2,
|
|
|
|
|
"payloadPositionIndex": 0 // 负载挂载位置
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"Folder":{
|
|
|
|
|
"templateId": 0,
|
|
|
|
|
"executeHeightMode": "WGS84",
|
|
|
|
|
"waylineId": 0,
|
|
|
|
|
"distance": 1391.755859375,
|
|
|
|
|
"duration": 200.941531419754,
|
|
|
|
|
"autoFlightSpeed": 8.2, // 全局航线飞行速度
|
|
|
|
|
"startActionGroup": {
|
|
|
|
|
"action": [
|
|
|
|
|
{
|
|
|
|
|
"actionId": 0,
|
|
|
|
|
"actionActuatorFunc": "gimbalRotate",
|
|
|
|
|
"actionActuatorFuncParam": {
|
|
|
|
|
"gimbalHeadingYawBase": "aircraft",
|
|
|
|
|
"gimbalRotateMode": "absoluteAngle",
|
|
|
|
|
"gimbalPitchRotateEnable": 1,
|
|
|
|
|
"gimbalPitchRotateAngle": -90,
|
|
|
|
|
"gimbalRollRotateEnable": 0,
|
|
|
|
|
"gimbalRollRotateAngle": 0,
|
|
|
|
|
"gimbalYawRotateEnable": 1,
|
|
|
|
|
"gimbalYawRotateAngle": 0,
|
|
|
|
|
"gimbalRotateTimeEnable": 0,
|
|
|
|
|
"gimbalRotateTime": 10,
|
|
|
|
|
"payloadPositionIndex": 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"actionId": 1,
|
|
|
|
|
"actionActuatorFunc": "hover",
|
|
|
|
|
"actionActuatorFuncParam": {
|
|
|
|
|
"hoverTime": 0.5
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"actionId": 2,
|
|
|
|
|
"actionActuatorFunc": "setFocusType",
|
|
|
|
|
"actionActuatorFuncParam": {
|
|
|
|
|
"cameraFocusType": "manual",
|
|
|
|
|
"payloadPositionIndex": 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"actionId": 3,
|
|
|
|
|
"actionActuatorFunc": "focus",
|
|
|
|
|
"actionActuatorFuncParam": {
|
|
|
|
|
"focusX": 0,
|
|
|
|
|
"focusY": 0,
|
|
|
|
|
"focusRegionWidth": 0,
|
|
|
|
|
"focusRegionHeight": 0,
|
|
|
|
|
"isPointFocus": 0,
|
|
|
|
|
"isInfiniteFocus": 1,
|
|
|
|
|
"payloadPositionIndex": 0,
|
|
|
|
|
"isCalibrationFocus": 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"actionId": 4,
|
|
|
|
|
"actionActuatorFunc": "hover",
|
|
|
|
|
"actionActuatorFuncParam": {
|
|
|
|
|
"hoverTime": 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
Placemark:[]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
"workPlanFormShow":{
|
|
|
|
|
type:Boolean
|
|
|
|
@ -273,20 +365,27 @@ const generatePreviewPoint = (placemark)=>{
|
|
|
|
|
airPointConfigShow.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///////////////////////////////图层中心////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
let map: mars3d.Map; // 地图对象
|
|
|
|
|
|
|
|
|
|
let graphicLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
// 设置参考起飞点图层
|
|
|
|
|
let drawGraphicLayer:mars3d.layer.GraphicLayer;
|
|
|
|
|
let takeOffPointGraphicLayer:mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
let uavGraphicLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
// 面航线图层
|
|
|
|
|
// 测区面图层
|
|
|
|
|
let polygonGraphicLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
// 面航线图层
|
|
|
|
|
let polygonLineGraphicLayer: mars3d.layer.GeoJsonLayer;
|
|
|
|
|
|
|
|
|
|
// 航点地面投影点
|
|
|
|
|
// 文本标注图层
|
|
|
|
|
let textLabelGraphicLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
// 航点地面投影点图层
|
|
|
|
|
let stickGroundPointLayer: mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
// 航点连接线
|
|
|
|
@ -294,6 +393,7 @@ const generatePreviewPoint = (placemark)=>{
|
|
|
|
|
|
|
|
|
|
// 项目首页机场位置
|
|
|
|
|
let homeStartGraphic;
|
|
|
|
|
|
|
|
|
|
let homeStartGraphicLive;
|
|
|
|
|
|
|
|
|
|
let graphic = null;
|
|
|
|
@ -302,16 +402,23 @@ const generatePreviewPoint = (placemark)=>{
|
|
|
|
|
|
|
|
|
|
// 清空数据
|
|
|
|
|
graphicLayer ? graphicLayer.clear() : null;
|
|
|
|
|
drawGraphicLayer ? drawGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
takeOffPointGraphicLayer ? takeOffPointGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
stickGroundPointLayer ? stickGroundPointLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
lineGroundPointLayer ? lineGroundPointLayer.clear() : null;
|
|
|
|
|
labelGraphicLayer ? labelGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
textLabelGraphicLayer ? textLabelGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
polygonGraphicLayer ? polygonGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
polygonLineGraphicLayer ? polygonLineGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
airPoints.value = [];
|
|
|
|
|
|
|
|
|
|
props.airLineForm.airLineType = null;
|
|
|
|
|
|
|
|
|
|
airPointConfigShow.value = false;
|
|
|
|
|
|
|
|
|
|
emits('exitDraw');
|
|
|
|
@ -536,15 +643,15 @@ const initMap = () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 参考起飞点图层
|
|
|
|
|
drawGraphicLayer = new mars3d.layer.GraphicLayer({
|
|
|
|
|
takeOffPointGraphicLayer = new mars3d.layer.GraphicLayer({
|
|
|
|
|
isAutoEditing:true,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
drawGraphicLayer.on(mars3d.EventType.editMovePoint, function (event) {
|
|
|
|
|
takeOffPointGraphicLayer.on(mars3d.EventType.editMovePoint, function (event) {
|
|
|
|
|
flyPointMove(event);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
map.addLayer(drawGraphicLayer);
|
|
|
|
|
map.addLayer(takeOffPointGraphicLayer);
|
|
|
|
|
|
|
|
|
|
// 航点地面投影点
|
|
|
|
|
stickGroundPointLayer = new mars3d.layer.GraphicLayer({
|
|
|
|
@ -566,7 +673,7 @@ const initMap = () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 面状航线
|
|
|
|
|
// 面测区图层
|
|
|
|
|
polygonGraphicLayer = new mars3d.layer.GraphicLayer({
|
|
|
|
|
isAutoEditing: true, // 是否自动激活编辑
|
|
|
|
|
});
|
|
|
|
@ -586,6 +693,7 @@ const initMap = () => {
|
|
|
|
|
})
|
|
|
|
|
map.addLayer(polygonGraphicLayer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 绘制起点
|
|
|
|
|
// handlerDrawStartPoint();
|
|
|
|
|
|
|
|
|
@ -671,13 +779,15 @@ const loadChangGuangLayer = ()=>{
|
|
|
|
|
|
|
|
|
|
///////////////////////////////参考起飞点////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
// 全局参考起飞点
|
|
|
|
|
const startPosition = ref(null);
|
|
|
|
|
// 全局参考起飞点 数据格式:[lng,lat,alt]
|
|
|
|
|
const startPosition = ref(null);
|
|
|
|
|
|
|
|
|
|
// 设置起飞点
|
|
|
|
|
const setFlyPoint = async () => {
|
|
|
|
|
drawGraphicLayer ? drawGraphicLayer.clear() : null;
|
|
|
|
|
const graphic = await drawGraphicLayer.startDraw({
|
|
|
|
|
|
|
|
|
|
takeOffPointGraphicLayer ? takeOffPointGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
const graphic = await takeOffPointGraphicLayer.startDraw({
|
|
|
|
|
type: 'billboardP',
|
|
|
|
|
style: {
|
|
|
|
|
image: '/map/start.png',
|
|
|
|
@ -742,6 +852,7 @@ const handlerGetLngLatHeight = (e)=>{
|
|
|
|
|
|
|
|
|
|
const polygonGeoJson = ref();
|
|
|
|
|
|
|
|
|
|
// 计算参数
|
|
|
|
|
const polygonCalculateParams = ref({
|
|
|
|
|
"gsd": 0,
|
|
|
|
|
"overlapY": 70,
|
|
|
|
@ -755,7 +866,6 @@ const polygonCalculateParams = ref({
|
|
|
|
|
// 绘制面状测区
|
|
|
|
|
const handlerDrawPolygon = async () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const graphic = await polygonGraphicLayer.startDraw({
|
|
|
|
|
type: 'polygon',
|
|
|
|
|
style: {
|
|
|
|
@ -776,6 +886,13 @@ const handlerDrawPolygon = async () => {
|
|
|
|
|
|
|
|
|
|
let polygon = turf.polygon([coordinates]);
|
|
|
|
|
|
|
|
|
|
let polygonWkt = GeojsonToWkt(polygon['geometry']);
|
|
|
|
|
|
|
|
|
|
props.airLineForm.flyToFirstPointMode = polygonWkt;
|
|
|
|
|
|
|
|
|
|
console.log("props.airLineForm",props.airLineForm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let spceing = parseFloat(polygonCalculateParams.value?.spacing) / 10000;
|
|
|
|
|
let lines = generateScanLines(polygon,spceing, 0);
|
|
|
|
|
|
|
|
|
@ -792,7 +909,11 @@ const handlerPolygonEdit = (e)=>{
|
|
|
|
|
|
|
|
|
|
let coordinates = e.graphic.toJSON().positions;
|
|
|
|
|
|
|
|
|
|
coordinates.push(coordinates[0]);
|
|
|
|
|
if(props.editMode == 'add'){
|
|
|
|
|
coordinates.push(coordinates[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("coordinates",coordinates);
|
|
|
|
|
|
|
|
|
|
polygonGeoJson.value = coordinates;
|
|
|
|
|
|
|
|
|
@ -859,14 +980,18 @@ const handlerDrawPolygonLine = (lines) => {
|
|
|
|
|
polygonGraphicLayer.addGraphic(graphic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加起飞点
|
|
|
|
|
|
|
|
|
|
// 判断飞行模式
|
|
|
|
|
|
|
|
|
|
lines.geometry.coordinates.unshift([
|
|
|
|
|
polygonAirForm.value.startingPoint[0],
|
|
|
|
|
polygonAirForm.value.startingPoint[1],
|
|
|
|
|
polygonAirForm.value.startingPoint[2] + parseFloat(polygonCalculateParams.value.safeyFlyHeight),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
// 链接起点
|
|
|
|
|
lines.geometry.coordinates.unshift(polygonAirForm.value.startingPoint);
|
|
|
|
|
|
|
|
|
|
if (polygonLineGraphicLayer) {
|
|
|
|
|
polygonLineGraphicLayer.clear();
|
|
|
|
|
polygonLineGraphicLayer.loadGeoJSON(lines);
|
|
|
|
@ -881,6 +1006,7 @@ const handlerDrawPolygonLine = (lines) => {
|
|
|
|
|
width: 2.0,
|
|
|
|
|
color: '#0aed8b',
|
|
|
|
|
// clampToGround: true,
|
|
|
|
|
extrudedHeight: 100, // 相对于地形的高度(米)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
flyTo: true,
|
|
|
|
@ -1062,7 +1188,7 @@ const handlerRemovePolygonArea = () => {
|
|
|
|
|
polygonLineGraphicLayer.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
labelGraphicLayer ? labelGraphicLayer.clear() : null;
|
|
|
|
|
textLabelGraphicLayer ? textLabelGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
polygonGeoJson.value = null;
|
|
|
|
|
|
|
|
|
@ -1114,7 +1240,6 @@ const updatePolygonLineByParams = ()=>{
|
|
|
|
|
|
|
|
|
|
// 计算绘制的多边形每条线的长度和中心点
|
|
|
|
|
const polygonBorderInfo = ref([]);
|
|
|
|
|
let labelGraphicLayer:mars3d.layer.GraphicLayer;
|
|
|
|
|
|
|
|
|
|
// 计算测区各边长
|
|
|
|
|
const handlerGetPolygonBorderInfo = (polygonCoords) => {
|
|
|
|
@ -1139,22 +1264,22 @@ const handlerGetPolygonBorderInfo = (polygonCoords) => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handlerLoadLabelGraphicLayer(edgeLengths);
|
|
|
|
|
handlerLoadtextLabelGraphicLayer(edgeLengths);
|
|
|
|
|
return edgeLengths;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 绘制文本标注
|
|
|
|
|
const handlerLoadLabelGraphicLayer = (info) => {
|
|
|
|
|
const handlerLoadtextLabelGraphicLayer = (info) => {
|
|
|
|
|
|
|
|
|
|
if(labelGraphicLayer == null){
|
|
|
|
|
labelGraphicLayer = new mars3d.layer.GraphicLayer({
|
|
|
|
|
if(textLabelGraphicLayer == null){
|
|
|
|
|
textLabelGraphicLayer = new mars3d.layer.GraphicLayer({
|
|
|
|
|
isAutoEditing:false
|
|
|
|
|
})
|
|
|
|
|
map.addLayer(labelGraphicLayer);
|
|
|
|
|
map.addLayer(textLabelGraphicLayer);
|
|
|
|
|
}else{
|
|
|
|
|
labelGraphicLayer.clear();
|
|
|
|
|
textLabelGraphicLayer.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info?.forEach((item,index)=>{
|
|
|
|
|
const graphic = new mars3d.graphic.LabelEntity({
|
|
|
|
|
position: [item.center[0], item.center[1], 0],
|
|
|
|
@ -1174,7 +1299,7 @@ const handlerLoadLabelGraphicLayer = (info) => {
|
|
|
|
|
},
|
|
|
|
|
attr: { remark: "示例1" }
|
|
|
|
|
})
|
|
|
|
|
labelGraphicLayer.addGraphic(graphic)
|
|
|
|
|
textLabelGraphicLayer.addGraphic(graphic)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1185,7 +1310,7 @@ const handlerEditPolygonAirLine =async () => {
|
|
|
|
|
polygonAirForm.value.startingPoint = [props.airLineForm.taskOffLng,props.airLineForm.taskOffLat];
|
|
|
|
|
|
|
|
|
|
// 起点
|
|
|
|
|
drawGraphicLayer ? drawGraphicLayer.clear() : null;
|
|
|
|
|
takeOffPointGraphicLayer ? takeOffPointGraphicLayer.clear() : null;
|
|
|
|
|
let startFlyGraphic = new mars3d.graphic.BillboardEntity({
|
|
|
|
|
position:[props.airLineForm.taskOffLng,props.airLineForm.taskOffLat],
|
|
|
|
|
style: {
|
|
|
|
@ -1203,9 +1328,43 @@ const handlerEditPolygonAirLine =async () => {
|
|
|
|
|
clampToGround: true,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
drawGraphicLayer.addGraphic(startFlyGraphic);
|
|
|
|
|
takeOffPointGraphicLayer.addGraphic(startFlyGraphic);
|
|
|
|
|
|
|
|
|
|
startPosition.value = [props.airLineForm.taskOffLng,props.airLineForm.taskOffLat,71]
|
|
|
|
|
|
|
|
|
|
// 测区
|
|
|
|
|
let areaJson = WktToGeojson(props.airLineForm.flyToFirstPointMode)
|
|
|
|
|
|
|
|
|
|
polygonGeoJson.value = areaJson.coordinates[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let geojsonData = {
|
|
|
|
|
"type": "FeatureCollection",
|
|
|
|
|
"features": [
|
|
|
|
|
{
|
|
|
|
|
"type": "Feature",
|
|
|
|
|
"geometry": areaJson,
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
polygonGraphicLayer ? polygonGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
polygonGraphicLayer.loadGeoJSON(geojsonData,{
|
|
|
|
|
type: 'polygon',
|
|
|
|
|
flyTo:true,
|
|
|
|
|
style: {
|
|
|
|
|
color: '#408eff',
|
|
|
|
|
opacity: 0.3,
|
|
|
|
|
outline: true,
|
|
|
|
|
outlineColor: '#408eff',
|
|
|
|
|
outlineWidth: 3.0,
|
|
|
|
|
clampToGround: true,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 文本标注
|
|
|
|
|
handlerGetPolygonBorderInfo(areaJson.coordinates[0])
|
|
|
|
|
|
|
|
|
|
// 航线
|
|
|
|
|
let placemark = props.waylineInfo?.Folder?.Placemark
|
|
|
|
@ -1235,11 +1394,6 @@ const handlerEditPolygonAirLine =async () => {
|
|
|
|
|
|
|
|
|
|
handlerDrawPolygonLine(line);
|
|
|
|
|
|
|
|
|
|
// 文本标注
|
|
|
|
|
|
|
|
|
|
// 更新航线
|
|
|
|
|
updatePolygonLineByParams();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////航点航线计算////////////////////////////////////////////
|
|
|
|
@ -1984,7 +2138,7 @@ const clearAllLayer = () => {
|
|
|
|
|
polygonLineGraphicLayer ? polygonLineGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
// 文字标注
|
|
|
|
|
labelGraphicLayer ? labelGraphicLayer.clear() : null;
|
|
|
|
|
textLabelGraphicLayer ? textLabelGraphicLayer.clear() : null;
|
|
|
|
|
|
|
|
|
|
airPoints.value = [];
|
|
|
|
|
polygonGeoJson.value = null;
|
|
|
|
|