|
@@ -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
|
|
|
}
|
|
|
}
|