Bläddra i källkod

添加水深剖面上水深点标注

lag 1 år sedan
förälder
incheckning
b72b0d3a01
2 ändrade filer med 63 tillägg och 1 borttagningar
  1. 7 0
      src/apis/hdsj.js
  2. 56 1
      src/utils/map/Layer.js

+ 7 - 0
src/apis/hdsj.js

@@ -77,4 +77,11 @@ export function GetWhss() {
     url: '/DigitalTwin/WaterDepthSpace/getHpjArea',
     method: "post"
   })
+}
+
+export function GetHpjDepthPoints() {
+  return request({
+    url: '/DigitalTwin/GetHpjDepthPoints?distance=100',
+    method: "get"
+  })
 }

+ 56 - 1
src/utils/map/Layer.js

@@ -2,8 +2,9 @@
  * 图层加载工具类
  */
 import {setBoat} from '@/utils/map/Boat'
-import {addLayer,setOpacity} from "@/utils/map/ArcgisUtil";
+import {addGraphic, addLayer, setOpacity} from "@/utils/map/ArcgisUtil";
 import {setCenter,setSxdxCamera} from '@/utils/map/Common'
+import {GetHpjDepthPoints} from '@/apis/hdsj'
 
 // let layerList = ['cb','mt','jjq','dtq','md','sszh','hb','hd','sxdx','2023.1','2022.1','2022.2','2021.1','2021.2','2020.1','2020.2']
 let layerList = []
@@ -67,6 +68,60 @@ export function closeAllLayer() {
 }
 
 export function addLayerByName(name,isShow,opacity){
+    switch (name) {
+        case 'pm_2020.2':
+            GetHpjDepthPoints().then(res=>{
+                if(res.code == '200'){
+                    if(res.data.Rows != null && res.data.Rows.length > 0){
+                        let rows = res.data.Rows
+                        let dataList = []
+                        for(let i=0;i<rows.length;i++){
+                            let linePoints = rows[i]
+                            if(linePoints.length > 0){
+                                for(let j=0;j<linePoints.length;j++){
+                                    if(linePoints[j].depth == null){
+                                        continue
+                                    }
+                                    let point = {
+                                        x: linePoints[j].pointX,
+                                        y: linePoints[j].pointY,
+                                        z: linePoints[j].pointZ,
+                                        name: linePoints[j].depth
+                                    }
+                                    dataList.push(point)
+                                }
+                            }
+                        }
+                        addGraphic({
+                            "type": 'points',
+                            "is_edit": false,
+                            "is_clear": true,
+                            "is_temp": false,
+                            "is_goto": false,
+                            "data": dataList,
+                            "attributes": null,
+                            "symbol": null,
+                            "title": null
+                        })
+                    }else{
+                        this.$message({
+                            type: 'error',
+                            message: '未查询到水深点数据!'
+                        })
+                    }
+                }else{
+                    this.$message({
+                        type: 'error',
+                        message: '查询水深点数据失败!'
+                    })
+                    console.log(res.msg)
+                }
+            })
+    }
+    this.addLayers(name,isShow,opacity)
+}
+
+export function addLayers(name,isShow,opacity){
     // 存储到打开图层列表
     if(isShow){
         let isExist = false