Browse Source

低空修改250307-01

zhiyuan-007 1 month ago
parent
commit
ae49d44ad3
4 changed files with 115 additions and 81 deletions
  1. 93 39
      src/components/mapJK.vue
  2. 1 1
      src/config/basicTool.json
  3. 0 29
      src/service/http.js
  4. 21 12
      src/units/map/addDrawEvent.js

+ 93 - 39
src/components/mapJK.vue

@@ -106,7 +106,7 @@ export default {
     let symbolPointCubeEvent = null;
     let addGraphicsEvent = null;
     let featurePointsPlottingEvent = null;
-    let currentShowGridId = null;
+    let currentShowGridParams = null;
     let realFlyPointDataQueue = [];
     let addFlowPathEvent = null;
     let movePointEvent = null;
@@ -741,6 +741,16 @@ export default {
         let status = params.status;
         let scale_handle_id = params.scale_handle_id;
         if(status === "hide"){
+          if(scale_handle_id === "scale_handle_cube"){
+            getCurrentRealPower({
+              status:"hide",
+              id:"power_wj"
+            })
+          }else if(scale_handle_id === "scale_handle_tileLayerChange"){
+            //暂无操作
+          }else if(scale_handle_id === "scale_handle_sceneLayerLayerChange"){
+            //暂无操作
+          }
           if(m_handles.has(scale_handle_id)){
             m_handles.remove(scale_handle_id);
           }
@@ -2192,14 +2202,14 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         showThreeCubeDetail({
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = id;
         getSixPowerPoints({
           id,
           lastId,
@@ -2228,7 +2238,7 @@ export default {
           fields: params.fields,
           scrollId: params.scrollId,
         }).then(res =>{
-          if(currentShowGridId === params.id){
+          if(currentShowGridParams === params.id){
             if(res.data.data.list?.length >= 100000 && res.data.data.scrollId){
               // res.data.data.list.forEach((point) =>{
               //   point.color = [0, 1, 1];
@@ -2538,7 +2548,7 @@ export default {
         const connectFlyPointWebSocket = (status) => {
           if(status === "show"){
             if(flyPointSocket){
-              socket.send(JSON.stringify({
+              flyPointSocket.send(JSON.stringify({
                   "flightIdS": ["EFF7AE7B8B044436997F93F327819C20","18207414-c19e-4233-87e2-e6e4743fdea0"],
                   "messageCode": 1,
                   "isShow": true
@@ -2547,13 +2557,12 @@ export default {
               flyPointSocket = new WebSocket('ws://58.34.215.19:8100/flight/data/websocket');
               flyPointSocket.onopen = () => {
                 console.log('WebSocket 连接成功');
-                flyPointSocket.send(JSON.stringify({
-                  "flightIdS": ["EFF7AE7B8B044436997F93F327819C20","18207414-c19e-4233-87e2-e6e4743fdea0"],
-                  "messageCode": 1,
-                  "isShow": true
-                }));
               };
               flyPointSocket.onmessage = (messageEvent) => {
+                showThreeCubeDetail({
+                  "id":"movePointCube",
+                  "status":"hide"
+                })
                 let messages = JSON.parse(messageEvent.data);
                 if(movePointEvent){
                   movePointEvent.update(messages)
@@ -2564,6 +2573,27 @@ export default {
                     data:messages
                   });
                 }
+                let data = []
+                if(messages.length > 0){
+                  messages.forEach((item)=>{
+                    if(item.surroundGrid != null&&item.surroundGrid.length > 0){
+                      data = data.concat(item.surroundGrid);
+                    }
+                  })
+                  if(data.length > 0){
+                    showThreeCubeDetail({
+                      "id":"movePointCube",
+                      "status":"show",
+                      "size": {
+                        x:data[0].boxSize.latLength,
+                        y:data[0].boxSize.lonLength,
+                        z:data[0].boxSize.height
+                      },
+                      "points":data,
+                      "depthTest":false
+                    })
+                  }
+                }
               };
 
               flyPointSocket.onerror = (error) => {
@@ -2591,7 +2621,6 @@ export default {
       //获取当前场景
       function getOccupyCube(params){
         let id = params.id;
-        let lastId = params.lastId;
         let status = params.status;
         let level = params.level;
         let minZ = params.minZ;
@@ -2603,17 +2632,23 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         showThreeCubeDetail({
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = {
+          id,
+          level,
+          minZ,
+          maxZ,
+          rings,
+          fields
+        };
         getOccupyByPolygon({
           id,
-          lastId,
           status,
           minZ,
           maxZ,
@@ -2634,7 +2669,14 @@ export default {
           fields: params.fields,
           scrollId: params.scrollId,
         }).then(res =>{
-          if(currentShowGridId === params.id){
+          if(JSON.stringify(currentShowGridParams) === JSON.stringify({
+            id:params.id,
+            level:params.level,
+            minZ:params.minZ,
+            maxZ:params.maxZ,
+            rings:params.rings,
+            fields:params.fields,
+          })){
             if(res.data.data.list?.length >= 100000 && res.data.data.scrollId){
 
               let size = {
@@ -2674,7 +2716,6 @@ export default {
       //获取当前场景
       function getPowerCube(params){
         let id = params.id;
-        let lastId = params.lastId;
         let status = params.status;
         let level = params.level;
         let minZ = params.minZ;
@@ -2686,24 +2727,26 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
-        showThreeCubeDetail({
-          id:params.lastId,
-          status:"hide"
-        });
-        currentShowGridId = id;
+        currentShowGridParams = {
+          id,
+          level,
+          minZ,
+          maxZ,
+          rings,
+          fields
+        };
         getSixPowerByPolygon({
           id,
-          lastId,
           status,
           minZ,
           maxZ,
           level,
           fields,
           rings,
-          scrollId:""
+          scrollId:"",
         });
       }
 
@@ -2717,7 +2760,14 @@ export default {
           fields: params.fields,
           scrollId: params.scrollId,
         }).then(res =>{
-          if(currentShowGridId === params.id){
+          if(JSON.stringify(currentShowGridParams) === JSON.stringify({
+            id:params.id,
+            level:params.level,
+            minZ:params.minZ,
+            maxZ:params.maxZ,
+            rings:params.rings,
+            fields:params.fields,
+          })){
             if(res.data.data.list?.length >= 100000 && res.data.data.scrollId){
 
               let size = {
@@ -2770,14 +2820,14 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         showThreeCubeDetail({
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = id;
         getSixPowerByFunnel({
           id,
           lastId,
@@ -2811,6 +2861,7 @@ export default {
             "status":params.status,
             "size":size,
             "points":res.data.data.list,
+            "depthTest":false
           })
         })
       }
@@ -2829,14 +2880,14 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         showThreeCubeDetail({
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = id;
         getSixPowerByFrustumCone({
           id,
           lastId,
@@ -2868,6 +2919,7 @@ export default {
             "status":params.status,
             "size":size,
             "points":res.data.data.list,
+            "depthTest":false
           })
         })
       }
@@ -2885,14 +2937,14 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         showThreeCubeDetail({
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = id;
         getSixPowerByInvertedCone({
           id,
           lastId,
@@ -2921,6 +2973,7 @@ export default {
             "status":params.status,
             "size":size,
             "points":res.data.data.list,
+            "depthTest":false
           })
         })
       }
@@ -2938,14 +2991,14 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         showThreeCubeDetail({
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = id;
         getSixPowerByPrism({
           id,
           lastId,
@@ -2969,14 +3022,14 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         showThreeCubeDetail({
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = id;
         getSixPowerByPrism({
           id,
           lastId,
@@ -3001,14 +3054,14 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         showThreeCubeDetail({
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = id;
         getSixPowerByPrism({
           id,
           lastId,
@@ -3054,7 +3107,7 @@ export default {
             id:params.id,
             status:"hide"
           });
-          currentShowGridId = null;
+          currentShowGridParams = null;
           return
         }
         let paths = [];
@@ -3069,7 +3122,7 @@ export default {
           id:params.lastId,
           status:"hide"
         });
-        currentShowGridId = id;
+        currentShowGridParams = id;
         getSixPowerByPath({
           id,
           lastId,
@@ -3096,6 +3149,7 @@ export default {
             "status":params.status,
             "size":size,
             "points":res.data.data.list,
+            "depthTest":false
           })
         })
       }

+ 1 - 1
src/config/basicTool.json

@@ -42,7 +42,7 @@
             "title":"BaseMap",
             "visible": true,
             "opacity": 1,
-            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDE0MDAyODcsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.vVYiOcHETHfBvEUZznUcCLFFEziKh09QejR4C4GeEbg",
+            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDE1MDc1MzgsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.HetDOuz3SUpWuP8mQGwSIwTPfxTsx2MxTk9HbOLLsOQ",
             "token": ""
           }
         }

+ 0 - 29
src/service/http.js

@@ -71,35 +71,6 @@ export function getPowerPointByPolygon(params){
                 "shape": {
                     "type": "Polygon",
                     "coordinates":params.rings,
-                    // "coordinates": [
-                    //         [
-                    //             [
-                    //                 4510.965178032473,
-                    //                 8630.368364146465,
-                    //                 0
-                    //             ],
-                    //             [
-                    //                 5172.681364747654,
-                    //                 6222.235213498214,
-                    //                 0
-                    //             ],
-                    //             [
-                    //                 3592.9849815986345,
-                    //                 5788.15954811861,
-                    //                 0
-                    //             ],
-                    //             [
-                    //                 2931.26796348097,
-                    //                 8196.293085792775,
-                    //                 0
-                    //             ],
-                    //             [
-                    //                 4510.965178032473,
-                    //                 8630.368364146465,
-                    //                 0
-                    //             ]
-                    //         ]
-                    //     ]
                 }
             },
             "minZ": params.minZ,

+ 21 - 12
src/units/map/addDrawEvent.js

@@ -233,18 +233,27 @@ class AddDrawEvent {
         this.sketchViewModel.update([this.graphic],updateOptions);
     }
 
-    getBaseCenter(mesh) {
-        // 提取底面顶点
+    getBaseCenter(mesh, type) {
         const vertices = mesh.vertexAttributes.position;
-        const baseVertices = [];
-        const segments = 30; // 与 createTruncatedCone 中的 segments 一致
+        const segments = 30; // 与 createTruncatedCone 和 createTruncatedConeWithCylinder 中的 segments 一致
 
-        // 底面顶点是前 segments 个顶点
-        for (let i = 0; i < segments; i++) {
-            const x = vertices[i * 3];
-            const y = vertices[i * 3 + 1];
-            const z = vertices[i * 3 + 2];
-            baseVertices.push([x, y, z]);
+        let baseVertices = [];
+        if (type === "funnel") {
+            // 对于 funnel,提取圆柱体底面顶点(最后 segments 个顶点)
+            for (let i = 2 * segments; i < 3 * segments; i++) {
+                const x = vertices[i * 3];
+                const y = vertices[i * 3 + 1];
+                const z = vertices[i * 3 + 2];
+                baseVertices.push([x, y, z]);
+            }
+        } else {
+            // 对于 mesh,提取圆台底面顶点(前 segments 个顶点)
+            for (let i = 0; i < segments; i++) {
+                const x = vertices[i * 3];
+                const y = vertices[i * 3 + 1];
+                const z = vertices[i * 3 + 2];
+                baseVertices.push([x, y, z]);
+            }
         }
 
         // 计算底面中心点
@@ -268,7 +277,7 @@ class AddDrawEvent {
         this.createListenerEventHander = this.sketchViewModel.on("create", (event) => {
             if (event.state === "complete") {
                 if(event.graphic.geometry.type == "mesh"){
-                    callback(this.getBaseCenter(event.graphic.geometry));
+                    callback(this.getBaseCenter(event.graphic.geometry,this.type));
                 }else{
                     callback(event.graphic.geometry);
                 }
@@ -280,7 +289,7 @@ class AddDrawEvent {
         this.updateListenerEventHander = this.sketchViewModel.on("update", (event) => {
             if (event.state === "complete") {
                 if(event.graphic.geometry.type == "mesh"){
-                    callback(this.getBaseCenter(event.graphic.geometry));
+                    callback(this.getBaseCenter(event.graphic.geometry,this.type));
                 }else{
                     callback(event.graphic.geometry);
                 }