zhiyuan-007 пре 1 недеља
родитељ
комит
40ecfde077
4 измењених фајлова са 173 додато и 211 уклоњено
  1. 108 196
      src/components/mapJK.vue
  2. 32 2
      src/config/basicTool.json
  3. 6 0
      src/units/map/AddLightBallEvent.js
  4. 27 13
      src/units/threejs/lightBall.js

+ 108 - 196
src/components/mapJK.vue

@@ -77,6 +77,7 @@ export default {
     let socket = null;
     let virtualSocket = null;
     let flyPointSocket = null;
+    let ShowMovePointCube = false;
     const ctx = getCurrentInstance();
     const bus = ctx?.appContext.config.globalProperties.$bus;
     let MapReady = null;
@@ -89,7 +90,7 @@ export default {
     let sunshineWidget = null;
     let m_handles = [];
     let viewShedAnalysisWidget = null;
-    let addLightBallEvent = null;
+    let lightBallInstance = {};
     let addThreeGridEvent = null;
     let addThreeCubeEvent = null;
     //let addThreeCubeDetailEvent = null;
@@ -330,6 +331,12 @@ export default {
           case "MovePoint":
             movePoint(params);
             break;
+          case "MovePaths":
+            movePaths(params)
+            break;
+          case "ShowMovePointCube":
+            showMovePointCube(params)
+            break;
           case "GetOccupyCube":
             getOccupyCube(params);
             break;
@@ -1638,17 +1645,22 @@ export default {
       }
       function addLightBall(params){
         let status = params.status;
-        if(addLightBallEvent){
-          addLightBallEvent.clear();
-          addLightBallEvent = null;
+        let id = params.id;
+        if(lightBallInstance[id]){
+          lightBallInstance[id].clear();
+          lightBallInstance[id] = null;
         }
         if(status === "hide"){
           return
         }
-        addLightBallEvent = new AddLightBallEvent({
-          view:m_view
+        let points = params.points;
+        let addLightBallEvent = new AddLightBallEvent({
+          view:m_view,
+          points
         })
         addLightBallEvent.start()
+        // 保存实例
+        lightBallInstance[id] = addLightBallEvent;
       }
       function threeGrid(params){
         let status = params.status;
@@ -2338,6 +2350,12 @@ export default {
                   },
                   "points": newData,
                 })
+                bus.emit('SendMessage',{
+                  action:"CurrentCubeLevel",
+                  data:{
+                    "level":currentRealPowerLevel
+                  }
+                })
                 closeOtherThreeCubeDetail(params.id,currentRealPowerLevel)
               }
             }
@@ -2722,11 +2740,8 @@ export default {
 
       function movePoint(params){
         let status = params.status;
-        debugger
         const connectFlyPointWebSocket = (status) => {
           if(status === "show"){
-            debugger
-            showMovePaths(status);
             if(flyPointSocket){
               flyPointSocket.send(JSON.stringify({
                   "flightIdS": ["EFF7AE7B8B044436997F93F327819C20","18207414-c19e-4233-87e2-e6e4743fdea0"],
@@ -2753,25 +2768,36 @@ export default {
                     data:messages
                   });
                 }
-                let data = []
+                let data = [];
+                let points = []
                 if(messages.length > 0){
                   messages.forEach((item)=>{
                     if(item.surroundGrid != null&&item.surroundGrid.length > 0){
                       data = data.concat(item.surroundGrid);
                     }
+                    points.push([item.x,item.y,item.z])
                   })
-                  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
-                      },
-                      "deepOpacity":true,
-                      "points":data,
-                      "depthTest":false
+                  if(ShowMovePointCube){
+                    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
+                        },
+                        "deepOpacity":true,
+                        "points":data,
+                        "depthTest":false
+                      })
+                    }
+                  }
+                  if(points.length > 0){
+                    addLightBall({
+                      id:"ball",
+                      status:"show",
+                      points:points,
                     })
                   }
                 }
@@ -2786,7 +2812,6 @@ export default {
               };
             }
           }else{
-            showMovePaths(status);
             if(flyPointSocket){
               if(movePointEvent){
                 movePointEvent.clear();
@@ -2805,8 +2830,8 @@ export default {
       }
 
 
-      function showMovePaths(status){
-        debugger
+      function movePaths(params){
+        let status = params.status;
         if(status === "show"){
           queryPathsInfo().then(res=>{
             if(res.data.code === 200){
@@ -2838,6 +2863,15 @@ export default {
         }
       }
 
+      function showMovePointCube(params){
+        let status = params.status;
+        if(status == "show"){
+          ShowMovePointCube = true;
+        }else{
+          ShowMovePointCube = false;
+        }
+      }
+
 
       //获取当前场景
       function getOccupyCube(params){
@@ -2993,7 +3027,6 @@ export default {
             fields:params.fields,
           })){
             if(res.data.data.list?.length >= 100000 && res.data.data.scrollId){
-
               let size = {
                 x:res.data.data.list[0].boxSize.latLength,
                 y:res.data.data.list[0].boxSize.lonLength,
@@ -3073,44 +3106,8 @@ export default {
           topRadius: params.topRadius,
           bottomRadius: params.bottomRadius,
         }).then(res =>{
-          let size = {
-            x:res.data.data.list[0].boxSize.latLength,
-            y:res.data.data.list[0].boxSize.lonLength,
-            z:res.data.data.list[0].boxSize.height
-          }
-          bus.emit('SendMessage',{
-            action:"CubeResult",
-            data:{
-              "message":res.data.data.gridConflict
-            }
-          })
-
-          if(res.data.data.list.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "23",
-              "status":params.status,
-              "size": {
-                x:res.data.data.list[0].boxSize.latLength,
-                y:res.data.data.list[0].boxSize.lonLength,
-                z:res.data.data.list[0].boxSize.height
-              },
-              "points":res.data.data.list,
-              "depthTest":false
-            })
-          }
-          if(res.data.data.listInfo.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "24",
-              "status":params.status,
-              "size": {
-                x:res.data.data.listInfo[0].boxSize.latLength,
-                y:res.data.data.listInfo[0].boxSize.lonLength,
-                z:res.data.data.listInfo[0].boxSize.height
-              },
-              "points":res.data.data.listInfo,
-              "depthTest":false
-            })
-          }
+          //处理返回网格结果
+          feedbackCubeResult(params,res)
         })
       }
 
@@ -3156,40 +3153,8 @@ export default {
           topRadius: params.topRadius,
           bottomRadius: params.bottomRadius,
         }).then(res =>{
-          bus.emit('SendMessage',{
-            action:"CubeResult",
-            data:{
-              "message":res.data.data.gridConflict
-            }
-          })
-
-          if(res.data.data.list.length>0){
-            debugger
-            showThreeCubeDetail({
-              "id":params.id+ "23",
-              "status":params.status,
-              "size": {
-                x:res.data.data.list[0].boxSize.latLength,
-                y:res.data.data.list[0].boxSize.lonLength,
-                z:res.data.data.list[0].boxSize.height
-              },
-              "points":res.data.data.list,
-              "depthTest":false
-            })
-          }
-          if(res.data.data.listInfo.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "24",
-              "status":params.status,
-              "size": {
-                x:res.data.data.listInfo[0].boxSize.latLength,
-                y:res.data.data.listInfo[0].boxSize.lonLength,
-                z:res.data.data.listInfo[0].boxSize.height
-              },
-              "points":res.data.data.listInfo,
-              "depthTest":false
-            })
-          }
+          //处理返回网格结果
+          feedbackCubeResult(params,res)
         })
       }
 
@@ -3230,38 +3195,8 @@ export default {
           level: params.level,
           radius: params.radius,
         }).then(res =>{
-          bus.emit('SendMessage',{
-            action:"CubeResult",
-            data:{
-              "message":res.data.data.gridConflict
-            }
-          })
-          if(res.data.data.list.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "23",
-              "status":params.status,
-              "size": {
-                x:res.data.data.list[0].boxSize.latLength,
-                y:res.data.data.list[0].boxSize.lonLength,
-                z:res.data.data.list[0].boxSize.height
-              },
-              "points":res.data.data.list,
-              "depthTest":false
-            })
-          }
-          if(res.data.data.listInfo.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "24",
-              "status":params.status,
-              "size": {
-                x:res.data.data.listInfo[0].boxSize.latLength,
-                y:res.data.data.listInfo[0].boxSize.lonLength,
-                z:res.data.data.listInfo[0].boxSize.height
-              },
-              "points":res.data.data.listInfo,
-              "depthTest":false
-            })
-          }
+          //处理返回网格结果
+          feedbackCubeResult(params,res)
         })
       }
 
@@ -3356,44 +3291,14 @@ export default {
       }
 
       function getSixPowerByPrism(params){
+        debugger
         getPowerPointByPrism({
           rings:params.rings,
           height:params.height,
           level: params.level
         }).then(res =>{
-          debugger
-          bus.emit('SendMessage',{
-            action:"CubeResult",
-            data:{
-              "message":res.data.data.gridConflict
-            }
-          })
-          if(res.data.data.list.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "23",
-              "status":params.status,
-              "size": {
-                x:res.data.data.list[0].boxSize.latLength,
-                y:res.data.data.list[0].boxSize.lonLength,
-                z:res.data.data.list[0].boxSize.height
-              },
-              "points":res.data.data.list,
-              "depthTest":false
-            })
-          }
-          if(res.data.data.listInfo.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "24",
-              "status":params.status,
-              "size": {
-                x:res.data.data.listInfo[0].boxSize.latLength,
-                y:res.data.data.listInfo[0].boxSize.lonLength,
-                z:res.data.data.listInfo[0].boxSize.height
-              },
-              "points":res.data.data.listInfo,
-              "depthTest":false
-            })
-          }
+          //处理返回网格结果
+          feedbackCubeResult(params,res)
         })
       }
 
@@ -3436,49 +3341,56 @@ export default {
       }
 
       function getSixPowerByPath(params){
-        debugger
         getPowerPointByPath({
           paths:params.paths,
           radius:params.radius,
           level: params.level
         }).then(res =>{
-          bus.emit('SendMessage',{
-            action:"CubeResult",
-            data:{
-              "message":res.data.data.gridConflict
-            }
-          })
+          //处理返回网格结果
           debugger
-          if(res.data.data.list.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "23",
-              "status":params.status,
-              "size": {
-                x:res.data.data.list[0].boxSize.latLength,
-                y:res.data.data.list[0].boxSize.lonLength,
-                z:res.data.data.list[0].boxSize.height
-              },
-              "points":res.data.data.list,
-              "depthTest":false
-            })
-          }
-          debugger
-          if(res.data.data.listInfo.length>0){
-            showThreeCubeDetail({
-              "id":params.id+ "24",
-              "status":params.status,
-              "size": {
-                x:res.data.data.listInfo[0].boxSize.latLength,
-                y:res.data.data.listInfo[0].boxSize.lonLength,
-                z:res.data.data.listInfo[0].boxSize.height
-              },
-              "points":res.data.data.listInfo,
-              "depthTest":false
-            })
+          feedbackCubeResult(params,res);
+        })
+      }
+
+      function feedbackCubeResult(params,res){
+        bus.emit('SendMessage',{
+          action:"CubeResult",
+          data:{
+            "message":{
+              "time":new Date().getTime(),
+              "data":res.data.data.gridConflict
+            }
           }
         })
+        if(res.data.data?.list?.length>0){
+          showThreeCubeDetail({
+            "id":params.id+ "23",
+            "status":params.status,
+            "size": {
+              x:res.data.data.list[0].boxSize.latLength,
+              y:res.data.data.list[0].boxSize.lonLength,
+              z:res.data.data.list[0].boxSize.height
+            },
+            "points":res.data.data.list,
+            "depthTest":false
+          })
+        }
+        if(res.data.data?.listInfo?.length>0){
+          showThreeCubeDetail({
+            "id":params.id+ "24",
+            "status":params.status,
+            "size": {
+              x:res.data.data.listInfo[0].boxSize.latLength,
+              y:res.data.data.listInfo[0].boxSize.lonLength,
+              z:res.data.data.listInfo[0].boxSize.height
+            },
+            "points":res.data.data.listInfo,
+            "depthTest":false
+          })
+        }
       }
 
+
       function getBasePrism(params){
         getPrism({
           paths:params.paths,

+ 32 - 2
src/config/basicTool.json

@@ -42,7 +42,7 @@
             "title":"BaseMap",
             "visible": true,
             "opacity": 1,
-            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDE4NDYwOTUsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.YCQcZ2IkjxFBm5ezdxzz3DRxWW5GDzf1ZeodNGImP2M",
+            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDI0MzY3OTEsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.UAS7cBdU5ac_ZdppUe8J_601CTST5V9CLgDIE-au5K0",
             "token": ""
           }
         }
@@ -58,7 +58,7 @@
             "title":"WhiteMold",
             "visible": true,
             "opacity": 1,
-            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDE4NzY5NjgsImtleSI6IjA1MTk1NDE4Iiwic2VydmljZU5vIjoiRDkwMDMwMDA2MjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.jzmntxXRXrBLHTqs1-GosfwFx5U3gM4NiBcuX_-oPi8/SceneServer",
+            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDIzNjgwNzIsImtleSI6IjA1MTk1NDE4Iiwic2VydmljZU5vIjoiRDkwMDMwMDA2MjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.h0erCmFVw6Xao3TTbrRYT_XLwa42xqJAbduKSDgqJjM/SceneServer",
             "token": ""
           }
         }
@@ -207,7 +207,15 @@
         "data": {
           "ActionName": "AddLightBall",
           "Parameters": {
+            "id": "lightBall",
             "status": "show",
+            "points": [
+              [0,0,100],
+              [0,100,100],
+              [100,0,100],
+              [100,100,100],
+              [-100,0,100]
+            ],
             "token": ""
           }
         }
@@ -2088,6 +2096,28 @@
           }
         }
       },
+      {
+        "code": "1-47-1",
+        "title": "态势航线",
+        "data": {
+          "ActionName": "MovePaths",
+          "Parameters": {
+            "status": "show",
+            "token": ""
+          }
+        }
+      },
+      {
+        "code": "1-47-2",
+        "title": "态势网格",
+        "data": {
+          "ActionName": "ShowMovePointCube",
+          "Parameters": {
+            "status": "show",
+            "token": ""
+          }
+        }
+      },
       {
         "code": "1-48-1",
         "title": "获取占用网格",

+ 6 - 0
src/units/map/AddLightBallEvent.js

@@ -7,6 +7,9 @@ class AddLightBallEvent{
     constructor(options) {
         this.view = options.view;
         this.addLightBallEvent = null;
+        this.points = options.points;
+        this.radius = options.radius || 10;
+        this.color = options.color || '#00FF7F';
     }
     start() {
         let that = this;
@@ -17,6 +20,9 @@ class AddLightBallEvent{
         this.view.when(()=>{
             that.addLightBallEvent =  new subRenderClass({
                 view: that.view,
+                points: that.points,
+                color:that.color,
+                radius: that.radius,
                 webgl
             })
         })

+ 27 - 13
src/units/threejs/lightBall.js

@@ -6,8 +6,9 @@ export const LightBallClass = {
         this.view = options.view;
         this.cube = null;
         this.mesh = null;
-        this.color = '#00FF7F';
-        this.radius = 500;
+        this.color = options.color;
+        this.radius = options.radius;
+        this.points = options.points;
         this.uniforms = null;
         this._camera = null;
     },
@@ -69,17 +70,29 @@ export const LightBallClass = {
      * @method getGeometry
      */
     getGeometry() {
-        let cenP = [];
-        let position = [0, 0, 1000];
-        this.webgl.toRenderCoordinates(this.view,  [position[0], position[1], position[2]], 0, this.view.spatialReference, cenP, 0, 1);
-        let sphereGeom = new THREE.SphereGeometry(this.radius, 200, 200, 0, Math.PI * 2, 0, Math.PI / 2);//半球几何
-        this.material = this.getMaterial();
-        let object3D = new THREE.Object3D();
-        let mesh = new THREE.Mesh(sphereGeom.clone(), this.material);
-        mesh.rotateZ(-Math.PI /2 );//绕x轴旋转
-        object3D.add(mesh);
-        object3D.position.set(cenP[0], cenP[1], cenP[2]);
-        this.scene.add(object3D);
+        const material = this.getMaterial(); // 创建共享材质
+        this.points.forEach(point => {
+            let cenP = [];
+            this.webgl.toRenderCoordinates(
+                this.view,
+                [point[0], point[1], point[2]],
+                0,
+                this.view.spatialReference,
+                cenP,
+                0,
+                1
+            );
+
+            const sphereGeom = new THREE.SphereGeometry(this.radius, 200, 200);
+            const mesh = new THREE.Mesh(sphereGeom, material);
+            mesh.rotateZ(-Math.PI / 2);
+
+            const object3D = new THREE.Object3D();
+            object3D.add(mesh);
+            object3D.position.set(cenP[0], cenP[1], cenP[2]);
+
+            this.scene.add(object3D);
+        });
     },
     /**
      * 创建材质
@@ -87,6 +100,7 @@ export const LightBallClass = {
      * @method getMaterial
      */
     getMaterial() {
+        debugger
         this.uniforms = {
             scale: { type: "f", value: -1.0 },
             bias: { type: "f", value: 1.2 },