Bläddra i källkod

功能修改20250311-02

zhiyuan-007 3 veckor sedan
förälder
incheckning
a134909cf4

+ 38 - 2
src/views/home/cpns/FloatPanelKysg.vue

@@ -70,6 +70,7 @@ import { addKysgScale, DrawPolygon, QueryDistrict, QueryCube, clearDraw } from "
 import useLayoutStore from '@/store/layout';
 import useLayoutStore from '@/store/layout';
 import { useMapStore } from '@/store/map';
 import { useMapStore } from '@/store/map';
 import { GetDistrictTree } from '@/service/http';
 import { GetDistrictTree } from '@/service/http';
+import {geometryMeshEffect} from "@/utils/map/addTool.js";
 
 
 export default {
 export default {
   setup(props, { emit }) {
   setup(props, { emit }) {
@@ -134,12 +135,15 @@ export default {
     }, { deep: true })
     }, { deep: true })
 
 
     function handleDraw() {
     function handleDraw() {
-      clearQueryCube()
+      clearQueryCube();
+      getMesh("hide");
       DrawPolygon({ hasZ: true })
       DrawPolygon({ hasZ: true })
     }
     }
 
 
     watch(() => mapStore.draw_geometry, (val) => {
     watch(() => mapStore.draw_geometry, (val) => {
       rings = val?.rings
       rings = val?.rings
+      clearDraw();
+      getMesh("show");
       showGrid()
       showGrid()
     }, { deep: true })
     }, { deep: true })
 
 
@@ -265,8 +269,40 @@ export default {
       })
       })
     }
     }
 
 
+
+    //获取带高度三维体
+    function getMesh(status){
+      if(status == "hide"){
+        geometryMeshEffect({
+          id: 'sgzy_mesh',
+          status: "hide"
+        })
+        return
+      }
+      let height = heightData[rangeEnd.value].value - heightData[rangeStart.value].value;
+      let tempRings = [];
+      for(let i = 0; i < rings[0].length; i++){
+        tempRings.push([rings[0][i][0],rings[0][i][1],heightData[rangeStart.value].value - 0.01])
+      }
+      debugger
+      geometryMeshEffect({
+        id: 'sgzy_mesh',
+        status:"show",
+        data: [{
+          type: 'polygon',
+          shape: {
+            height: height,
+            rings: [tempRings],
+            color: [0,255,0,0.2]
+          }
+        }]
+      })
+
+    }
+
     onBeforeUnmount(() => {
     onBeforeUnmount(() => {
-      addKysgScale(false)
+      addKysgScale(false);
+      getMesh("hide")
       clearDraw()
       clearDraw()
       clearQueryCube()
       clearQueryCube()
     })
     })

+ 39 - 2
src/views/home/cpns/PanelKypm.vue

@@ -50,6 +50,7 @@ import { onBeforeUnmount, ref, watch, onBeforeMount } from 'vue';
 import { DrawPolygon, QueryCube, clearDraw } from '@/utils/map/addLayer'
 import { DrawPolygon, QueryCube, clearDraw } from '@/utils/map/addLayer'
 import { useMapStore } from '@/store/map';
 import { useMapStore } from '@/store/map';
 import usePanelStore from '@/store/panel';
 import usePanelStore from '@/store/panel';
+import {geometryMeshEffect} from "@/utils/map/addTool.js";
 
 
 const panelStore = usePanelStore()
 const panelStore = usePanelStore()
 const mapStore = useMapStore()
 const mapStore = useMapStore()
@@ -86,8 +87,9 @@ watch(() => mapStore.draw_geometry, (val) => {
 }, { deep: true })
 }, { deep: true })
 
 
 function handleClear(clearAll) {
 function handleClear(clearAll) {
+  clearDraw();
+  getMesh("hide");
   if(clearAll) {
   if(clearAll) {
-    clearDraw()
     tableData.value = []
     tableData.value = []
   }
   }
   QueryCube({
   QueryCube({
@@ -95,10 +97,45 @@ function handleClear(clearAll) {
   })
   })
 }
 }
 
 
+//获取带高度三维体
+function getMesh(status){
+  if(status == "hide"){
+    geometryMeshEffect({
+      id: 'sgzy_mesh',
+      status: "hide"
+    })
+    return
+  }
+
+
+  let height = 0.02
+  let rings = [];
+  for(let i = 0; i < drawResult[0].length; i++){
+    rings.push([drawResult[0][i][0],drawResult[0][i][1],Number(form.value.height) - 0.01])
+  }
+  debugger
+  geometryMeshEffect({
+    id: 'sgzy_mesh',
+    status:"show",
+    data: [{
+      type: 'polygon',
+      shape: {
+        height: height,
+        rings: [rings],
+        color: [0,255,0,0.1]
+      }
+    }]
+  })
+
+}
+
+
+
 function handleCalc() {
 function handleCalc() {
   if (!drawResult) return
   if (!drawResult) return
   if (!form.value.height) return
   if (!form.value.height) return
-  handleClear()
+  handleClear();
+  getMesh("show");
   setTimeout(() => {
   setTimeout(() => {
     QueryCube({
     QueryCube({
       ...form.value,
       ...form.value,

+ 36 - 2
src/views/home/cpns/PanelSgzy.vue

@@ -52,6 +52,7 @@ import { onBeforeMount, onBeforeUnmount, ref, watch } from 'vue';
 import { DrawPolygon, QueryCube, clearDraw } from '@/utils/map/addLayer'
 import { DrawPolygon, QueryCube, clearDraw } from '@/utils/map/addLayer'
 import { useMapStore } from '@/store/map';
 import { useMapStore } from '@/store/map';
 import usePanelStore from '@/store/panel';
 import usePanelStore from '@/store/panel';
+import {geometryMeshEffect} from "@/utils/map/addTool.js";
 
 
 const mapStore = useMapStore()
 const mapStore = useMapStore()
 const panelStore = usePanelStore()
 const panelStore = usePanelStore()
@@ -89,8 +90,10 @@ watch(() => mapStore.draw_geometry, (val) => {
 }, { deep: true })
 }, { deep: true })
 
 
 function handleClear(clearAll) {
 function handleClear(clearAll) {
+  //开始计算之后取消绘制功能,转而使用带高度三维体显示
+  clearDraw()
+  getMesh("hide")
   if(clearAll) {
   if(clearAll) {
-    clearDraw()
     tableData.value = []
     tableData.value = []
   }
   }
   QueryCube({
   QueryCube({
@@ -98,11 +101,42 @@ function handleClear(clearAll) {
   })
   })
 }
 }
 
 
+//获取带高度三维体
+function getMesh(status){
+  if(status == "hide"){
+    geometryMeshEffect({
+      id: 'sgzy_mesh',
+      status: "hide"
+    })
+    return
+  }
+  let height = form.value.maxZ * 1 - form.value.minZ * 1
+  let rings = [];
+  for(let i = 0; i < drawResult[0].length; i++){
+    rings.push([drawResult[0][i][0],drawResult[0][i][1],form.value.minZ * 1])
+  }
+  debugger
+  geometryMeshEffect({
+    id: 'sgzy_mesh',
+    status:"show",
+    data: [{
+      type: 'polygon',
+      shape: {
+        height: height,
+        rings: [rings],
+        color: [0,255,0,0.2]
+      }
+    }]
+  })
+
+}
+
 function handleCalc() {
 function handleCalc() {
   const { maxZ, minZ } = form.value
   const { maxZ, minZ } = form.value
   if (!drawResult) return
   if (!drawResult) return
   if (!minZ || !maxZ) return
   if (!minZ || !maxZ) return
-  handleClear()
+  handleClear();
+  getMesh("show");
   setTimeout(() => {
   setTimeout(() => {
     QueryCube({
     QueryCube({
       ...form.value,
       ...form.value,