Преглед на файлове

行政区划空域划设

zhiyuan-007 преди 2 месеца
родител
ревизия
5fb3035912

BIN
src/assets/黄-发光.png


BIN
src/assets/黄-发光1.png


+ 350 - 108
src/components/mapJK.vue

@@ -61,8 +61,9 @@ import FeaturePointsPlottingEvent from "../units/map/FeaturePointsPlottingEvent.
 import FeaturePolygonPlottingEvent from "../units/map/FeaturePolygonPlottingEvent.js";
 import HeatMap from "../units/map/HeatMap.js";
 import AddGraphicsEvent from "../units/map/AddGraphicsEvent.js";
-import GeometryMeshFrustumEffect from "../units/map/GeometryMeshFrustumEffect.js";
+import GeometryMeshEffect from "../units/map/GeometryMeshEffect.js";
 import QueryIn2D from "../units/map/QueryIn2D.js";
+import AddFlowPathEvent from "../units/map/AddFlowPathEvent.js";
 export default {
   name: "mapJK",
   setup(){
@@ -99,7 +100,7 @@ export default {
     let featurePointsPlottingEvent = null;
     let currentShowGridId = null;
     let realFlyPointDataQueue = [];
-    let lastChosenLevelIndex = null;
+    let addFlowPathEvent = null;
     onMounted(() =>{
       bus.on('CreateMap',() =>{
         MapReady = $.Deferred();
@@ -172,6 +173,12 @@ export default {
           case "HeatMap":
             heatMap(params);
             break;
+          case "ThreeDimensionalHeatMap":
+            threeDimensionalHeatMap(params);
+            break;
+          case "PathCompletion":
+            pathCompletion(params);
+            break;
           case "Measurement":
             measurement(params);
             break;
@@ -238,8 +245,8 @@ export default {
           case "GeometryMeshPrismEffect":
             geometryMeshPrismEffect(params);
             break;
-          case "GeometryMeshFrustumEffect":
-            geometryMeshFrustumEffect(params);
+          case "GeometryMeshEffect":
+            geometryMeshEffect(params);
             break;
           case "PathPipe":
             pathPipe(params);
@@ -295,7 +302,9 @@ export default {
           case "SituationAssessment":
             situationAssessment(params);
             break;
-
+          case "FlowPathEffect":
+            flowPathEffect(params);
+            break;
         }
       }
       function setBackground(params){
@@ -519,6 +528,68 @@ export default {
         }
       }
 
+      function threeDimensionalHeatMap(params){
+        let status = params.status;
+        if(addFlowPathEvent){
+          addFlowPathEvent.clear();
+          addFlowPathEvent = null;
+        }
+        if(status === "hide"){
+          return
+        }
+        addFlowPathEvent = new AddFlowPathEvent({
+          view:m_view,
+          paths:params.paths,
+          color:params.color,
+          pipeRadius:params.pipeRadius
+        })
+        addFlowPathEvent.start()
+      }
+
+
+      function pathCompletion(params){
+        let points = params.points;
+        let speed1 = params.speed1;
+        let speed2 = params.speed2;
+        const result = [];
+
+        // 将第一个点添加到结果中
+        result.push(points[0]);
+
+        for (let i = 1; i < points.length; i++) {
+          const prevPoint = points[i - 1];
+          const currPoint = points[i];
+
+          const distance = Math.sqrt(
+              Math.pow(currPoint[0] - prevPoint[0], 2) +
+              Math.pow(currPoint[1] - prevPoint[1], 2) +
+              Math.pow(currPoint[2] - prevPoint[2], 2)
+          );
+
+          const velocity = prevPoint[2] === currPoint[2] ? speed1 : speed2;  // 判断是否是同一高度
+
+          // 计算所需的时间
+          const time = distance / velocity;
+
+          const numPoints = Math.floor(time);  // 根据时间间隔生成插值点数
+
+          for (let j = 1; j <= numPoints; j++) {
+            // 线性插值,计算插值点
+            const t = j / (numPoints + 1);
+            const x = prevPoint[0] + t * (currPoint[0] - prevPoint[0]);
+            const y = prevPoint[1] + t * (currPoint[1] - prevPoint[1]);
+            const z = prevPoint[2] + t * (currPoint[2] - prevPoint[2]);
+
+            result.push([x, y, z]);
+          }
+
+          // 最后将当前点添加到结果中
+          result.push(currPoint);
+        }
+        console.log("离散的点",result)
+        return result;
+      }
+
       function measurement(params){
         let status = params.status;
         let type = params.type;
@@ -626,18 +697,193 @@ export default {
           }
           return
         }
+        debugger
         if(status === "show"){
           if(m_handles.has(scale_handle_id)){
             m_handles.remove(scale_handle_id);
           }
-          let addScaleEvent = new AddScaleEvent({
-            m_view,
-            callBackFunction:showLayersWithScaleEventsReturn
-          });
+          let addScaleEvent;
+          if(scale_handle_id == "scale_handle_cube"){
+            addScaleEvent = new AddScaleEvent({
+              m_view,
+              callBackFunction:showCubeWithScaleEventsReturn
+            });
+          }else if(scale_handle_id == "scale_handle_tileLayerChange"){
+            addScaleEvent = new AddScaleEvent({
+              m_view,
+              callBackFunction:showTileLayersWithScaleEventsReturn
+            });
+          }else if(scale_handle_id == "scale_handle_sceneLayerLayerChange"){
+            addScaleEvent = new AddScaleEvent({
+              m_view,
+              callBackFunction:showSceneLayersWithScaleEventsReturn
+            });
+          }
           m_handles.add(addScaleEvent.scaleHandle,scale_handle_id);
         }
       }
 
+
+
+      //不同比例尺加载白膜
+      function showSceneLayersWithScaleEventsReturn(scaleValue){
+        let layer = m_map.layers.find(item => item.id === "WhiteMold");
+        if(scaleValue > 50000){
+          if(layer){
+            layer.visible = false;
+          }
+        }else{
+          if(layer){
+            layer.visible = true;
+          }
+        }
+      }
+
+      //不同比例尺加载长三角瓦片
+      function showTileLayersWithScaleEventsReturn(scaleValue){
+        let layer = m_map.layers.find(item => item.id === "BaseMapCSJYaoGan");
+        if(scaleValue < 130000){
+          if(layer){
+            layer.visible = false;
+          }
+        }else{
+          if(layer){
+            layer.visible = true;
+          }
+        }
+      }
+
+
+
+      //不同比例尺加载网格
+      function showCubeWithScaleEventsReturn(scaleValue){
+        switch (true) {
+          case (scaleValue > 1500000):  //15级以上隐藏
+            getRealPower2({
+              status:'hide'
+            })
+            break;
+          case (scaleValue <= 1500000 && scaleValue > 300000): //15级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 1000,
+              level: 15,
+              size:{ x: 1582.2726823222256, y: 1856.6079667204758, z: 1724.5956527210265 }
+            })
+            break;
+          case (scaleValue <= 300000 && scaleValue > 150000): //16级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 500,
+              level: 16,
+              size:{ x: 844.8477050379952, y: 990.1345935064928, z: 862.239544684298 }
+            })
+            break;
+          case (scaleValue <= 150000 && scaleValue > 100000): //17级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 200,
+              level: 17,
+              size:{ x: 424.0518521273334, y: 492.09123171765896, z: 431.1052029077298 }
+            })
+            break;
+          case (scaleValue <= 100000 && scaleValue > 40000): //18级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 100,
+              level: 18,
+              size:{ x: 211.66439868324142, y: 246.49964316944533, z: 215.5489592181181 }
+            })
+            break;
+          case (scaleValue <= 40000 && scaleValue > 15000): //19级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 100,
+              level: 19,
+              size:{ x: 105.79869494173579, y: 123.19232219036257, z: 107.77356906534683 }
+            })
+            break;
+          case (scaleValue <= 15000 && scaleValue > 6000): //20级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 50,
+              level: 20,
+              size:{ x: 52.887881893650956, y: 61.627412608112536, z: 53.887012166300096 }
+            })
+            break;
+          case (scaleValue <= 6000 && scaleValue > 3000): //21级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 20,
+              level: 21,
+              size:{ x: 26.44107169853396, y: 30.815525255577086, z: 26.943221541824816 }
+            })
+            break;
+          case (scaleValue <= 3000 && scaleValue > 1500): //22级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 5,
+              level: 22,
+              size:{ x: 13.222978864358083, y: 15.406742669116284, z: 13.471596544164798 }
+            })
+            break;
+          case (scaleValue <= 1500): //23级
+            getCurrentRealPower({
+              status:"show",
+              id:"power_wj",
+              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
+              center:m_view.center,
+              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
+              minZ: 0,
+              maxZ: 5,
+              level: 23,
+              size:{ x: 6.7358, y: 7.7024, z: 6.6111 }
+            })
+            break;
+        }
+      }
+
+
       function showThreeCube(params){
         let status = params.status;
         if(status == "hide"){
@@ -1179,86 +1425,6 @@ export default {
 
 
 
-      //不同比例尺加载白膜
-      // function showLayersWithScaleEventsReturn(scaleValue){
-      //   let layer = m_map.layers.find(item => item.id === "WhiteMold");
-      //   if(scaleValue > 50000){
-      //     if(layer){
-      //       layer.visible = false;
-      //     }
-      //   }else{
-      //     if(layer){
-      //       layer.visible = true;
-      //     }
-      //   }
-      // }
-
-
-
-      //不同比例尺加载网格
-      function showLayersWithScaleEventsReturn(scaleValue){
-        switch (true) {
-          case (scaleValue > 1000000):  //15级以上隐藏
-            getRealPower2({
-              status:'hide'
-            })
-            break;
-          case (scaleValue <= 1000000 && scaleValue > 30000): //15级
-            getRealPower2({
-              status:"show",
-              id:"power_wj",
-              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
-              center:m_view.center,
-              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
-              minZ: 0,
-              maxZ: 1000,
-              level: 15,
-              size:{ x: 1582.2726823222256, y: 1856.6079667204758, z: 1724.5956527210265 }
-            })
-            break;
-          case (scaleValue <= 30000 && scaleValue > 5000): //20级
-            getRealPower2({
-              status:"show",
-              id:"power_wj",
-              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
-              center:m_view.center,
-              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
-              minZ: 0,
-              maxZ: 120,
-              level: 20,
-              size:{ x: 52.887881893650956, y: 61.627412608112536, z: 53.887012166300096 }
-            })
-            break;
-          case (scaleValue <= 5000 && scaleValue > 1000): //22级
-            getRealPower2({
-              status:"show",
-              id:"power_wj",
-              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
-              center:m_view.center,
-              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
-              minZ: 0,
-              maxZ: 20,
-              level: 22,
-              size:{ x: 13.222978864358083, y: 15.406742669116284, z: 13.471596544164798 }
-            })
-            break;
-          case (scaleValue <= 1000): //23级
-            getRealPower2({
-              status:"show",
-              id:"power_wj",
-              fields:["demographics","green","river","road","collision_buffer","no_fly_zone_buffer","clear_zone_buffer"],
-              center:m_view.center,
-              radius: (m_view.extent.xmax - m_view.extent.xmin) > (m_view.extent.ymax - m_view.extent.ymin) ? (m_view.extent.xmax - m_view.extent.xmin) : (m_view.extent.ymax - m_view.extent.ymin),
-              minZ: 0,
-              maxZ: 20,
-              level: 23,
-              size:{ x: 6.7358, y: 7.7024, z: 6.6111 }
-            })
-            break;
-        }
-      }
-
-
       function viewshedAnalysis(params){
         let status = params.status;
         if(status === "hide"){
@@ -1377,26 +1543,27 @@ export default {
       }
 
 
-      function geometryMeshFrustumEffect(params){
+      function geometryMeshEffect(params){
         let status = params.status;
-        let f_layer = m_map.layers.find(item => item.id === "geometryMeshFrustumEffect");
+        let id = params.id;
+        let f_layer = m_map.layers.find(item => item.id === "geometryMeshEffect" + id);
         if (f_layer) {
           m_map.remove(f_layer);
         }
         if(status == "hide"){
           return
         }
-        let geometryMeshFrustumEffect = new GeometryMeshFrustumEffect({
+        let geometryMeshEffect = new GeometryMeshEffect({
           view:m_view,
           m_map,
-          height:params.height,
-          topRadius:params.topRadius,
-          bottomRadius:params.bottomRadius,
-          position:params.position
+          id:params.id,
+          data:params.data
         });
-        m_map.add(geometryMeshFrustumEffect.graphicsLayer);
+        m_map.add(geometryMeshEffect.graphicsLayer);
       }
 
+
+
       // 路径冲突
       function pathConflict(params){
 
@@ -1892,8 +2059,8 @@ export default {
         connectWebSocket();
       }
 
-
-      function getRealPower2(params){
+      //无极变换
+      function getCurrentRealPower(params){
         let id = params.id;
         let lastId = params.lastId;
         let status = params.status;
@@ -1904,20 +2071,14 @@ export default {
         let maxZ = params.maxZ;
         let size = params.size;
         let fields = params.fields;
-        currentShowGridId = id;
         if(status == "hide"){
           showThreeCubeDetail({
             id:params.id,
             status:"hide"
           });
-          showThreeCubeDetail({
-            id:params.lastId,
-            status:"hide"
-          });
-          currentShowGridId = null;
           return
         }
-        getSixPowerPoints({
+        getCurrentPowerPoints({
           id,
           lastId,
           "x": center.x,
@@ -1934,7 +2095,7 @@ export default {
       }
 
       // 递归获取权重数据
-      function getSixPowerPoints(params) {
+      function getCurrentPowerPoints(params) {
         getPowerPoint({
           x: params.x,
           y: params.y,
@@ -1949,10 +2110,71 @@ export default {
             id:params.id,
             status:"hide"
           });
+          if(res.data.data.list?.length > 0){
+            showThreeCubeDetail({
+              "id":params.id,
+              "status":params.status,
+              "size":params.size,
+              "points":res.data.data.list,
+            })
+          }
+        })
+      }
+
+
+
+      function getRealPower2(params){
+        let id = params.id;
+        let lastId = params.lastId;
+        let status = params.status;
+        let level = params.level;
+        let center = params.center;
+        let radius = params.radius;
+        let minZ = params.minZ;
+        let maxZ = params.maxZ;
+        let size = params.size;
+        let fields = params.fields;
+        if(status == "hide"){
           showThreeCubeDetail({
-            id:params.lastId,
+            id:params.id,
             status:"hide"
           });
+          currentShowGridId = null;
+          return
+        }
+        showThreeCubeDetail({
+          id:params.lastId,
+          status:"hide"
+        });
+        currentShowGridId = id;
+        getSixPowerPoints({
+          id,
+          lastId,
+          "x": center.x,
+          "y": center.y,
+          status,
+          radius,
+          size,
+          minZ,
+          maxZ,
+          level,
+          fields,
+          scrollId:""
+        });
+      }
+
+      // 递归获取权重数据
+      function getSixPowerPoints(params) {
+        getPowerPoint({
+          x: params.x,
+          y: params.y,
+          radius:params.radius,
+          minZ:params.minZ,
+          maxZ:params.maxZ,
+          level: params.level,
+          fields: params.fields,
+          scrollId: params.scrollId,
+        }).then(res =>{
           if(currentShowGridId == params.id){
             if(res.data.data.list?.length >= 100000 && res.data.data.scrollId){
               // res.data.data.list.forEach((point) =>{
@@ -2211,6 +2433,7 @@ export default {
 
 
       function featurePolygonPlotting(params){
+        debugger
         let status = params.status;
         let id = params.id;
         let p_layer = m_map.layers.find(item => item.id === id+"_polygon");
@@ -2236,6 +2459,25 @@ export default {
         });
       }
 
+      function flowPathEffect(params){
+        let status = params.status;
+        if(addFlowPathEvent){
+          addFlowPathEvent.clear();
+          addFlowPathEvent = null;
+        }
+        if(status === "hide"){
+          return
+        }
+        addFlowPathEvent = new AddFlowPathEvent({
+          view:m_view,
+          paths:params.paths,
+          color:params.color,
+          pipeRadius:params.pipeRadius
+        })
+        addFlowPathEvent.start()
+      }
+
+
     })
   }
 }

+ 590 - 13
src/config/basicTool.json

@@ -42,7 +42,7 @@
             "title":"BaseMap",
             "visible": true,
             "opacity": 1,
-            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3Mzk4NDI0ODUsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.37i5Deb8f-KNE9qmLhOzwObbbospFWpBdaTp94kLB1U",
+            "url": "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDAxMjE0MDEsImtleSI6IjkzNDkzMzIxIiwic2VydmljZU5vIjoiRDkwMDEwMDcxMjAyMzA4MDEiLCJ1c2VybmFtZSI6InB0Z2wifQ.7nx0dGpAJnCrpPqVMe9LM5K2pzuPtYlijOGHp_-JWyM",
             "token": ""
           }
         }
@@ -157,12 +157,24 @@
       },
       {
         "code": "1-8",
-        "title": "比例尺切换加载服务事件",
+        "title": "比例尺切换加载网格事件",
         "data": {
           "ActionName": "ShowLayersWithScaleEvents",
           "Parameters": {
             "status":"show",
-            "scale_handle_id":"scale_handle_id",
+            "scale_handle_id":"scale_handle_cube",
+            "token": ""
+          }
+        }
+      },
+      {
+        "code": "1-8-1",
+        "title": "比例尺切换影像切片事件",
+        "data": {
+          "ActionName": "ShowLayersWithScaleEvents",
+          "Parameters": {
+            "status":"show",
+            "scale_handle_id":"scale_handle_tileLayerChange",
             "token": ""
           }
         }
@@ -1484,19 +1496,584 @@
       },
       {
         "code": "1-44",
-        "title": "圆台绘制",
+        "title": "批量几何体展示",
         "data": {
-          "ActionName": "GeometryMeshFrustumEffect",
+          "ActionName": "GeometryMeshEffect",
           "Parameters": {
             "status": "show",
-            "position": {
-              "x": 0,
-              "y": 0,
-              "z": 0
-            },
-            "height": 100,
-            "topRadius": 200,
-            "bottomRadius": 10
+            "id": "drawOne",
+            "data": [
+              {
+                "type": "polygon",
+                "shape": {
+                  "height": 300,
+                  "rings": [
+                    [
+                      [
+                        -2003.2623153105103,
+                        12816.762827663892,
+                        0
+                      ],
+                      [
+                        794.1983360379137,
+                        15443.327339303189,
+                        0
+                      ],
+                      [
+                        2483.797111736254,
+                        11283.284291891214,
+                        0
+                      ],
+                      [
+                        1170.7713072628903,
+                        10339.760205711993,
+                        0
+                      ],
+                      [
+                        -772.0114272307687,
+                        10699.713925018868,
+                        0
+                      ],
+                      [
+                        -2003.2623153105103,
+                        12816.762827663892,
+                        0
+                      ]
+                    ]
+                  ],
+                  "color": [0,255,0,0.3]
+                }
+              },
+              {
+                "type": "polygon",
+                "shape": {
+                  "height": 300,
+                  "rings": [
+                    [
+                      [
+                        -6193.269497659612,
+                        17278.09490721943,
+                        0
+                      ],
+                      [
+                        -6202.454125402919,
+                        17102.841769823484,
+                        0
+                      ],
+                      [
+                        -6229.907379929278,
+                        16929.50874247493,
+                        0
+                      ],
+                      [
+                        -6275.328477637135,
+                        16759.994898093653,
+                        0
+                      ],
+                      [
+                        -6338.219775475027,
+                        16596.157465831762,
+                        0
+                      ],
+                      [
+                        -6417.8922232229925,
+                        16439.791482882294,
+                        0
+                      ],
+                      [
+                        -6513.472912870972,
+                        16292.610127676136,
+                        0
+                      ],
+                      [
+                        -6623.914642381638,
+                        16156.225949940601,
+                        0
+                      ],
+                      [
+                        -6748.007389055054,
+                        16032.133203267185,
+                        0
+                      ],
+                      [
+                        -6884.3915667905885,
+                        15921.691473756518,
+                        0
+                      ],
+                      [
+                        -7031.572921996748,
+                        15826.11078410854,
+                        0
+                      ],
+                      [
+                        -7187.938904946214,
+                        15746.438336360574,
+                        0
+                      ],
+                      [
+                        -7351.776337208108,
+                        15683.547038522682,
+                        0
+                      ],
+                      [
+                        -7521.29018158938,
+                        15638.125940814825,
+                        0
+                      ],
+                      [
+                        -7694.623208937938,
+                        15610.672686288466,
+                        0
+                      ],
+                      [
+                        -7869.876346333884,
+                        15601.48805854516,
+                        0
+                      ],
+                      [
+                        -8045.129483729828,
+                        15610.672686288466,
+                        0
+                      ],
+                      [
+                        -8218.462511078385,
+                        15638.125940814825,
+                        0
+                      ],
+                      [
+                        -8387.97635545966,
+                        15683.547038522682,
+                        0
+                      ],
+                      [
+                        -8551.813787721552,
+                        15746.438336360574,
+                        0
+                      ],
+                      [
+                        -8708.179770671019,
+                        15826.11078410854,
+                        0
+                      ],
+                      [
+                        -8855.361125877178,
+                        15921.691473756518,
+                        0
+                      ],
+                      [
+                        -8991.745303612714,
+                        16032.133203267185,
+                        0
+                      ],
+                      [
+                        -9115.83805028613,
+                        16156.225949940601,
+                        0
+                      ],
+                      [
+                        -9226.279779796796,
+                        16292.610127676135,
+                        0
+                      ],
+                      [
+                        -9321.860469444775,
+                        16439.791482882294,
+                        0
+                      ],
+                      [
+                        -9401.53291719274,
+                        16596.157465831762,
+                        0
+                      ],
+                      [
+                        -9464.424215030633,
+                        16759.994898093653,
+                        0
+                      ],
+                      [
+                        -9509.84531273849,
+                        16929.508742474925,
+                        0
+                      ],
+                      [
+                        -9537.298567264848,
+                        17102.841769823484,
+                        0
+                      ],
+                      [
+                        -9546.483195008155,
+                        17278.09490721943,
+                        0
+                      ],
+                      [
+                        -9537.298567264848,
+                        17453.348044615374,
+                        0
+                      ],
+                      [
+                        -9509.84531273849,
+                        17626.681071963932,
+                        0
+                      ],
+                      [
+                        -9464.424215030633,
+                        17796.194916345205,
+                        0
+                      ],
+                      [
+                        -9401.53291719274,
+                        17960.0323486071,
+                        0
+                      ],
+                      [
+                        -9321.860469444775,
+                        18116.398331556567,
+                        0
+                      ],
+                      [
+                        -9226.279779796796,
+                        18263.579686762725,
+                        0
+                      ],
+                      [
+                        -9115.83805028613,
+                        18399.96386449826,
+                        0
+                      ],
+                      [
+                        -8991.745303612714,
+                        18524.056611171676,
+                        0
+                      ],
+                      [
+                        -8855.36112587718,
+                        18634.49834068234,
+                        0
+                      ],
+                      [
+                        -8708.17977067102,
+                        18730.079030330322,
+                        0
+                      ],
+                      [
+                        -8551.813787721554,
+                        18809.751478078288,
+                        0
+                      ],
+                      [
+                        -8387.97635545966,
+                        18872.642775916178,
+                        0
+                      ],
+                      [
+                        -8218.462511078387,
+                        18918.063873624036,
+                        0
+                      ],
+                      [
+                        -8045.12948372983,
+                        18945.517128150394,
+                        0
+                      ],
+                      [
+                        -7869.876346333884,
+                        18954.701755893704,
+                        0
+                      ],
+                      [
+                        -7694.62320893794,
+                        18945.517128150394,
+                        0
+                      ],
+                      [
+                        -7521.290181589382,
+                        18918.063873624036,
+                        0
+                      ],
+                      [
+                        -7351.776337208108,
+                        18872.642775916178,
+                        0
+                      ],
+                      [
+                        -7187.938904946215,
+                        18809.751478078288,
+                        0
+                      ],
+                      [
+                        -7031.572921996749,
+                        18730.079030330322,
+                        0
+                      ],
+                      [
+                        -6884.391566790589,
+                        18634.49834068234,
+                        0
+                      ],
+                      [
+                        -6748.007389055055,
+                        18524.056611171676,
+                        0
+                      ],
+                      [
+                        -6623.914642381639,
+                        18399.963864498262,
+                        0
+                      ],
+                      [
+                        -6513.472912870972,
+                        18263.579686762725,
+                        0
+                      ],
+                      [
+                        -6417.8922232229925,
+                        18116.398331556567,
+                        0
+                      ],
+                      [
+                        -6338.219775475028,
+                        17960.032348607103,
+                        0
+                      ],
+                      [
+                        -6275.328477637135,
+                        17796.19491634521,
+                        0
+                      ],
+                      [
+                        -6229.907379929278,
+                        17626.681071963936,
+                        0
+                      ],
+                      [
+                        -6202.454125402919,
+                        17453.348044615377,
+                        0
+                      ],
+                      [
+                        -6193.269497659612,
+                        17278.09490721943,
+                        0
+                      ]
+                    ]
+                  ],
+                  "color": [0,255,255,0.7]
+                }
+              },
+              {
+                "type": "polyline",
+                "shape": {
+                  "height": 300,
+                  "paths": [
+                    [
+                      [
+                        3499.5782683948523,
+                        7252.273350408689,
+                        0
+                      ],
+                      [
+                        3499.364569722593,
+                        7251.626996858693,
+                        100
+                      ],
+                      [
+                        3558.8660344507416,
+                        7251.648514626977,
+                        100
+                      ],
+                      [
+                        3558.852005535551,
+                        7290.14634859842,
+                        100
+                      ],
+                      [
+                        3568.767473443955,
+                        7293.999751210939,
+                        100
+                      ],
+                      [
+                        4279.47656249917,
+                        7294.283510610084,
+                        100
+                      ],
+                      [
+                        4282.768839396391,
+                        7325.0832129770815,
+                        100
+                      ],
+                      [
+                        4286.069444710435,
+                        7336.633997891262,
+                        100
+                      ],
+                      [
+                        4299.290211928166,
+                        7340.489525285203,
+                        100
+                      ],
+                      [
+                        4309.205361465806,
+                        7344.34362776725,
+                        100
+                      ],
+                      [
+                        4735.628798268906,
+                        7344.538185844389,
+                        100
+                      ],
+                      [
+                        4735.579268035517,
+                        7448.4823634558725,
+                        100
+                      ],
+                      [
+                        4734.06792183444,
+                        7449.867157578444,
+                        0
+                      ]
+                    ]
+                  ],
+                  "color": [0,255,255,0.7]
+                }
+              },
+              {
+                "type": "inverted-cone",
+                "shape": {
+                  "point": {
+                    "x": 0,
+                    "y": 0,
+                    "z": 0
+
+                  },
+                  "height": 200,
+                  "radius": 100,
+                  "color": [255,255,255,0.7]
+                }
+              },
+              {
+                "type": "frustum-cone",
+                "shape": {
+                  "point": {
+                    "x": 2000,
+                    "y": 2000,
+                    "z": 0
+                  },
+                  "height": 100,
+                  "topRadius": 200,
+                  "bottomRadius": 70,
+                  "color": [255,0,255,0.7]
+                }
+              },
+              {
+                "type": "funnel",
+                "shape": {
+                  "point": {
+                    "x": 2000,
+                    "y": 0,
+                    "z": 0
+                  },
+                  "coneHeight": 100,
+                  "cylinderHeight":100,
+                  "topRadius": 200,
+                  "bottomRadius": 70,
+                  "color": [255,0,255,0.7]
+                }
+              }
+            ]
+          }
+        }
+      },
+      {
+        "code": "1-45",
+        "title": "流动航线",
+        "data": {
+          "ActionName": "FlowPathEffect",
+          "Parameters": {
+            "status": "show",
+            "paths": [
+              [
+                [
+                  1769.8633262562475,
+                  6572.564675574498,
+                  20
+                ],
+                [
+                  2756.9351097344656,
+                  6887.815844159343,
+                  20
+                ],
+                [
+                  3553.4220013809545,
+                  7144.302605554526,
+                  20
+                ],
+                [
+                  4195.333062471143,
+                  7282.346450536933,
+                  20
+                ],
+                [
+                  4418.0873970261955,
+                  7366.562145019624,
+                  20
+                ]
+              ],
+              [
+                [
+                  4418.0873970261955,
+                  7366.562145019624,
+                  20
+                ],
+                [
+                  4216.2063372552475,
+                  7476.772779201592,
+                  20
+                ],
+                [
+                  4000.1051314666856,
+                  7862.190076553913,
+                  20
+                ],
+                [
+                  4550.636695788306,
+                  8027.788532685085,
+                  20
+                ],
+                [
+                  5329.235851407364,
+                  8224.316966379089,
+                  20
+                ]
+              ]
+            ],
+            "color": "#ffff00",
+            "pipeRadius": 10,
+            "token": ""
+          }
+        }
+      },
+      {
+        "code": "1-46",
+        "title": "航线补全",
+        "data": {
+          "ActionName": "PathCompletion",
+          "Parameters": {
+            "status": "show",
+            "points":  [
+              [ 3660.7946777344, 7167.904296875, 0 ],
+              [ 3605.064453125, 7149.7119140625, 50 ],
+              [ 3514.7961425781, 7109.8686523438, 110 ],
+              [ 2960.8686523438, 6910.72265625, 110 ],
+              [ 2910.0686035156, 6045.00390625, 110 ],
+              [ 2844.3713378906, 5862.2465820313, 110 ],
+              [ 2810.5405273438, 5768.1352539063, 50 ],
+              [ 2793.6516113281, 5721.1533203125, 0 ]
+            ],
+            "speed1": 25,
+            "speed2": 10,
+            "color": "#ffff00",
+            "pipeRadius": 10,
+            "token": ""
           }
         }
       }

+ 72 - 13
src/service/http.js

@@ -29,7 +29,7 @@ export function gridBaseInfo(params){
 //查询权重
 export function getPowerPoint(params){
     return requestNetPost({
-        url:'/grid/search/v2/calculateWeight',
+        url:'/grid/search/v3/calculateWeight',
         // header:{
         //     'Content-Encoding': 'gzip'
         // },
@@ -45,29 +45,88 @@ export function getPowerPoint(params){
                 //  "G001133223-031112-303001.1|000000000000000000000001"
             ],
             "fields":["gridCode","x","y","z","element","boxSize"],
-            "elementFields":[   "demographics",
-                "green",
-                "river",
-                "road",
-                "collision",
-                "no_fly_zone",
-                "clear_zone",
-                "collision_buffer",
-                "no_fly_zone_buffer",
-                "clear_zone_buffer"],
-            //"elementFields":params.fields,
-            //"elementFields":["road"],
             "scrollPage": {
                 "pageIndex": 1,
                 "pageSize": 100000,
                 "scrollId": params.scrollId
             },
+            "elementCount":{
+              "10.0":1
+            },
             "isShowInfo":0,
             "level":params.level
         }
     })
 }
 
+//范围查询权重网格
+export function getPowerPointByPolygon(params){
+    return requestNetPost({
+        url:'/grid/search/v3/calculateWeight',
+        // header:{
+        //     'Content-Encoding': 'gzip'
+        // },
+        data:{
+            "geoShapeQuery": {
+                "fieldName": "locationPoint",
+                "relation": "intersects",
+                "shape": {
+                    "type": "Polygon",
+                    "coordinates":
+                        [
+                            [
+                                [
+                                    -1590.3017918809733,
+                                    6677.077964639487,
+                                    0
+                                ],
+                                [
+                                    2201.7080968161385,
+                                    10732.428201519228,
+                                    0
+                                ],
+                                [
+                                    7456.713054320092,
+                                    6853.834924224613,
+                                    0
+                                ],
+                                [
+                                    5328.421628395957,
+                                    3430.2107042326584,
+                                    0
+                                ],
+                                [
+                                    3081.4337327171834,
+                                    6940.070702330807,
+                                    0
+                                ],
+                                [
+                                    -1590.3017918809733,
+                                    6677.077964639487,
+                                    0
+                                ]
+                            ]
+                        ]
+                }
+            },
+            "minZ": params.minZ,
+            "maxZ": params.maxZ,
+            "routes": [
+                //  "G001133223-031112-303001.1|000000000000000000000001"
+            ],
+            "fields":["gridCode","x","y","z","element","boxSize"],
+            "scrollPage": {
+                "pageIndex": 1,
+                "pageSize": 100000,
+                "scrollId": params.scrollId
+            },
+            "isShowInfo":0,
+            "level":params.level
+        }
+    })
+}
+
+
 //查询规避路线
 export function getAvoidRoute(params){
     return requestNetPost({

+ 39 - 0
src/units/map/AddFlowPathEvent.js

@@ -0,0 +1,39 @@
+
+import RenderNode from '@arcgis/core/views/3d/webgl/RenderNode.js'
+import * as webgl from "@arcgis/core/views/3d/webgl.js";
+import {FlowPathClass} from "../threejs/flowPath.js";
+
+class AddFlowPathEvent{
+    constructor(options) {
+        this.view = options.view;
+        this.addFlowPathEvent = null;
+        this.paths = options.paths;
+        this.color = options.color;
+        this.pipeRadius = options.pipeRadius;
+    }
+    start() {
+        let that = this;
+        if(this.addFlowPathEvent){
+            this.clear();
+        }
+        let subRenderClass = RenderNode.createSubclass(FlowPathClass);
+        this.view.when(()=>{
+            that.addFlowPathEvent =  new subRenderClass({
+                view: that.view,
+                webgl,
+                paths: this.paths,
+                color: this.color,
+                pipeRadius: this.pipeRadius
+            });
+        })
+    }
+    clear(){
+        if(this.addFlowPathEvent){
+            this.addFlowPathEvent.destroy();
+            this.addFlowPathEvent = null;
+        }
+    }
+
+}
+
+export default AddFlowPathEvent;

+ 9 - 1
src/units/map/FeaturePolygonPlottingEvent.js

@@ -23,6 +23,14 @@ class FeaturePolygonPlottingEvent {
         let resultTextGraphics = [];
 
         this.data.forEach((item) => {
+            if(item.symbol.height){
+                item.geometry.rings.forEach((ring)=>{
+                    ring.forEach((point)=>{
+                        point[2] = item.symbol.height;
+                    })
+                })
+            }
+
             let rings = new Polygon({
                 type: "polygon",
                 rings: item.geometry.rings,
@@ -127,7 +135,7 @@ class FeaturePolygonPlottingEvent {
                 type: "unique-value", // 基于唯一值的渲染器
                 field: "id", // 按照 id 字段渲染
                 uniqueValueInfos: this.data.map((item) => ({
-                    value: item.attributes.id, // 唯一值对应 FID
+                    value: item.attributes.id, // 唯一值对应 id
                     symbol: {
                         type: "polygon-3d",
                         symbolLayers: [

+ 275 - 0
src/units/map/GeometryMeshEffect.js

@@ -0,0 +1,275 @@
+import Graphic from "@arcgis/core/Graphic.js";
+import Mesh from "@arcgis/core/geometry/Mesh.js";
+import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
+import Polygon from "@arcgis/core/geometry/Polygon.js";
+import Polyline from "@arcgis/core/geometry/Polyline.js";
+import Point from "@arcgis/core/geometry/Point.js"
+
+class GeometryMeshEffect{
+    constructor(options) {
+        this.view = options.view;
+        this.m_map = options.m_map;
+        this.id = options.id;
+        this.data = options.data;
+        this.graphicsLayer = null;
+        this.addGeometryMeshFrustumEffect()
+    }
+
+    addGeometryMeshFrustumEffect(){
+        this.graphicsLayer = new GraphicsLayer({
+            id: "geometryMeshEffect" + this.id,
+            title: "空域分层"
+        })
+        this.data.forEach((item)=>{
+            let graphic;
+            if(item.type == "polygon"){ //圆柱、矩形、棱锥
+                let rings = new Polygon({
+                    type: "polygon",
+                    rings: item.shape.rings,
+                    spatialReference: this.view.spatialReference
+                });
+                graphic = new Graphic({
+                    geometry: rings,
+                    symbol:{
+                        "type": "polygon-3d",
+                        "symbolLayers": [
+                            {
+                                "type": "extrude",
+                                "size": 300,
+                                "material": {
+                                    "color": item.shape.color
+                                }
+                            }
+                        ]
+                    }
+                });
+            }else if(item.type == "polyline"){   //航线
+                let paths = new Polyline({
+                    type: "polyline",
+                    paths: item.shape.paths,
+                    spatialReference: this.view.spatialReference
+                });
+                graphic = new Graphic({
+                    geometry: paths,
+                    symbol:{
+                        "type": "line-3d",
+                        "symbolLayers": [
+                            {
+                                "type": "path",
+                                "profile": "circle",
+                                "material": {
+                                    "color": item.shape.color
+                                },
+                                "width": 30,
+                                "height": 30
+                            }
+                        ]
+                    }
+                });
+            }else if(item.type == "inverted-cone"){
+                let point = new Point({
+                    type: "point",
+                    x: item.shape.point.x,
+                    y: item.shape.point.y,
+                    z: item.shape.point.z,
+                    spatialReference: this.view.spatialReference
+                });
+                graphic = new Graphic({
+                    geometry: point,
+                    symbol:{
+                        "type": "point-3d",
+                        "symbolLayers": [
+                            {
+                                "type": "object",
+                                "width": 200,
+                                "height": 200,
+                                "depth": 200,
+                                "anchor": "origin",
+                                "resource": {
+                                    "primitive": "inverted-cone"
+                                },
+                                "material": {
+                                    "color": item.shape.color
+                                }
+                            }
+                        ]
+                    }
+                });
+            }else if(item.type == "frustum-cone"){ //圆台
+                let mesh = this.createTruncatedCone(item.shape.bottomRadius, item.shape.topRadius, item.shape.height,item.shape.point,item.shape.color);
+                graphic = new Graphic({
+                    geometry: mesh,
+                    symbol: {
+                        "type": "mesh-3d",
+                        "symbolLayers": [{
+                            "type": "fill",
+                            "material": {
+                                "color": item.shape.color
+                            }
+                        }]
+                    }
+                });
+            }else if(item.type == "funnel"){  //漏斗
+                debugger
+                let funnel = this.createTruncatedConeWithCylinder(item.shape.bottomRadius, item.shape.topRadius, item.shape.coneHeight, item.shape.cylinderHeight,item.shape.point,item.shape.color);
+                graphic = new Graphic({
+                    geometry: funnel,
+                    symbol: {
+                        "type": "mesh-3d",
+                        "symbolLayers": [{
+                            "type": "fill",
+                            "material": {
+                                "color": item.shape.color
+                            }
+                        }]
+                    }
+                });
+            }
+            this.graphicsLayer.add(graphic);
+
+        })
+    }
+
+
+    createTruncatedCone(bottomRadius, topRadius, height, position,color) {
+        const segments = 30; // 细分程度,值越大越平滑
+        let vertices = [];
+        let faces = [];
+
+        // 下圆
+        for (let i = 0; i < segments; i++) {
+            let angle = (i / segments) * 2 * Math.PI;
+            // 将圆心坐标 (cx, cy, cz) 加到每个顶点的位置
+            vertices.push(position.x + Math.cos(angle) * bottomRadius, position.y + Math.sin(angle) * bottomRadius, position.z);
+        }
+
+        // 上圆
+        for (let i = 0; i < segments; i++) {
+            let angle = (i / segments) * 2 * Math.PI;
+            // 将圆心坐标 (cx, cy, cz) 加到每个顶点的位置
+            vertices.push(position.x + Math.cos(angle) * topRadius, position.y + Math.sin(angle) * topRadius, position.z + height);
+        }
+
+        // 侧面
+        for (let i = 0; i < segments; i++) {
+            let next = (i + 1) % segments;
+            let bottom1 = i;
+            let bottom2 = next;
+            let top1 = i + segments;
+            let top2 = next + segments;
+
+            faces.push(bottom1, bottom2, top1);
+            faces.push(bottom2, top2, top1);
+        }
+
+        // 底面
+        for (let i = 1; i < segments - 1; i++) {
+            faces.push(0, i, i + 1);
+        }
+
+        // 顶面
+        for (let i = 1; i < segments - 1; i++) {
+            faces.push(segments, segments + i, segments + i + 1);
+        }
+
+        return new Mesh({
+            vertexAttributes: {
+                position: vertices
+            },
+            components: [{
+                faces: faces,
+                material: { color: color }
+            }],
+            spatialReference: {
+                wkid: 102100 // 空间参考系
+            }
+        });
+    }
+
+    createTruncatedConeWithCylinder(bottomRadius, topRadius, coneHeight, cylinderHeight,position,color) {
+        const segments = 30; // 分割数,越大越平滑
+        let vertices = [];
+        let faces = [];
+        // 生成圆台下圆(同时作为圆柱体的上圆),位于 z = position.z
+        for (let i = 0; i < segments; i++) {
+            let angle = (i / segments) * 2 * Math.PI;
+            vertices.push(
+                position.x + Math.cos(angle) * bottomRadius,
+                position.y + Math.sin(angle) * bottomRadius,
+                position.z + cylinderHeight
+            );
+        }
+
+        // 生成圆台上圆,位于 z = position.z + coneHeight
+        for (let i = 0; i < segments; i++) {
+            let angle = (i / segments) * 2 * Math.PI;
+            vertices.push(
+                position.x + Math.cos(angle) * topRadius,
+                position.y + Math.sin(angle) * topRadius,
+                position.z + coneHeight + cylinderHeight
+            );
+        }
+
+        // 生成圆柱体下圆,位于 z = position.z - cylinderHeight
+        for (let i = 0; i < segments; i++) {
+            let angle = (i / segments) * 2 * Math.PI;
+            vertices.push(
+                position.x + Math.cos(angle) * bottomRadius,
+                position.y + Math.sin(angle) * bottomRadius,
+                position.z
+            );
+        }
+
+        // 构造圆台侧面(连接圆台下圆与上圆)
+        for (let i = 0; i < segments; i++) {
+            let next = (i + 1) % segments;
+            let bottom_i = i;             // 圆台下圆
+            let bottom_next = next;
+            let top_i = i + segments;     // 圆台上圆
+            let top_next = next + segments;
+            faces.push(bottom_i, bottom_next, top_i);
+            faces.push(bottom_next, top_next, top_i);
+        }
+
+        // 构造圆台顶面
+        for (let i = 1; i < segments - 1; i++) {
+            faces.push(segments, segments + i, segments + i + 1);
+        }
+
+        // 构造圆柱体侧面(连接圆台下圆和圆柱体下圆)
+        for (let i = 0; i < segments; i++) {
+            let next = (i + 1) % segments;
+            let top_i = i;              // 圆柱体上圆(与圆台下圆相同)
+            let top_next = next;
+            let bottom_i = i + 2 * segments; // 圆柱体下圆
+            let bottom_next = next + 2 * segments;
+            faces.push(top_i, top_next, bottom_i);
+            faces.push(top_next, bottom_next, bottom_i);
+        }
+
+        // 构造圆柱体底面
+        for (let i = 1; i < segments - 1; i++) {
+            faces.push(2 * segments, 2 * segments + i, 2 * segments + i + 1);
+        }
+
+        return new Mesh({
+            vertexAttributes: {
+                position: vertices
+            },
+            components: [
+                {
+                    faces: faces,
+                    material: { color: color }
+                }
+            ],
+            spatialReference: {
+                wkid: 102100 // 空间参考系
+            }
+        });
+    }
+
+    clear(){
+        this.graphicsLayer.removeAll();
+    }
+}
+export default GeometryMeshEffect;

+ 0 - 100
src/units/map/GeometryMeshFrustumEffect.js

@@ -1,100 +0,0 @@
-import Graphic from "@arcgis/core/Graphic.js";
-import Mesh from "@arcgis/core/geometry/Mesh.js";
-import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
-
-class GeometryMeshFrustumEffect{
-    constructor(options) {
-        this.view = options.view;
-        this.height = options.height;
-        this.topRadius = options.topRadius;
-        this.bottomRadius = options.bottomRadius;
-        this.position = options.position;
-        this.m_map = options.m_map;
-        this.graphicsLayer = null;
-        this.addGeometryMeshFrustumEffect()
-    }
-
-    addGeometryMeshFrustumEffect(){
-        debugger
-        let mesh = this.createTruncatedCone(this.bottomRadius, this.topRadius, this.height,this.position);
-        let graphic = new Graphic({
-            geometry: mesh,
-            symbol: {
-                type: "mesh-3d",
-                symbolLayers: [{
-                    type: "fill",
-                    material: { color: [
-                            201,254,246,
-                            0.2
-                        ] }
-                }]
-            }
-        });
-        this.graphicsLayer = new GraphicsLayer({
-            id: "geometryMeshFrustumEffect",
-            title: "空域分层"
-        })
-        this.graphicsLayer.add(graphic);
-    }
-
-
-    createTruncatedCone(bottomRadius, topRadius, height, position) {
-        const segments = 30; // 细分程度,值越大越平滑
-        let vertices = [];
-        let faces = [];
-
-        // 下圆
-        for (let i = 0; i < segments; i++) {
-            let angle = (i / segments) * 2 * Math.PI;
-            // 将圆心坐标 (cx, cy, cz) 加到每个顶点的位置
-            vertices.push(position.x + Math.cos(angle) * bottomRadius, position.y + Math.sin(angle) * bottomRadius, position.z);
-        }
-
-        // 上圆
-        for (let i = 0; i < segments; i++) {
-            let angle = (i / segments) * 2 * Math.PI;
-            // 将圆心坐标 (cx, cy, cz) 加到每个顶点的位置
-            vertices.push(position.x + Math.cos(angle) * topRadius, position.y + Math.sin(angle) * topRadius, position.z + height);
-        }
-
-        // 侧面
-        for (let i = 0; i < segments; i++) {
-            let next = (i + 1) % segments;
-            let bottom1 = i;
-            let bottom2 = next;
-            let top1 = i + segments;
-            let top2 = next + segments;
-
-            faces.push(bottom1, bottom2, top1);
-            faces.push(bottom2, top2, top1);
-        }
-
-        // 底面
-        for (let i = 1; i < segments - 1; i++) {
-            faces.push(0, i, i + 1);
-        }
-
-        // 顶面
-        for (let i = 1; i < segments - 1; i++) {
-            faces.push(segments, segments + i, segments + i + 1);
-        }
-
-        return new Mesh({
-            vertexAttributes: {
-                position: vertices
-            },
-            components: [{
-                faces: faces,
-                material: { color: "red" }
-            }],
-            spatialReference: {
-                wkid: 102100 // 空间参考系
-            }
-        });
-    }
-
-    clear(){
-        this.graphicsLayer.removeAll();
-    }
-}
-export default GeometryMeshFrustumEffect;

+ 227 - 0
src/units/threejs/flowPath.js

@@ -0,0 +1,227 @@
+import * as THREE from 'three';
+import texture1 from  "../../assets/黄-发光1.png";
+export const FlowPathClass = {
+    constructor(options) {
+        debugger
+        this.webgl = options.webgl;
+        this.view = options.view;
+        this.color = options.color;
+        this.paths = options.paths;
+        this.pipeRadius = options.pipeRadius;
+        this._camera = options._camera;
+    },
+
+
+    initialize() {
+
+        this.clock = new THREE.Clock();
+        this.airCraftClock = new THREE.Clock();
+
+        this.renderer = new THREE.WebGLRenderer({
+            context:this.gl,
+            premultipliedAlpha: false
+        });
+        this.renderer.setPixelRatio(window.devicePixelRatio);
+        this.renderer.setViewport(0,0,this.view.width,this.view.height);
+        this.renderer.autoClear = false;
+        this.renderer.autoClearDepth = false;
+        this.renderer.autoClearColor = false;
+        let originalSetRenderTarget = this.renderer.setRenderTarget.bind(this.renderer);
+        this.renderer.setRenderTarget = function(target){
+            originalSetRenderTarget(target);
+            if(target){
+                this.bindRenderTarget()
+            }
+        }
+        this.scene = new THREE.Scene();
+        let cam = this.camera;
+        this._camera = new THREE.PerspectiveCamera(cam.fovY,cam.aspect,cam.near,cam.far);
+        //添加坐标轴辅助工具
+        const axesHelper = new THREE.AxesHelper(1);
+        axesHelper.position.set(1000000,1000000,1000000);
+        this.scene.add(axesHelper);
+
+        const grid = new THREE.GridHelper(30,10,0xf0f0f0,0xffffff);
+        this.scene.add(grid);
+
+        this.ambient = new THREE.AmbientLight(0xffffff,0.5);
+        this.scene.add(this.ambient);
+        // 创建纹理
+        let textureLoader = new THREE.TextureLoader();
+        this.map = textureLoader.load(texture1);
+
+        // 贴图颜色空间校正
+        this.map.encoding = THREE.sRGBEncoding;
+        this.map.wrapS = THREE.RepeatWrapping;
+        this.map.wrapT = THREE.RepeatWrapping;
+        this.map.repeat.set(1, 1);
+        this.map.needsUpdate = true;
+        this.getGeometry();
+        this.resetWebGLState();
+    },
+
+
+    /**
+     * 创建几何
+     * @memberof SpereLayer
+     * @method getGeometry
+     */
+    getGeometry() {
+        this.paths.forEach(path => {
+            let curvePath = new THREE.CurvePath();
+            for (let i = 0; i < path.length - 1; i++) {
+                // 使用 toRenderCoordinates 转换每个点
+                let start = this.toRenderCoordinates(path[i]);
+                let end = this.toRenderCoordinates(path[i + 1]);
+                let lineCurve = new THREE.LineCurve3(start, end);
+                curvePath.add(lineCurve);
+                this.createFlowPath(start,end)
+            }
+        });
+    },
+
+    toRenderCoordinates(coordinates) {
+        // 假设这个函数会将 [x, y, z] 转换为 THREE.Vector3
+        let returnValue = [];
+        this.webgl.toRenderCoordinates(this.view, coordinates, 0, this.view.spatialReference, returnValue, 0, 1);
+        return new THREE.Vector3(returnValue[0], returnValue[1], returnValue[2]);
+    },
+    createFlowPath(startPoint,endPoint) {
+        // 创建两个点之间的中间控制点
+        const midPoint1 = new THREE.Vector3(
+            (2 * startPoint.x + endPoint.x) / 3,
+            (2 * startPoint.y + endPoint.y) / 3 + 5, // 可调整中间点的高度
+            (2 * startPoint.z + endPoint.z) / 3
+        );
+        const midPoint2 = new THREE.Vector3(
+            (startPoint.x + 2 * endPoint.x) / 3,
+            (startPoint.y + 2 * endPoint.y) / 3 + 5, // 可调整中间点的高度
+            (startPoint.z + 2 * endPoint.z) / 3
+        );
+
+        // 使用 CatmullRomCurve3 创建一条平滑曲线
+        const curve = new THREE.CatmullRomCurve3([
+            startPoint,
+            midPoint1,
+            midPoint2,
+            endPoint
+        ]);
+
+        // 修改材质配置
+        const material = new THREE.MeshBasicMaterial({
+            map: this.map,
+            transparent: true,
+            opacity: 1,
+            side: THREE.DoubleSide,
+            depthWrite: true, // 修复深度问题
+        });
+        material.renderOrder = 1; // 设置渲染顺序
+        material.onBeforeCompile = (shader) => {
+            shader.vertexShader = `
+        attribute vec3 instanceColor;
+        varying vec3 vColor;
+    ` + shader.vertexShader;
+
+            shader.vertexShader = shader.vertexShader.replace(
+                `#include <begin_vertex>`,
+                `
+        #include <begin_vertex>
+        vColor = instanceColor;
+        `
+            );
+            shader.fragmentShader = `
+        varying vec3 vColor;
+    ` + shader.fragmentShader;
+
+            shader.fragmentShader = shader.fragmentShader.replace(
+                `#include <dithering_fragment>`,
+                `
+        #include <dithering_fragment>
+        gl_FragColor.rgb = vColor;
+        `
+            );
+        };
+        // 创建一个组来存放所有的分段
+        this.recommandPathLineGroup = new THREE.Group();
+
+        // 动态分段数计算
+        const pathLength = curve.getLength(); // 获取路径总长度
+        const segments = Math.max(2, Math.ceil(pathLength / this.pipeRadius));
+        const step = 1 / segments;
+        debugger
+        for (let i = 0; i < segments; i++) {
+            const t1 = i * step;
+            const t2 = (i + 1) * step;
+            const point1 = curve.getPointAt(t1);
+            const point2 = curve.getPointAt(t2);
+
+            // 创建平面
+            const segmentLength = point1.distanceTo(point2);
+            const planeGeometry = new THREE.PlaneGeometry(this.pipeRadius, segmentLength);
+            // 添加 instanceColor 属性
+            debugger
+            const vertexCount = planeGeometry.attributes.position.count;
+            // 使用 this.color(若未定义则默认为红色)
+            const color = new THREE.Color(this.color || 0xffff00);
+            const colors = new Float32Array(vertexCount * 3);
+            for (let j = 0; j < vertexCount; j++) {
+                colors[j * 3] = color.r;
+                colors[j * 3 + 1] = color.g;
+                colors[j * 3 + 2] = color.b;
+            }
+            planeGeometry.setAttribute('instanceColor', new THREE.BufferAttribute(colors, 3));
+
+            const plane = new THREE.Mesh(planeGeometry, material);
+
+            // 设置平面的位置和旋转
+            plane.position.copy(point1.clone().add(point2).multiplyScalar(0.5)); // 平面中心
+            plane.lookAt(point2); // 让平面朝向下一个点
+            plane.rotateX(Math.PI / 2); // 使平面与路径对齐
+            plane.rotateY(Math.PI / 2); // 使平面与路径对齐
+
+            // 将平面添加到组中
+            this.recommandPathLineGroup.add(plane);
+        }
+
+        // 将组添加到场景
+        this.scene.add(this.recommandPathLineGroup);
+
+        return curve; // 返回生成的曲线对象
+    },
+
+
+    /**
+     * 渲染器更新渲染
+     * @memberof BuildingEffect
+     * @method render
+     * @param {Object} context 已有渲染器信息,无需传值
+     */
+    render(context) {
+        let cam = this.camera;
+        //需要调整相机的视角
+        this._camera.position.set(cam.eye[0], cam.eye[1], cam.eye[2]);
+        this._camera.up.set(cam.up[0], cam.up[1], cam.up[2]);
+        this._camera.lookAt(new THREE.Vector3(cam.center[0], cam.center[1], cam.center[2]));
+        // Projection matrix can be copied directly
+        this._camera.projectionMatrix.fromArray(cam.projectionMatrix);
+        debugger
+        const delta = this.clock.getDelta();
+        const speed = 3; // 根据需要调整流动速度
+        this.map.offset.y -= delta * speed;
+        if(this.map.offset.y > 1){
+            this.map.offset.y = 0;
+        }
+        this.renderer.state.reset();
+
+        this.bindRenderTarget();
+
+        this.renderer.render(this.scene, this._camera);
+        // as we want to smoothly animate the ISS movement, immediately request a re-render
+        this.requestRender();
+
+        // cleanup
+        this.resetWebGLState();
+    }
+
+}
+