Forráskód Böngészése

低空修改250227

zhiyuan-007 1 hónapja
szülő
commit
0a78d3ab66

BIN
dist (2).zip


BIN
dist (3).zip


BIN
dist (4).zip


BIN
dist.zip


+ 82 - 13
src/components/mapJK.vue

@@ -53,9 +53,15 @@ import routeList from '../config/routeList.json'
 import {
   getAvoidRoute,
   getBuildingPoint,
-  getNoFlyPointInterface, getPowerInterface, getPowerPoint, getPowerPointByPolygon, getProxyToken,
+  getNoFlyPointInterface,
+  getPowerInterface,
+  getPowerPoint,
+  getPowerPointByFunnel,
+  getPowerPointByPolygon,
+  getProxyToken,
   getRiverPointInterface,
-  getRoadPointInterface, gridBaseInfo
+  getRoadPointInterface,
+  gridBaseInfo
 } from "../service/http.js";
 import FeaturePointsPlottingEvent from "../units/map/FeaturePointsPlottingEvent.js";
 import FeaturePolygonPlottingEvent from "../units/map/FeaturePolygonPlottingEvent.js";
@@ -64,7 +70,7 @@ import AddGraphicsEvent from "../units/map/AddGraphicsEvent.js";
 import GeometryMeshEffect from "../units/map/GeometryMeshEffect.js";
 import QueryIn2D from "../units/map/QueryIn2D.js";
 import AddFlowPathEvent from "../units/map/AddFlowPathEvent.js";
-import MoveCarEvent from "../units/map/MoveCarEvent.js";
+import MovePointStreamEvent from "../units/map/MovePointStreamEvent.js";
 export default {
   name: "mapJK",
   setup(){
@@ -103,7 +109,7 @@ export default {
     let currentShowGridId = null;
     let realFlyPointDataQueue = [];
     let addFlowPathEvent = null;
-    let moveCarEvent = null;
+    let movePointEvent = null;
     onMounted(() =>{
       bus.on('CreateMap',() =>{
         MapReady = $.Deferred();
@@ -308,12 +314,15 @@ export default {
           case "FlowPathEffect":
             flowPathEffect(params);
             break;
-          case "MoveCar":
-            moveCar(params);
+          case "MovePoint":
+            movePoint(params);
             break;
           case "GetOccupyCube":
             getOccupyCube(params);
             break;
+          case "GetFunnelCube":
+            getFunnelCube(params);
+            break;
         }
       }
       function setBackground(params){
@@ -2491,7 +2500,7 @@ export default {
       }
 
 
-      function moveCar(params){
+      function movePoint(params){
         let status = params.status;
         const connectFlyPointWebSocket = (status) => {
           if(status === "show"){
@@ -2505,10 +2514,10 @@ export default {
               };
               flyPointSocket.onmessage = (messageEvent) => {
                 let messages = JSON.parse(messageEvent.data);
-                if(moveCarEvent){
-                  moveCarEvent.update(messages)
+                if(movePointEvent){
+                  movePointEvent.update(messages)
                 }else{
-                  moveCarEvent = new MoveCarEvent({
+                  movePointEvent = new MovePointStreamEvent({
                     view:m_view,
                     map:m_map,
                     data:messages
@@ -2527,9 +2536,9 @@ export default {
             }
           }else{
             if(flyPointSocket){
-              // if(moveCarEvent){
-              //   moveCarEvent.clear();
-              //   moveCarEvent = null;
+              // if(movePointEvent){
+              //   movePointEvent.clear();
+              //   movePointEvent = null;
               // }
               flyPointSocket.close();
             }
@@ -2618,6 +2627,66 @@ export default {
         })
       }
 
+      function getFunnelCube(params){
+        let id = params.id;
+        let lastId = params.lastId;
+        let status = params.status;
+        let level = params.level;
+        let coneHeight = params.coneHeight;
+        let cylinderHeight = params.cylinderHeight;
+        let topRadius = params.topRadius;
+        let bottomRadius = params.bottomRadius;
+        let point = params.point;
+        if(status === "hide"){
+          showThreeCubeDetail({
+            id:params.id,
+            status:"hide"
+          });
+          currentShowGridId = null;
+          return
+        }
+        showThreeCubeDetail({
+          id:params.lastId,
+          status:"hide"
+        });
+        currentShowGridId = id;
+        getSixPowerByFunnel({
+          id,
+          lastId,
+          status,
+          coneHeight,
+          cylinderHeight,
+          level,
+          topRadius,
+          bottomRadius,
+          point
+        });
+      }
+
+
+      function getSixPowerByFunnel(params){
+        getPowerPointByFunnel({
+          point:params.point,
+          coneHeight:params.coneHeight,
+          cylinderHeight:params.cylinderHeight,
+          level: params.level,
+          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
+          }
+          debugger
+          showThreeCubeDetail({
+            "id":params.id,
+            "status":params.status,
+            "size":size,
+            "points":res.data.data.list,
+          })
+        })
+      }
 
     })
   }

+ 2 - 2
src/components/mapTest.vue

@@ -74,8 +74,8 @@ export default {
       //加载地图插件
       bridge = new CityGIS.Bridge({
         id:"i_map",
-        //url:'https://cimweb.zjw.sh.cegn.cn:2007/map-tool-widget-4301227/#/jk_map',
-        url:'http://localhost:5173/map-tool-widget-4301227/#/jk_map',
+        //url:'https://cimweb.zjw.sh.cegn.cn:2007/map-tool-widget/#/jk_map',
+        url:'http://localhost:5173/map-tool-widget/#/jk_map',
         onReady:function (){
           // console.log("地图创建完成");
         }

+ 26 - 7
src/config/basicTool.json

@@ -42,7 +42,7 @@
             "title":"BaseMap",
             "visible": true,
             "opacity": 1,
-            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDA0NTIxNTYsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.uI40kUANA3VqXUYhxXvEgY0TzdqOAeZkulfdtZygeik",
+            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDA2NDA5OTMsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.ZUEicfY9y4eC6agPaQORO4LU74iWiJWQHK6VmeUVjGM",
             "token": ""
           }
         }
@@ -1863,7 +1863,7 @@
               {
                 "type": "polyline",
                 "shape": {
-                  "height": 300,
+                  "radius": 10,
                   "paths": [
                     [
                       [
@@ -2079,14 +2079,11 @@
       },
       {
         "code": "1-47",
-        "title": "多移动",
+        "title": "多移动",
         "data": {
-          "ActionName": "MoveCar",
+          "ActionName": "MovePoint",
           "Parameters": {
             "status": "show",
-            "flyList": {"date": "2025-02-20 16:29:22",
-              "step": 2,
-              "second":3},
             "token": ""
           }
         }
@@ -2105,6 +2102,28 @@
             "token": ""
           }
         }
+      },
+      {
+        "code": "1-49",
+        "title": "获取漏斗网格",
+        "data": {
+          "ActionName": "GetFunnelCube",
+          "Parameters": {
+            "id" : "1",
+            "status" : "show",
+            "level": 23,
+            "point": {
+              "x": 4215.071719858532,
+              "y": 7389.792634183172,
+              "z": 0
+            },
+            "bottomRadius": 30,
+            "topRadius": 200,
+            "coneHeight": 200,
+            "cylinderHeight": 100,
+            "token": ""
+          }
+        }
       }
     ]
   }

+ 18 - 0
src/service/http.js

@@ -125,6 +125,24 @@ export function getPowerPointByPolygon(params){
 }
 
 
+//漏斗查询权重网格
+export function getPowerPointByFunnel(params){
+    return requestNetPost({
+        url:'/grid/search/cutUsingFunnel',
+        // header:{
+        //     'Content-Encoding': 'gzip'
+        // },
+        data:{
+            "level": params.level,
+            "point": params.point,
+            "coneHeight": params.coneHeight,
+            "cylinderHeight": params.cylinderHeight,
+            "topRadius": params.topRadius,
+            "bottomRadius": params.bottomRadius
+        }
+    })
+}
+
 //查询规避路线
 export function getAvoidRoute(params){
     return requestNetPost({

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

@@ -60,8 +60,8 @@ class GeometryMeshEffect{
                                 "material": {
                                     "color": item.shape.color
                                 },
-                                "width": 30,
-                                "height": 30
+                                "width": item.shape.radius,
+                                "height": item.shape.radius
                             }
                         ]
                     }

+ 0 - 66
src/units/map/MoveCarEvent.js

@@ -1,66 +0,0 @@
-import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
-import Graphic from "@arcgis/core/Graphic.js";
-import Point from "@arcgis/core/geometry/Point.js";
-import dangerIcon from "../../assets/预警.png";
-import levelFrIcon from "../../assets/三维_点.png";
-class MoveCarEvent {
-    constructor(options) {
-        this.view = options.view;
-        this.data = options.data;
-        this.graphicsLayer = null;
-        this.ready();
-    }
-     ready(){
-        this.graphicsLayer = new GraphicsLayer({
-            id:"moveCar",
-            title:"汽车移动"
-        });
-        this.view.map.add(this.graphicsLayer);
-        this.setGraphics(this.data);
-     }
-     update(data){
-        //更新点位geometry以及attribute信息
-         this.graphicsLayer.removeAll();
-         this.setGraphics(data);
-         this.updateTrajectories(data);
-     }
-     setGraphics(data){
-         for(let key in data){
-             this.graphicsLayer.add(new Graphic({
-                 geometry:new Point({
-                     x:data[key].x,
-                     y:data[key].y,
-                     z:data[key].z,
-                     spatialReference:this.view.spatialReference,
-                 }),
-                 symbol: {
-                     type: "point-3d",
-                     symbolLayers:[{
-                         type: "icon",
-                         resource: {
-                             href: levelFrIcon
-                         },
-                         size: 50,
-                         outline: {
-                             color: "white",
-                             size: 2
-                         }
-                     }]
-                 },
-                 attributes:{
-                     id:data[key].id,
-                     name:data[key].name,
-                     type:data[key].overall,
-                 },
-             }));
-         }
-     }
-     clear(){
-         this.graphicsLayer.removeAll();
-         this.view.map.remove(this.graphicsLayer);
-         this.graphicsLayer = null;
-     }
-
-}
-
-export default MoveCarEvent;

+ 0 - 132
src/units/map/MoveCarFeatureEvent.js

@@ -1,132 +0,0 @@
-import FeatureLayer from "@arcgis/core/layers/FeatureLayer";
-import Point from "@arcgis/core/geometry/Point.js";
-import Graphic from "@arcgis/core/Graphic.js";
-import dangerIcon from "../../assets/预警.png";
-import levelFrIcon from "../../assets/三维_点.png";
-
-
-class MoveCarFeatureEvent{
-    constructor(options) {
-        this.view = options.view;
-        this.data = options.data;
-        this.featureLayer = null;
-        this.ready();
-    }
-    ready(){
-        let resultPointGraphics = [];
-        this.data.forEach((item) =>{
-            let point = new Point({
-                type: "point", // autocasts as new Point()
-                x: item.geometry.x,
-                y: item.geometry.y,
-                z: item.geometry.z,
-                spatialReference: this.view.spatialReference
-            })
-            let graphic = new Graphic({
-                geometry: point,
-                attributes: item.attributes
-            });
-            resultPointGraphics.push(graphic);
-        })
-        this.featureLayer = new FeatureLayer({
-            id:"MoveCarFeature",
-            source: resultPointGraphics,  //还要添加各类的图片renderer
-            objectIdField: "ObjectID", // 必须字段,定义唯一标识
-            fields: [
-                { name: "ObjectID", type: "oid" },
-                { name: "type", type: "string" },
-                { name: "name", type: "string" }
-            ],
-            renderer: {
-                type: "unique-value", // 基于唯一值的渲染器
-                field: "type", // 按照 id 字段渲染
-                uniqueValueInfos: [
-                    {
-                        value: "1", // 唯一值对应 id
-                        symbol: {
-                            type: "point-3d",
-                            symbolLayers: [
-                                {
-                                    type: "icon",
-                                    resource: {
-                                        href: dangerIcon
-                                    },
-                                    size: 50,
-                                    outline: {
-                                        color: "white",
-                                        size: 2
-                                    }
-                                }
-                            ]
-                        }
-                    },
-                    {
-                        value: "2", // 唯一值对应 id
-                        symbol: {
-                            type: "point-3d",
-                            symbolLayers: [
-                                {
-                                    type: "icon",
-                                    resource: {
-                                        href: levelFrIcon
-                                    },
-                                    size: 50,
-                                    outline: {
-                                        color: "white",
-                                        size: 2
-                                    }
-                                }
-                            ]
-                        }
-                    }
-                ],
-            },
-            elevationInfo: { mode: "relative-to-ground" }, // 相对于建筑高度
-            labelingInfo: [{
-                labelExpressionInfo: {
-                    value: "{name}"
-                },
-                labelPlacement: "above-center", // 可以调整为 “above-center” 或 “below-center”等
-                symbol: {
-                    type: "label-3d", // autocasts as new LabelSymbol3D()
-                    symbolLayers: [
-                        {
-                            type: "text", // autocasts as new TextSymbol3DLayer()
-                            material: [35, 250, 250, 1],
-                            font: {  // autocasts as new Font()
-                                size: 12,
-                                weight: "bold"
-                            },
-                        }
-                    ],
-                }
-            }]
-        });
-        this.view.map.add(this.featureLayer);
-    }
-    update(data){
-        let resultPointGraphics = [];
-        data.forEach((item) =>{
-            let point = new Point({
-                type: "point", // autocasts as new Point()
-                x: item.geometry.x,
-                y: item.geometry.y,
-                z: item.geometry.z,
-                spatialReference: this.view.spatialReference
-            })
-            let graphic = new Graphic({
-                geometry: point,
-                attributes: item.attributes
-            });
-            resultPointGraphics.push(graphic);
-        })
-        this.featureLayer.source = resultPointGraphics;
-        this.featureLayer.refresh()
-    }
-    clear(){
-        this.view.map.remove(this.featureLayer);
-        this.featureLayer= null;
-    }
-}
-
-export default MoveCarFeatureEvent

+ 118 - 0
src/units/map/MovePointEvent.js

@@ -0,0 +1,118 @@
+import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
+import Graphic from "@arcgis/core/Graphic.js";
+import Point from "@arcgis/core/geometry/Point.js";
+import Polyline from "@arcgis/core/geometry/Polyline.js";
+import dangerIcon from "../../assets/预警.png";
+import levelFrIcon from "../../assets/三维_点.png";
+
+class MovePointEvent {
+    constructor(options) {
+        this.view = options.view;
+        this.data = options.data;
+        this.graphicsLayer = null;
+        // 用于存储每个id的历史轨迹数据
+        this.historyPaths = {};
+        // 用于存储当前点位的图形
+        this.currentPointGraphics = {};
+        this.ready();
+    }
+
+    ready() {
+        this.graphicsLayer = new GraphicsLayer({
+            id: "moveCar",
+            title: "汽车移动"
+        });
+        this.view.map.add(this.graphicsLayer);
+        this.setGraphics(this.data);
+    }
+
+    update(data) {
+        // 更新点位和轨迹线
+        this.clearCurrentPoints(); // 清除之前的点位
+        this.setGraphics(data); // 添加最新点位
+        this.updateTrajectories(data); // 更新轨迹线
+    }
+
+    setGraphics(data) {
+        for (let key in data) {
+            const point = new Point({
+                x: data[key].x,
+                y: data[key].y,
+                z: data[key].z,
+                spatialReference: this.view.spatialReference,
+            });
+
+            // 添加最新点位图形
+            const pointGraphic = new Graphic({
+                geometry: point,
+                symbol: {
+                    type: "point-3d",
+                    symbolLayers: [{
+                        type: "icon",
+                        resource: {
+                            href: levelFrIcon
+                        },
+                        size: 50,
+                        outline: {
+                            color: "white",
+                            size: 2
+                        }
+                    }]
+                },
+                attributes: {
+                    id: data[key].id,
+                    name: data[key].name,
+                    type: data[key].overall,
+                },
+            });
+
+            this.graphicsLayer.add(pointGraphic);
+            // 存储当前点位图形
+            this.currentPointGraphics[data[key].id] = pointGraphic;
+
+            // 存储历史轨迹数据
+            if (!this.historyPaths[data[key].id]) {
+                this.historyPaths[data[key].id] = [];
+            }
+            this.historyPaths[data[key].id].push([point.x, point.y, point.z]);
+        }
+    }
+
+    updateTrajectories(data) {
+        for (let key in data) {
+            const id = data[key].id;
+            const paths = this.historyPaths[id];
+
+            if (paths && paths.length > 1) {
+                // 创建轨迹线
+                const polyline = new Polyline({
+                    paths: [paths],
+                    spatialReference: this.view.spatialReference
+                });
+
+                // 添加轨迹线图形
+                this.graphicsLayer.add(new Graphic({
+                    geometry: polyline
+                }));
+            }
+        }
+    }
+
+    clearCurrentPoints() {
+        // 清除之前的点位图形
+        for (let id in this.currentPointGraphics) {
+            this.graphicsLayer.remove(this.currentPointGraphics[id]);
+        }
+        this.currentPointGraphics = {};
+    }
+
+    clear() {
+        this.graphicsLayer.removeAll();
+        this.view.map.remove(this.graphicsLayer);
+        this.graphicsLayer = null;
+        this.historyPaths = {};
+        this.currentPointGraphics = {};
+    }
+}
+
+export default MovePointEvent;

+ 166 - 0
src/units/map/MovePointStreamEvent.js

@@ -0,0 +1,166 @@
+import StreamLayer from "@arcgis/core/layers/StreamLayer.js";
+import levelFrIcon from "../../assets/三维_点.png";
+import dangerIcon from "../../assets/预警.png";
+class MovePointStreamEvent {
+    constructor(options) {
+        this.view = options.view;
+        this.streamLayer = null;
+        this.currentFeatures = [];
+        this.ready();
+    }
+
+    ready() {
+        // 创建 StreamLayer
+        this.streamLayer = new StreamLayer({
+            fields: [
+                { name: "objectId", type: "oid" },
+                { name: "name", type: "string" },
+                { name: "overall", type: "string" },
+                { name: "trackId", type: "long" }, // 轨迹字段
+            ],
+            timeInfo: {
+                trackIdField: "trackId" // required
+            },
+            geometryType: "point",
+            objectIdField: "objectId",
+                renderer: {
+                    type: "unique-value",
+                    field: "overall",
+                    uniqueValueInfos: [
+                        {
+                            value: "SAFE",
+                            symbol: {
+                                type: "point-3d",
+                                symbolLayers: [
+                                    {
+                                        type: "icon",
+                                        resource: {
+                                            href: levelFrIcon
+                                        },
+                                        size: 50,
+                                        outline: {
+                                            color: "white",
+                                            size: 2
+                                        }
+                                    }
+                                ]
+                            }
+                        },
+                        {
+                            value: "DANGER",
+                            symbol: {
+                                type: "point-3d",
+                                symbolLayers: [
+                                    {
+                                        type: "icon",
+                                        resource: {
+                                            href: dangerIcon
+                                        },
+                                        size: 50,
+                                        outline: {
+                                            color: "white",
+                                            size: 2
+                                        }
+                                    }
+                                ]
+                            }
+                        },
+                        {
+                            value: "ILLEGAL",
+                            symbol: {
+                                type: "point-3d",
+                                symbolLayers: [
+                                    {
+                                        type: "icon",
+                                        resource: {
+                                            href: dangerIcon
+                                        },
+                                        size: 50,
+                                        outline: {
+                                            color: "white",
+                                            size: 2
+                                        }
+                                    }
+                                ]
+                            }
+                        }
+                    ]
+                },
+            elevationInfo: { mode: "relative-to-ground" },
+            labelingInfo: [{
+                labelExpressionInfo: {
+                    value: "{trackId}"
+                },
+                labelPlacement: "above-center",
+                symbol: {
+                    type: "label-3d",
+                    symbolLayers: [
+                        {
+                            type: "text",
+                            material: [35, 250, 250, 1],
+                            font: {
+                                size: 12,
+                                weight: "bold"
+                            }
+                        }
+                    ]
+                }
+            }]
+        });
+
+        // 将 StreamLayer 添加到地图
+        this.view.map.add(this.streamLayer);
+    }
+
+    update(wsData) {
+        // 假设 this.currentFeatures 是当前显示的点位集合
+        const currentFeatures = this.currentFeatures || [];
+        // 将新数据转换为 Map,方便快速查找
+        const newFeatureMap = new Map(wsData.map(item => [item.flightIdentify, item]));
+        // 找出需要剔除的点位
+        const featuresToRemove = currentFeatures.filter(feature => !newFeatureMap.has(feature.attributes.trackId));
+        // 发送剔除的点位到 StreamLayer
+        console.log("currentFeatures",currentFeatures);
+        console.log("newFeatureMap",newFeatureMap);
+        console.log("featuresToRemove",featuresToRemove);
+        if (featuresToRemove.length > 0) {
+            debugger
+            this.streamLayer.sendMessageToClient({
+                type: "delete",
+                objectIds: featuresToRemove.map(feature => feature.attributes.objectId)
+            });
+        }
+
+        const features = wsData.map((item,index) => {
+            return {
+                geometry: {
+                    type: "point",
+                    x: item.x, // 经度
+                    y: item.y, // 纬度
+                    z: item.z, // 高度(如果没有高度信息,可以设置为 0)
+                    spatialReference: this.view.spatialReference // 使用地图的空间参考
+                },
+                attributes: {
+                    objectId:Math.floor(Math.random() * 10000) + 1, // 唯一标识
+                    name: item.name, // 名称
+                    overall: item.overall, // 状态转换
+                    trackId: item.flightIdentify, // 使用 id 作为 trackId
+                }
+            };
+        });
+        // 发送数据到 StreamLayer
+        this.streamLayer.sendMessageToClient({
+            type: "features",
+            features: features
+        });
+        this.currentFeatures = features;
+    }
+
+    clear() {
+        // 移除 StreamLayer
+        this.view.map.remove(this.streamLayer);
+        this.streamLayer = null;
+    }
+}
+
+export default MovePointStreamEvent;

+ 1 - 1
vite.config.js

@@ -51,6 +51,6 @@ export default defineConfig({
     }
   },
   plugins: [vue()],
-  base:'/map-tool-widget-4301227/',
+  base:'/map-tool-widget/',
   publicDir: resolve('static'),
 })