zhiyuan-007 пре 1 месец
родитељ
комит
f6bcf8564e
2 измењених фајлова са 56 додато и 20 уклоњено
  1. 2 2
      src/utils/map/addTool.js
  2. 54 18
      src/views/home/cpns/PanelHxhs.vue

+ 2 - 2
src/utils/map/addTool.js

@@ -80,8 +80,8 @@ export async function showAndRedrawPath(params) {
                             0.3
                         ]
                     },
-                    "width": 10,
-                    "height": 10
+                    "width": params.radius?params.radius * 2 : 10,
+                    "height": params.radius?params.radius * 2 : 10,
                 }
             ]
         },

+ 54 - 18
src/views/home/cpns/PanelHxhs.vue

@@ -174,6 +174,7 @@ import {ElMessage} from "element-plus";
 const currentStep = ref(0)
 let currentPath = []; // 当前规划路径
 let allPathArr = []; // 所有路径
+let autoHeight = false //手动规划
 const layoutStore = useLayoutStore();
 const mapStore = useMapStore();
 const form = ref({
@@ -181,7 +182,8 @@ const form = ref({
   uavType: '01',
   dataType: '02',
   height1: 60,
-  height2: 80
+  height2: 80,
+  radius:5
 })
 
 const portOptions = []
@@ -247,7 +249,6 @@ const currentPlan = ref('1');
 
 function toNext() {
   formRef.value.validate(valid => {
-    debugger
     if (valid) {
       currentStep.value = 1;
       getAutoPath();
@@ -359,7 +360,6 @@ function closeCube(){
 
 //辅助规划
 function getAutoPath(){
-  if(form.value.dataType == "02"){
     let paramsPaths = [];
     currentPath.forEach((item) =>{
       paramsPaths.push({
@@ -383,11 +383,6 @@ function getAutoPath(){
       });
       showAllPathByType();
     });
-  }else if(form.value.dataType == "01"){
-
-  }else if(form.value.dataType == "03"){
-
-  }
 }
 
 
@@ -488,24 +483,65 @@ function showAllPathByType(){
 function getDrawGeometry(){
   debugger
   if(mapStore.draw_geometry){
-    if(currentPlan.value == 1){  //最接近原航线,替换原航线数据
-      allPathArr.originalPath.path = mapStore.draw_geometry.paths;
-    }else if(currentPlan.value == 2){   //最安全
-      allPathArr.safePath.path = mapStore.draw_geometry.paths;
-    }else if(currentPlan.value == 3){   //最短
-      allPathArr.shortestPath.path = mapStore.draw_geometry.paths;
+    if(autoHeight){
+      let path = mapStore.draw_geometry.paths[0];
+      let flyPathArr = [path[0]];
+      path.forEach((item) => {
+        flyPathArr.push([item[0],item[1],(form.value.height1 + form.value.height2)/2 ]);
+      });
+      flyPathArr.push(path[path.length-1]);
+      showAndRedrawPath({
+        status:"show",
+        path:flyPathArr
+      });
+      autoHeight = false;
+      currentPath = flyPathArr;
+    }else{
+      if(currentPlan.value == 1){  //最接近原航线,替换原航线数据
+        allPathArr.originalPath.path = mapStore.draw_geometry.paths;
+      }else if(currentPlan.value == 2){   //最安全
+        allPathArr.safePath.path = mapStore.draw_geometry.paths;
+      }else if(currentPlan.value == 3){   //最短
+        allPathArr.shortestPath.path = mapStore.draw_geometry.paths;
+      }
+      currentPath = mapStore.draw_geometry.paths[0];
     }
-    currentPath = mapStore.draw_geometry.paths[0];
   }
 }
 
 function changeDataType(){
   if(form.value.dataType == '01'){ //手动
-
+    autoHeight = true;
+    showAndRedrawPath({
+      status:"show",
+      radius:form.value.radius
+    });
+    geometryMeshEffect({
+      id: "fromPort",
+      status:"hide"
+    })
+    geometryMeshEffect({
+      id: "toPort",
+      status:"hide"
+    })
   }else if(form.value.dataType == "02"){ //自动
-
+    autoHeight = false;
+    showAndRedrawPath({
+      status:"hide"
+    });
   }else if(form.value.dataType == "03"){  //导入航线
-
+    autoHeight = false;
+    showAndRedrawPath({
+      status:"hide"
+    });
+    geometryMeshEffect({
+      id: "fromPort",
+      status:"hide"
+    })
+    geometryMeshEffect({
+      id: "toPort",
+      status:"hide"
+    })
   }
 }