zhiyuan-007 3 місяців тому
батько
коміт
7584b180ed

+ 175 - 10
src/components/mapJK.vue

@@ -49,6 +49,7 @@ import ws from 'ws';
 import Path from '../config/path_wjc.json'
 
 import {
+  getAvoidRoute,
   getBuildingPoint,
   getNoFlyPointInterface, getPowerInterface, getPowerPoint,
   getRiverPointInterface,
@@ -260,6 +261,19 @@ export default {
           case "GetRealPower2":
             getRealPower2(params);
             break;
+          case "PathConflict":
+            pathConflict(params);
+            break;
+          case "UavBatteryWarning":
+            uavBatteryWarning(params);
+            break;
+          case "UavYawWarning":
+            uavYawWarning(params);
+            break;
+          case "Conflict_fly":
+            conflict_fly(params);
+            break;
+
         }
       }
       function setBackground(params){
@@ -1208,6 +1222,87 @@ export default {
         m_map.add(geometryMeshPrismEffect.graphicsLayer);
       }
 
+      // 路径冲突
+      function pathConflict(params){
+
+        pathPipe({
+          "id": "conflict1",
+          "status": "show",
+          "paths":Path.path_conflict_1,
+          "color": "#438EDB",
+          "intensity": 1.2,
+          "pipeRadius": 5
+        });
+        pathPipe({
+          "id": "conflict2",
+          "status": "show",
+          "paths":Path.path_conflict_2,
+          "color": "#438EDB",
+          "intensity": 1.2,
+          "pipeRadius": 5
+        });
+
+        getRealFlyPoint({
+          flyList:[
+            {
+              "id": "67513a6e-7ce2-4121-9b11-cd6f1d28e02c",
+              "speed":40,
+              "uavid": "87066700-f12d-4b3e-ac77-a55a409dd30b"
+            },
+            {
+              "id": "fba073d1-def3-4f85-9326-dff8a1ac6ea6",
+              "speed":25,
+              "uavid": "9556344a-c055-4156-86d4-bc57930275a2"
+            }
+          ]
+        })
+
+
+      }
+
+      // 无人机电量预警
+      function uavBatteryWarning(params){
+        pathPipe({
+          "id": "conflict1",
+          "status": "show",
+          "paths":Path.path_conflict_1,
+          "color": "#438EDB",
+          "intensity": 1.2,
+          "pipeRadius": 10
+        });
+        getRealFlyPoint({
+          flyList:[
+            {
+              "id": "67513a6e-7ce2-4121-9b11-cd6f1d28e02c",
+              "speed":40,
+              "uavid": "02d47b30-003c-4e7e-89ec-72255c1ebdaf"
+            }
+          ]
+        })
+      }
+
+      //无人机偏航
+      function uavYawWarning(params){
+        pathPipe({
+          "id": "yaw",
+          "status": "show",
+          "paths":Path.yaw_path,
+          "color": "#438EDB",
+          "intensity": 1.2,
+          "pipeRadius": 10
+        });
+        getRealFlyPoint({
+          flyList:[
+            {
+              "id": "6fd0fa45-de0b-4008-8d4d-afaaa15064f3",
+              "speed":40,
+              "uavid": "7e080fe7-dbd4-4be2-aa45-72a28da7f26c"
+            }
+          ]
+        })
+      }
+
+
       function pathPipe(params){
         let id = params.id;
         let status = params.status;
@@ -1243,8 +1338,9 @@ export default {
           return
         }
         let point = params.point;
+        let duration = params.duration;
         if(flyGLTFInstances[uavid]){
-          flyGLTFInstances[uavid].updatePath(point);
+          flyGLTFInstances[uavid].updatePath(point,duration);
         }else{
           let flyGLTFEvent = new FlyGLTFEvent({
             view:m_view,
@@ -1252,34 +1348,76 @@ export default {
             bus,
           })
           flyGLTFEvent.start();
-          flyGLTFEvent.updatePath(point);
+          flyGLTFEvent.updatePath(point,duration);
           flyGLTFInstances[uavid] = flyGLTFEvent;
         }
       }
 
 
+
       function getRealFlyPoint(params){
         const connectWebSocket = () => {
           if(socket){
             socket.send(JSON.stringify(params.flyList));
           }else{
             socket = new WebSocket('ws://58.34.215.19:19259/aircraftRouteSpeedWebSocket');
-
             socket.onopen = () => {
               console.log('WebSocket 连接成功');
               socket.send(JSON.stringify(params.flyList));
             };
-
             socket.onmessage = (messageEvent) => {
               let messages = JSON.parse(messageEvent.data).data;
               messages.forEach(message => {
-                flyGLTF({
-                  id:message.id,
-                  uavid:message.uavid,
-                  status:"show",
-                  point:message.position_cj
-                })
+
+                if(message.overall == "SAFE"){  //安全飞行
+                  flyGLTF({
+                    id:message.id,
+                    uavid:message.uavid,
+                    status:message.routeInfoVO.status == 3?"hide":"show",
+                    duration:message.time,
+                    //duration:3000,
+                    point:message.position_cj
+                  });
+                }else{
+                  if(message.nearestAircraft.status != "SAFE"){  //碰撞
+                    console.log("无人机碰撞异常信息",message);
+
+                    showThreeCubeDetail({
+                      "id":message.uavid,
+                      "status": "show",
+                      "size": {
+                        "x":message.nearestAircraft.gridPath[0].boxSize.latLength,
+                        "y":message.nearestAircraft.gridPath[0].boxSize.lonLength,
+                        "z":message.nearestAircraft.gridPath[0].boxSize.height,
+                      },
+                      "points": message.nearestAircraft.gridPath
+                    })
+                    // if(true){ //悬停结果
+                    //
+                    // }
+                    // if(true){ //新路结果
+                    //
+                    // }
+
+                  }else if(message.noFlyZone != "SAFE"){
+                    console.log("无人机禁飞区信息",message);
+                  }else if(message.routeDeviate != "SAFE"){
+                    console.log("无人机偏航异常信息",message);
+                  }else if(message.electricityWarning != "SAFE"){
+                    console.log("无人机电量异常信息",message);
+                  }else{
+                    flyGLTF({
+                      id:message.id,
+                      uavid:message.uavid,
+                      status:message.routeInfoVO.status == 3?"hide":"show",
+                      duration:message.time,
+                      //duration:3000,
+                      point:message.position_cj
+                    });
+                  }
+                }
               })
+
             };
 
             socket.onerror = (error) => {
@@ -1294,6 +1432,33 @@ export default {
         connectWebSocket();
       }
 
+      //如果是等待,就要设置另一台无人机继续飞行
+      function conflict_wait(){
+
+      }
+
+      function conflict_fly(params){
+        let uavid = params.uavid;
+        let skip_route_id = params.skip_route_id;
+        let distance = params.distance;
+        getAvoidRoute({
+          uavid:uavid,
+          skip_route_id:skip_route_id,
+          distance:distance
+        }).then(res =>{
+          console.log("临时路线",res)
+          pathPipe({
+            "id": uavid+'_change',
+            "status": "show",
+            "paths":[res.data.data.pathAll],
+            "color": "#438EDB",
+            "intensity": 1.2,
+            "pipeRadius": 5
+          });
+        })
+      }
+
+
       function changePointStatus(params){
         flyGLTFInstances[params.uavid].followPath(params.isFollow);
       }

+ 37 - 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.eyJleHAiOjE3MzY0ODgzOTEsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.n4_MSJ1nd3g5cz78r6YOuuzdngYU1UMMpuQmeDMG-8k",
+            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzY1NjM2NzMsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.1IzaPYUa56F26oMgLR-i05_XvNNpGm6anKdcwTkE-3g",
             "token": ""
           }
         }
@@ -1340,6 +1340,42 @@
             "token": ""
           }
         }
+      },
+      {
+        "code": "1-39",
+        "title": "碰撞模拟",
+        "data": {
+          "ActionName": "PathConflict",
+          "Parameters": {
+            "status": "show",
+            "token": ""
+          }
+        }
+      },
+      {
+        "code": "1-40",
+        "title": "电量预警",
+        "data": {
+          "ActionName": "UavBatteryWarning",
+          "Parameters": {
+            "status": "show",
+            "token": ""
+          }
+        }
+      },
+      {
+        "code": "1-41",
+        "title": "无人机规避飞行",
+        "data": {
+          "ActionName": "Conflict_fly",
+          "Parameters": {
+            "status": "show",
+            "uavid": "87066700-f12d-4b3e-ac77-a55a409dd30b",
+            "skip_route_id": "fba073d1-def3-4f85-9326-dff8a1ac6ea6",
+            "distance": 1280,
+            "token": ""
+          }
+        }
       }
     ]
   }

+ 216 - 0
src/config/path_wjc.json

@@ -1249,5 +1249,221 @@
       "geometry": { "type": "point", "x": 4171.307055475023844,   "y":  7378.201835652576847, "z": 100 },
       "attributes": { "name": "五角场广场" }
     }
+  ],
+
+  "path_conflict_1": [
+    [
+      [3425.0653076171875, 9568.179077148438, 0.0],
+      [3425.0653076171875, 9568.179077148438, 100.0],
+      [3536.3831176757812, 8913.286499023438, 100.0],
+      [3537.8319091796875, 8909.162292480469, 100.0],
+      [3539.9503173828125, 8905.338684082031, 100.0],
+      [3542.6785278320312, 8901.923278808594, 100.0],
+      [3545.7293090820312, 8899.200073242188, 100.0],
+      [3546.3682861328125, 8893.881896972656, 100.0],
+      [3547.5333251953125, 8888.727722167969, 100.0],
+      [3549.14208984375, 8883.694274902344, 100.0],
+      [3551.1823120117188, 8878.819885253906, 100.0],
+      [3951.3837280273438, 8038.2056884765625, 100.0],
+      [3954.8961181640625, 8031.551696777344, 100.0],
+      [3957.7396850585938, 8024.585510253906, 100.0],
+      [3959.8869018554688, 8017.374084472656, 100.0],
+      [3961.3170776367188, 8009.9873046875, 100.0],
+      [3961.918701171875, 8003.544128417969, 100.0],
+      [3962.0941162109375, 8002.903503417969, 100.0],
+      [3962.3436889648438, 8002.287902832031, 100.0],
+      [3962.6641235351562, 8001.706115722656, 100.0],
+      [4199.910095214844, 7472.3980712890625, 100.0],
+      [4201.878723144531, 7467.203674316406, 100.0],
+      [4204.222473144531, 7462.16748046875, 100.0],
+      [4209.7125244140625, 7459.4365234375, 100.0],
+      [4214.838317871094, 7456.071716308594, 100.0],
+      [4219.527099609375, 7452.1204833984375, 100.0],
+      [4228.306701660156, 7443.6527099609375, 100.0],
+      [4236.548278808594, 7434.6602783203125, 100.0],
+      [4244.220275878906, 7425.177307128906, 100.0],
+      [4251.293701171875, 7415.239685058594, 100.0],
+      [4257.74169921875, 7404.885498046875, 100.0],
+      [4260.009704589844, 7399.8065185546875, 100.0],
+      [4261.609130859375, 7394.4788818359375, 100.0],
+      [4262.513671875, 7388.990478515625, 100.0],
+      [4262.708923339844, 7383.4315185546875, 100.0],
+      [4262.191101074219, 7377.893310546875, 100.0],
+      [4260.9688720703125, 7372.4666748046875, 100.0],
+      [4259.156494140625, 7367.457275390625, 100.0],
+      [4257.8917236328125, 7362.282287597656, 100.0],
+      [4257.1890869140625, 7357.001525878906, 100.0],
+      [4257.056884765625, 7351.676086425781, 100.0],
+      [4257.496276855469, 7346.366882324219, 100.0],
+      [4258.502502441406, 7341.135498046875, 100.0],
+      [4266.70068359375, 7319.768493652344, 100.0],
+      [4274.34130859375, 7298.1956787109375, 100.0],
+      [4281.4193115234375, 7276.431884765625, 100.0],
+      [4287.929870605469, 7254.49169921875, 100.0],
+      [4289.882873535156, 7248.419677734375, 100.0],
+      [4690.9180908203125, 6370.952880859375, 100.0],
+      [4691.261474609375, 6368.703308105469, 100.0],
+      [4691.277893066406, 6366.427490234375, 100.0],
+      [4690.9666748046875, 6364.173095703125, 100.0],
+      [4690.850891113281, 6363.689697265625, 100.0],
+      [4690.808288574219, 6363.194274902344, 100.0],
+      [4690.8397216796875, 6362.6978759765625, 100.0],
+      [4690.944519042969, 6362.2119140625, 100.0],
+      [5115.693115234375, 5254.418884277344, 100.0],
+      [5116.815490722656, 5250.711730957031, 100.0],
+      [5117.481689453125, 5246.8961181640625, 100.0],
+      [5117.68212890625, 5243.028076171875, 100.0],
+      [5117.413879394531, 5239.163879394531, 100.0],
+      [5117.413879394531, 5239.163879394531, 0.0]
+    ]
+  ],
+
+  "path_conflict_2": [
+    [
+      [2689.305908203125, 6948.134704589844, 0.0],
+      [2689.305908203125, 6948.134704589844, 100.0],
+      [2697.8638916015625, 6950.475524902344, 100.0],
+      [2706.5574951171875, 6953.4666748046875, 100.0],
+      [3563.0206909179688, 7326.209899902344, 100.0],
+      [3567.3665161132812, 7328.419128417969, 100.0],
+      [3571.4088745117188, 7331.1439208984375, 100.0],
+      [3575.0869140625, 7334.343322753906, 100.0],
+      [3578.3455200195312, 7337.9691162109375, 100.0],
+      [3581.4655151367188, 7336.052307128906, 100.0],
+      [3584.8515014648438, 7334.657897949219, 100.0],
+      [3588.4166870117188, 7333.821716308594, 100.0],
+      [3592.0695190429688, 7333.5653076171875, 100.0],
+      [3592.7387084960938, 7333.5819091796875, 100.0],
+      [4151.708923339844, 7347.395690917969, 100.0],
+      [4154.4757080078125, 7347.615295410156, 100.0],
+      [4157.184509277344, 7348.2200927734375, 100.0],
+      [4159.781921386719, 7349.198303222656, 100.0],
+      [4160.521484375, 7349.796875, 100.0],
+      [4161.348083496094, 7350.267883300781, 100.0],
+      [4162.239685058594, 7350.5994873046875, 100.0],
+      [4260.9688720703125, 7372.4666748046875, 100.0],
+      [4264.992492675781, 7374.507080078125, 100.0],
+      [4618.626892089844, 7471.709899902344, 100.0],
+      [4619.468688964844, 7472.126708984375, 100.0],
+      [4620.235107421875, 7472.669494628906, 100.0],
+      [4620.90771484375, 7473.3250732421875, 100.0],
+      [4621.4700927734375, 7474.0772705078125, 100.0],
+      [4621.9080810546875, 7474.9080810546875, 100.0],
+      [4621.9581298828125, 7475.0020751953125, 100.0],
+      [4622.021484375, 7475.0875244140625, 100.0],
+      [4622.096923828125, 7475.1627197265625, 100.0],
+      [4622.182678222656, 7475.225891113281, 100.0],
+      [4622.276672363281, 7475.275695800781, 100.0],
+      [4622.3770751953125, 7475.311096191406, 100.0],
+      [5683.741271972656, 7939.3779296875, 100.0],
+      [5688.888122558594, 7942.257873535156, 100.0],
+      [5693.623291015625, 7945.773681640625, 100.0],
+      [5697.868713378906, 7949.86767578125, 100.0],
+      [5701.5543212890625, 7954.471923828125, 100.0],
+      [5704.619323730469, 7959.510681152344, 100.0],
+      [5707.0133056640625, 7964.900695800781, 100.0],
+      [5708.696472167969, 7970.553283691406, 100.0],
+      [5708.923278808594, 7971.551696777344, 100.0],
+      [5709.3197021484375, 7972.4957275390625, 100.0],
+      [5709.873474121094, 7973.356689453125, 100.0],
+      [5710.568298339844, 7974.108703613281, 100.0],
+      [5711.382873535156, 7974.7291259765625, 100.0],
+      [5712.29248046875, 7975.198913574219, 100.0],
+      [6282.6414794921875, 8181.8341064453125, 100.0],
+      [6286.0831298828125, 8183.629089355469, 100.0],
+      [6289.190124511719, 8185.9556884765625, 100.0],
+      [6291.881286621094, 8188.752685546875, 100.0],
+      [6294.086486816406, 8191.9468994140625, 100.0],
+      [6294.086486816406, 8191.9468994140625, 0.0]
+    ]
+  ],
+
+  "low_battery":  [
+    [
+      [2689.305908203125, 6948.134704589844, 0.0],
+      [2689.305908203125, 6948.134704589844, 100.0],
+      [2697.8638916015625, 6950.475524902344, 100.0],
+      [2706.5574951171875, 6953.4666748046875, 100.0],
+      [3563.0206909179688, 7326.209899902344, 100.0],
+      [3567.3665161132812, 7328.419128417969, 100.0],
+      [3571.4088745117188, 7331.1439208984375, 100.0],
+      [3575.0869140625, 7334.343322753906, 100.0],
+      [3578.3455200195312, 7337.9691162109375, 100.0],
+      [3581.4655151367188, 7336.052307128906, 100.0],
+      [3584.8515014648438, 7334.657897949219, 100.0],
+      [3588.4166870117188, 7333.821716308594, 100.0],
+      [3592.0695190429688, 7333.5653076171875, 100.0],
+      [3592.7387084960938, 7333.5819091796875, 100.0],
+      [4151.708923339844, 7347.395690917969, 100.0],
+      [4154.4757080078125, 7347.615295410156, 100.0],
+      [4157.184509277344, 7348.2200927734375, 100.0],
+      [4159.781921386719, 7349.198303222656, 100.0],
+      [4160.521484375, 7349.796875, 100.0],
+      [4161.348083496094, 7350.267883300781, 100.0],
+      [4162.239685058594, 7350.5994873046875, 100.0],
+      [4260.9688720703125, 7372.4666748046875, 100.0],
+      [4264.992492675781, 7374.507080078125, 100.0],
+      [4618.626892089844, 7471.709899902344, 100.0],
+      [4619.468688964844, 7472.126708984375, 100.0],
+      [4620.235107421875, 7472.669494628906, 100.0],
+      [4620.90771484375, 7473.3250732421875, 100.0],
+      [4621.4700927734375, 7474.0772705078125, 100.0],
+      [4621.9080810546875, 7474.9080810546875, 100.0],
+      [4621.9581298828125, 7475.0020751953125, 100.0],
+      [4622.021484375, 7475.0875244140625, 100.0],
+      [4622.096923828125, 7475.1627197265625, 100.0],
+      [4622.182678222656, 7475.225891113281, 100.0],
+      [4622.276672363281, 7475.275695800781, 100.0],
+      [4622.3770751953125, 7475.311096191406, 100.0],
+      [5683.741271972656, 7939.3779296875, 100.0],
+      [5688.888122558594, 7942.257873535156, 100.0],
+      [5693.623291015625, 7945.773681640625, 100.0],
+      [5697.868713378906, 7949.86767578125, 100.0],
+      [5701.5543212890625, 7954.471923828125, 100.0],
+      [5704.619323730469, 7959.510681152344, 100.0],
+      [5707.0133056640625, 7964.900695800781, 100.0],
+      [5708.696472167969, 7970.553283691406, 100.0],
+      [5708.923278808594, 7971.551696777344, 100.0],
+      [5709.3197021484375, 7972.4957275390625, 100.0],
+      [5709.873474121094, 7973.356689453125, 100.0],
+      [5710.568298339844, 7974.108703613281, 100.0],
+      [5711.382873535156, 7974.7291259765625, 100.0],
+      [5712.29248046875, 7975.198913574219, 100.0],
+      [6282.6414794921875, 8181.8341064453125, 100.0],
+      [6286.0831298828125, 8183.629089355469, 100.0],
+      [6289.190124511719, 8185.9556884765625, 100.0],
+      [6291.881286621094, 8188.752685546875, 100.0],
+      [6294.086486816406, 8191.9468994140625, 100.0],
+      [6294.086486816406, 8191.9468994140625, 0.0]
+    ]
+  ],
+
+  "yaw_path": [
+    [
+      [5708.696472167969, 7970.553283691406, 0.0],
+      [5707.0133056640625, 7964.900695800781, 100.0],
+      [5704.619323730469, 7959.510681152344, 100.0],
+      [5701.5543212890625, 7954.471923828125, 100.0],
+      [5697.868713378906, 7949.86767578125, 100.0],
+      [5693.623291015625, 7945.773681640625, 100.0],
+      [5688.888122558594, 7942.257873535156, 100.0],
+      [5683.741271972656, 7939.3779296875, 100.0],
+      [4622.3770751953125, 7475.311096191406, 100.0],
+      [4622.276672363281, 7475.275695800781, 100.0],
+      [4622.182678222656, 7475.225891113281, 100.0],
+      [4622.096923828125, 7475.1627197265625, 100.0],
+      [4622.021484375, 7475.0875244140625, 100.0],
+      [4621.9581298828125, 7475.0020751953125, 100.0],
+      [4621.9080810546875, 7474.9080810546875, 100.0],
+      [4621.4700927734375, 7474.0772705078125, 100.0],
+      [4620.90771484375, 7473.3250732421875, 100.0],
+      [4620.235107421875, 7472.669494628906, 100.0],
+      [4619.468688964844, 7472.126708984375, 100.0],
+      [4618.626892089844, 7471.709899902344, 100.0],
+      [4264.992492675781, 7374.507080078125, 100.0],
+      [4260.9688720703125, 7372.4666748046875, 100.0],
+      [4260.9688720703125, 7372.4666748046875, 0.0]
+    ]
   ]
+
 }

+ 15 - 2
src/service/http.js

@@ -19,7 +19,10 @@ export function gridBaseInfo(params){
 //查询权重
 export function getPowerPoint(params){
     return requestNetPost({
-        url:'/grid/search/calculateWeight',
+        url:'/grid/search/v2/calculateWeight',
+        // header:{
+        //     'Content-Encoding': 'gzip'
+        // },
         data:{
             "locationPoint": {
                 "mapX":  params.x,
@@ -46,7 +49,17 @@ export function getPowerPoint(params){
     })
 }
 
-
+//查询规避路线
+export function getAvoidRoute(params){
+    return requestNetPost({
+        url:'/routePlan/search/routeSkipPath',
+        data:{
+            "uavid": params.uavid,
+            "skip_route_id": params.skip_route_id,
+            "distance": params.distance
+        }
+    })
+}
 
 //查询建筑
 export function getBuildingPoint(params){

+ 2 - 2
src/units/map/FlyGLTFEvent.js

@@ -49,7 +49,7 @@ class FlyGLTFEvent{
     }
 
 
-    updatePath(point){
+    updatePath(point,duration){
         if(this.path.length == 0 ||this.path.length == 1){
             this.path.push(point);
         }else if(this.path.length > 1){
@@ -60,7 +60,7 @@ class FlyGLTFEvent{
             ]
         };
         if(this.path.length > 1){
-            this.flyGLTFEvent.setPathCurve(this.path);
+            this.flyGLTFEvent.setPathCurve(this.path,duration);
             //更新路径属性
             //this.flyGLTFEvent.setPanelType("type")
         }

+ 2 - 2
src/units/threejs/flyGLTF.js

@@ -214,11 +214,11 @@ export const FlyGLTFClass = {
     },
 
 
-    setPathCurve(path){
+    setPathCurve(path,duration){
         this.path = path;
         this.pathProgress = 0;   // 重置路径进度
         this.startTime = Date.now(); // 路径开始时间
-        this.duration = 2500;
+        this.duration = duration || 2500;
       if(this.path.length > 1){
           //用于存储路径的点
           const points = this.path.map(point => {