Browse Source

水下地形更新:增加水下地形模型版本,水深点接口更新优化

sbj 10 months ago
parent
commit
ac49e34339
6 changed files with 365 additions and 10669 deletions
  1. 82 10610
      package-lock.json
  2. 4 3
      src/apis/hdsj.js
  3. 8 1
      src/config/layerConfig.js
  4. 9 0
      src/utils/map/ArcgisUtil.js
  5. 261 54
      src/utils/map/Layer.js
  6. 1 1
      src/views/home/cpns/UnderWater.vue

File diff suppressed because it is too large
+ 82 - 10610
package-lock.json


+ 4 - 3
src/apis/hdsj.js

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

+ 8 - 1
src/config/layerConfig.js

@@ -12,6 +12,7 @@ module.exports = {
     sszhIconLayer: 'https://ghjg.china-gis.com/server/rest/services/Hosted/水上绿色综合服务区图标/SceneServer',
     hbLayer: 'https://ghjg.china-gis.com/server/rest/services/Hosted/航标/SceneServer',
     sxdxLayer202301: 'https://ghjg.china-gis.com/server/rest/services/Hosted/多波束/SceneServer',
+    sxdxLayer202302: 'https://ghjg.china-gis.com/server/rest/services/Hosted/第二期2023/SceneServer',
     sxdxLayer202201: 'https://ghjg.china-gis.com/server/rest/services/Hosted/第一期2022/SceneServer',
     sxdxLayer202202: 'https://ghjg.china-gis.com/server/rest/services/Hosted/第二期2022/SceneServer',
     sxdxLayer202101: 'https://ghjg.china-gis.com/server/rest/services/Hosted/第一期2021/SceneServer',
@@ -26,6 +27,12 @@ module.exports = {
     yjyjLayer202301: 'https://ghjg.china-gis.com/server/rest/services/Hosted/第一期2023淤积/SceneServer',
     LjzSjBefore2022: 'https://ghjg.china-gis.com/server/rest/services/Hosted/疏浚前拉伸10倍/SceneServer',
     LjzSjAfter2022: 'https://ghjg.china-gis.com/server/rest/services/Hosted/疏浚后拉伸10倍/SceneServer',
+    dm2020H1Layer:'https://ghjg.china-gis.com/server/rest/services/Hosted/断面_2020H1/SceneServer',
     dm2020H2Layer:'https://ghjg.china-gis.com/server/rest/services/Hosted/断面_2020H2/SceneServer',
-
+    dm2021H1Layer:'https://ghjg.china-gis.com/server/rest/services/Hosted/断面_2021H1/SceneServer',
+    dm2021H2Layer:'https://ghjg.china-gis.com/server/rest/services/Hosted/断面_2021H2/SceneServer',
+    dm2022H1Layer:'https://ghjg.china-gis.com/server/rest/services/Hosted/断面_2022H1/SceneServer',
+    dm2022H2Layer:'https://ghjg.china-gis.com/server/rest/services/Hosted/断面_2022H2/SceneServer',
+    dm2023H1Layer:'https://ghjg.china-gis.com/server/rest/services/Hosted/断面_2023H1/SceneServer',
+    dm2023H2Layer:'https://ghjg.china-gis.com/server/rest/services/Hosted/断面_2023H2/SceneServer'
 }

+ 9 - 0
src/utils/map/ArcgisUtil.js

@@ -3,6 +3,7 @@ import CityGis from "@/utils/map/CityGis.Bridge";
 import { ElMessage } from 'element-plus'
 import 'element-plus/es/components/message/style/css'
 import {onLocationBoat} from '@/utils/map/Boat'
+import {refreshDepthPoints} from '@/utils/map/Layer'
 import bus from '@/utils/bus';
 import {setMultiBoatHistory} from '@/utils/map/Boat'
 
@@ -11,6 +12,7 @@ let calculateFinish = false
 // let drawGeometry = null
 let drawResult = null
 let showBoat = false
+let showDepthPoints = false
 let mapExtent
 let mapScale
 let clickGraphic
@@ -37,6 +39,9 @@ export function initBridge(){
                 if(showBoat){
                     onLocationBoat()
                 }
+                if(showDepthPoints){
+                    refreshDepthPoints()
+                }
                 break;
             case "MapClickObject":
                 clickGraphic = arg.data.graphic
@@ -514,3 +519,7 @@ export function closeBoatDriving(data){
     };
     bridge.Invoke(params);
 }
+
+export function setShowDepthPointsState(data){
+    showDepthPoints = data
+}

+ 261 - 54
src/utils/map/Layer.js

@@ -1,14 +1,26 @@
 /**
  * 图层加载工具类
  */
-import {setBoat} from '@/utils/map/Boat'
-import {addGraphic, addLayer, clearMap, setOpacity} from "@/utils/map/ArcgisUtil";
+import {onLocationBoat, setBoat} from '@/utils/map/Boat'
+import {
+    addGraphic,
+    addLayer,
+    clearMap,
+    getMapExtent,
+    getMapScale,
+    setOpacity,
+    setShowDepthPointsState
+} from "@/utils/map/ArcgisUtil";
 import {setCenter,setSxdxCamera} from '@/utils/map/Common'
 import {GetHpjDepthPoints} from '@/apis/hdsj'
 import layerConfig from '@/config/layerConfig'
 
 // 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 = []
+let depthInterval
+let depthParams
+// let currentDepthYear
+let showDepthPoints = false
 
 let defaultLayerList = [
     {
@@ -258,6 +270,18 @@ export function addLayerByName(name,isShow,opacity){
                 is_goto: true
             })
             break
+        case '2023.2':
+            addLayer({
+                id: 'deepthLayer202302',
+                title: 'deepthLayer202302',
+                type: 'scene',
+                url: layerConfig.sxdxLayer202302,
+                visible: isShow,
+                opacity: opacity?opacity:1,
+                token: '',
+                is_goto: true
+            })
+            break
         case '2022.1':
             addLayer({
                 id: 'deepthLayer202201',
@@ -478,10 +502,31 @@ export function addLayerByName(name,isShow,opacity){
             })
             break
         // 水深剖面
+        case 'pm_2020.1':
+            addLayer({
+                id: 'warterDepthLine2020H1Layer',
+                title: 'warterDepthLine2020H1Layer',
+                type: 'scene',
+                url: layerConfig.dm2020H1Layer,
+                visible: isShow,
+                opacity: opacity?opacity:1,
+                token: ''
+            })
+
+            var data = {'distance': 100, 'year': 2020.1}
+            if(isShow){
+                if(getMapScale() <= 5000) {
+                    getDeepthPoints(data)
+                }
+            }else{
+                clearMap({is_draw: true, is_search:true, layers: []})
+            }
+            setDepthState(data,isShow)
+            break
         case 'pm_2020.2':
             addLayer({
-                id: 'warterDepthLineLayer',
-                title: 'warterDepthLineLayer',
+                id: 'warterDepthLine2020H2Layer',
+                title: 'warterDepthLine2020H2Layer',
                 type: 'scene',
                 url: layerConfig.dm2020H2Layer,
                 visible: isShow,
@@ -489,62 +534,224 @@ export function addLayerByName(name,isShow,opacity){
                 token: ''
             })
 
+            var data = {'distance': 100, 'year': 2020.2}
+            if(isShow){
+                if(getMapScale() <= 5000) {
+                    getDeepthPoints(data)
+                }
+            }else{
+                clearMap({is_draw: true, is_search:true, layers: []})
+            }
+            setDepthState(data,isShow)
+            break
+        // 水深剖面
+        case 'pm_2021.1':
+            addLayer({
+                id: 'warterDepthLine2021H1Layer',
+                title: 'warterDepthLine2021H1Layer',
+                type: 'scene',
+                url: layerConfig.dm2021H1Layer,
+                visible: isShow,
+                opacity: opacity?opacity:1,
+                token: ''
+            })
+
+            var data = {'distance': 100, 'year': 2021.1}
+            if(isShow){
+                if(getMapScale() <= 5000) {
+                    getDeepthPoints(data)
+                }
+            }else{
+                clearMap({is_draw: true, is_search:true, layers: []})
+            }
+            setDepthState(data,isShow)
+            break
+        case 'pm_2021.2':
+            addLayer({
+                id: 'warterDepthLine2021H2Layer',
+                title: 'warterDepthLine2021H2Layer',
+                type: 'scene',
+                url: layerConfig.dm2021H2Layer,
+                visible: isShow,
+                opacity: opacity?opacity:1,
+                token: ''
+            })
+
+            var data = {'distance': 100, 'year': 2021.2}
+            if(isShow){
+                if(getMapScale() <= 5000) {
+                    getDeepthPoints(data)
+                }
+            }else{
+                clearMap({is_draw: true, is_search:true, layers: []})
+            }
+            setDepthState(data,isShow)
+            break
+        case 'pm_2022.1':
+            addLayer({
+                id: 'warterDepthLine2022H1Layer',
+                title: 'warterDepthLine2022H1Layer',
+                type: 'scene',
+                url: layerConfig.dm2022H1Layer,
+                visible: isShow,
+                opacity: opacity?opacity:1,
+                token: ''
+            })
+
+            var data = {'distance': 100, 'year': 2022.1}
+            if(isShow){
+                if(getMapScale() <= 5000) {
+                    getDeepthPoints(data)
+                }
+            }else{
+                clearMap({is_draw: true, is_search:true, layers: []})
+            }
+            setDepthState(data,isShow)
+            break
+        case 'pm_2022.2':
+            addLayer({
+                id: 'warterDepthLine2022H2Layer',
+                title: 'warterDepthLine2022H2Layer',
+                type: 'scene',
+                url: layerConfig.dm2022H2Layer,
+                visible: isShow,
+                opacity: opacity?opacity:1,
+                token: ''
+            })
+
+            var data = {'distance': 100, 'year': 2022.2}
+            if(isShow){
+                if(getMapScale() <= 5000) {
+                    getDeepthPoints(data)
+                }
+            }else{
+                clearMap({is_draw: true, is_search:true, layers: []})
+            }
+            setDepthState(data,isShow)
+            break
+/*        case 'pm_2023.1':
+            addLayer({
+                id: 'warterDepthLine2023H1Layer',
+                title: 'warterDepthLine2023H1Layer',
+                type: 'scene',
+                url: layerConfig.dm2023H1Layer,
+                visible: isShow,
+                opacity: opacity?opacity:1,
+                token: ''
+            })
+
+            var data = {'distance': 100, 'year': 2023.1}
+            if(isShow){
+                if(getMapScale() <= 5000) {
+                    getDeepthPoints(data)
+                }
+            }else{
+                clearMap({is_draw: true, is_search:true, layers: []})
+            }
+            setDepthState(data,isShow)
+            break*/
+        case 'pm_2023.2':
+            addLayer({
+                id: 'warterDepthLine2023H2Layer',
+                title: 'warterDepthLine2023H2Layer',
+                type: 'scene',
+                url: layerConfig.dm2023H2Layer,
+                visible: isShow,
+                opacity: opacity?opacity:1,
+                token: ''
+            })
+
+            var data = {'distance': 100, 'year': 2023.2}
             if(isShow){
-                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 * 10,
-                                            text: linePoints[j].depth
-                                        }
-                                        dataList.push(point)
-                                    }
-                                }
+                if(getMapScale() <= 5000) {
+                    getDeepthPoints(data)
+                }
+            }else{
+                clearMap({is_draw: true, is_search:true, layers: []})
+            }
+            setDepthState(data,isShow)
+            break
+    }
+}
+
+export function refreshDepthPoints(){
+    if(getMapScale() <= 5000 && showDepthPoints) {
+        getDeepthPoints(depthParams)
+    }else{
+        clearMap({is_draw: false, is_search:true, layers: []})
+    }
+}
+function getDeepthPoints(data){
+    // if(data != null && data.year === currentDepthYear){
+    //     return
+    // }
+    // currentDepthYear = data.year
+    let extent = getMapExtent()
+    data.maxX = extent.xmax + 200
+    data.minX = extent.xmin - 200
+    data.maxY = extent.ymax + 200
+    data.minY = extent.ymin - 200
+    GetHpjDepthPoints(data).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 * 10,
+                                text: linePoints[j].depth
                             }
-                            addGraphic({
-                                "type": 'points',
-                                "is_edit": false,
-                                "is_clear": true,
-                                "is_temp": false,
-                                "is_goto": false,
-                                "data": dataList,
-                                "attributes": null,
-                                "symbol": {
-                                    type: "simple-marker",
-                                    style: "circle",
-                                    color: [255, 255, 255],
-                                    size: 5
-                                },
-                                "title": null
-                            })
-                        }else{
-                            this.$message({
-                                type: 'error',
-                                message: '未查询到水深点数据!'
-                            })
+                            dataList.push(point)
                         }
-                    }else{
-                        this.$message({
-                            type: 'error',
-                            message: '查询水深点数据失败!'
-                        })
-                        console.log(res.msg)
                     }
+                }
+                addGraphic({
+                    "type": 'points',
+                    "is_edit": false,
+                    "is_clear": true,
+                    "is_temp": false,
+                    "is_goto": false,
+                    "data": dataList,
+                    "attributes": null,
+                    "symbol": {
+                        type: "simple-marker",
+                        style: "circle",
+                        color: [255, 255, 255],
+                        size: 5
+                    },
+                    "title": null
                 })
             }else{
-                clearMap({is_draw: true, is_search:true, layers: []})
+                this.$message({
+                    type: 'error',
+                    message: '未查询到水深点数据!'
+                })
             }
-            break
+        }else{
+            this.$message({
+                type: 'error',
+                message: '查询水深点数据失败!'
+            })
+            console.log(res.msg)
+        }
+    })
+}
+
+function setDepthState(data,state){
+    setShowDepthPointsState(state)
+    showDepthPoints = state
+    if(state){
+        depthParams = data
+    }
+    else{
+        depthParams = null
     }
 }

+ 1 - 1
src/views/home/cpns/UnderWater.vue

@@ -176,7 +176,7 @@ const currentType = ref('lashen')
 function handleChangeType() {
   console.log(1111111111111111111111)
   sxdxCurrentShowDuanmian.value = !sxdxCurrentShowDuanmian.value
-  addLayerByName("pm_" + sxdxCurrent.value, !sxdxCurrentShowDuanmian.value)
+  addLayerByName("pm_" + sxdxCurrent.value, sxdxCurrentShowDuanmian.value)
 
 
   // currentType.value = currentType.value==='lashen'? 'pingmian': 'lashen'