Przeglądaj źródła

功能修改20250305-01

zhiyuan-007 1 miesiąc temu
rodzic
commit
1078361be1

+ 1 - 1
src/service/panelHxhs.js

@@ -38,7 +38,7 @@ export function routePlanAll(params) {
                 "collision_buffer",
                 "no_fly_zone_buffer"
             ],
-            "heightRange":[20,40],
+            "heightRange":[params.height1,params.height2],
             "speed":20
         }
     })

+ 102 - 0
src/utils/map/addTool.js

@@ -0,0 +1,102 @@
+import { myBridge, previewMapBridge } from "./map.js";
+import { getMapToken, getServiceToken } from "@/service/map.js";
+
+export function invokeParams(ActionName, params) {
+    console.log('invokeParams', ActionName, params)
+    getMapToken().then(res => {
+        let token = res.data.msg[0].Rows[0].token;
+        myBridge.bridgeContent.Invoke({
+            'ActionName': ActionName,
+            "Parameters": {
+                token: token,
+                ...params
+            }
+        })
+    })
+}
+
+export function previewInvokeParams(ActionName, params) {
+    getMapToken().then(res => {
+        let token = res.data.msg[0].Rows[0].token;
+        previewMapBridge.bridgeContent.Invoke({
+            'ActionName': ActionName,
+            "Parameters": {
+                token: token,
+                ...params
+            }
+        })
+    })
+}
+
+async function returnProxyUrl(url) {
+    let arr = url.split('/');
+    let username = '';
+    let password = '';
+    if (arr.indexOf('MapProxyApi') !== -1) { //不需要授权服务
+        for (let i = 0; i < arr.length; i++) {
+            if (arr[i] === 'getSceneServer') {
+                username = arr[i + 1];
+                password = arr[i + 2];
+                const response = await getServiceToken(username, password);
+                if (response?.data.length > 0) {
+                    arr.splice(i - 1, 4);
+                    return arr.join('/') + '/MapServiceProxy/' + response.data;
+                }
+            }
+        }
+    } else {
+        return url
+    }
+}
+
+
+//回显各类集合体
+export async function geometryMeshEffect(params) {
+    invokeParams('GeometryMeshEffect', {
+        "status": params.status,
+        "id": params.id,
+        "data":params.data
+    })
+}
+
+//回显二次绘制航线
+export async function showAndRedrawPath(params) {
+    invokeParams('Draw', {
+        "type": "polyline",
+        "hasZ": true,
+        "status": params.status,
+        "path": params.path,
+        "symbol": {
+            "type": "line-3d",
+            "symbolLayers": [
+                {
+                    "type": "path",
+                    "profile": "circle",
+                    "material": {
+                        "color": [
+                            0,
+                            255,
+                            0,
+                            0.3
+                        ]
+                    },
+                    "width": 10,
+                    "height": 10
+                }
+            ]
+        },
+    })
+}
+
+//查询航线网格
+export async function getPathCube(params) {
+    invokeParams('GetPathCube', {
+        "id": "pathCube",
+        "status": params.status,
+        "level": 23,
+        "paths": params.paths,
+        "radius": 5,
+    })
+}
+
+

+ 3 - 1
src/utils/options.js

@@ -1,7 +1,9 @@
 export const areaList = [
-  { label: '适飞区', color: '#FF0000' },
+  { label: '适飞区', color: '#00FF00' },
   { label: '禁飞区', color: '#FF0000' },
   { label: '净空区', color: '#FF0000' },
+  { label: '起降场', color: '#00FF00' },
+  { label: '航线', color: '#0000FF' },
 ]
 
 export const areaUseList = [

+ 65 - 12
src/views/home/cpns/PanelHxhs.vue

@@ -37,13 +37,13 @@
           </div>
           <template v-if="form.dataType === '起降场规划'">
             <el-form-item label="起飞场" prop="fromPort">
-              <el-select v-model="form.fromPort" @click="showFromPart()"  placeholder="">
+              <el-select v-model="form.fromPort" @change="showPort('fromPort')"  placeholder="">
                 <el-option v-for="item in portOptions" :key="item.value" :label="item.label" :value="item.value"
                   :disabled="item.value === form.toPort" />
               </el-select>
             </el-form-item>
             <el-form-item label="降落场" prop="toPort">
-              <el-select v-model="form.toPort" @click="showToPart()"  placeholder="">
+              <el-select v-model="form.toPort" @change="showPort('toPort')"  placeholder="">
                 <el-option v-for="item in portOptions" :key="item.value" :label="item.label" :value="item.value"
                   :disabled="item.value === form.fromPort" />
               </el-select>
@@ -149,13 +149,16 @@
 <script setup>
 import { ref,onMounted } from 'vue';
 import {routePlanAll, searchQJCList} from "@/service/panelHxhs.js";
+import {geometryMeshEffect, getPathCube, showAndRedrawPath} from "@/utils/map/addTool.js";
 
 const currentStep = ref(0)
-
+let currentPath = []; // 当前规划路径
 const form = ref({
   taskType: '短途运输',
   uavType: '微型无人机',
   dataType: '起降场规划',
+  height1: 60,
+  height2: 80
 })
 
 const portOptions = []
@@ -247,27 +250,77 @@ function getQJCList(){
       portOptions.push({
         label: item.name,
         value: item.id,
-        shape: item.shape
+        shape: item.shape,
+        geoType: item.geoType
       })
     })
   })
 }
 
-function showFromPart(){
-
+function showPort(id){
+  geometryMeshEffect({
+    id: id,
+    status:"show",
+    data: [{
+      type: portOptions.find((item)=>item.value ==form.value[id]).geoType,
+      shape: {
+        ...JSON.parse(portOptions.find((item)=>item.value ==form.value[id]).shape),
+        color: [0,255,0,0.7]
+      }
+    }]
+  })
+  showOriginPath()
 }
 
+//起降场选择完成生成原始直线
+function showOriginPath(){
+  debugger
+  if(form.value.fromPort && form.value.toPort){
+    let formPoint = JSON.parse(portOptions.find((item)=>item.value ==form.value.fromPort).shape).point;
+    let toPoint = JSON.parse(portOptions.find((item)=>item.value ==form.value.toPort).shape).point;
+    currentPath = [
+      [formPoint.x, formPoint.y,formPoint.z],
+      [formPoint.x, formPoint.y,(form.value.height1 * 1 + form.value.height2 * 1)/2],
+      [toPoint.x, toPoint.y,(form.value.height1 * 1 + form.value.height2 * 1)/2],
+      [toPoint.x, toPoint.y,toPoint.z]
+    ]
+    showAndRedrawPath({
+      status:"show",
+      path:currentPath
+    });
+  }
+}
 
 
-function getAutoPath(){
-  if(form.value.dataType == "起降场规划"){
-    let point1 =  JSON.parse(portOptions.find((item)=>item.value ==form.value.fromPort).shape);
-    let point2 =  JSON.parse(portOptions.find((item)=>item.value ==form.value.toPort).shape);
-
+//查询网格
+function queryCube(){
+  getPathCube({
+    status:"show",
+    paths:[currentPath]
+  })
+}
 
 
-    routePlanAll()
 
+//辅助规划
+function getAutoPath(){
+  if(form.value.dataType == "起降场规划"){
+    let paramsPaths = [];
+    currentPath.forEach((item) =>{
+      paramsPaths.push({
+        x:item[0],
+        y:item[1],
+        z:item[2]
+      })
+    })
+    routePlanAll({
+      height1: form.value.height1,
+      height2: form.value.height2,
+      paths:paramsPaths
+    }).then(res=>{
+      let data = res.data.data;
+
+    });
   }else if(form.value.dataType == "航线规划"){
 
   }else if(form.value.dataType == "导入航线"){