123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757 |
- /**
- * 图层加载工具类
- */
- 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 = [
- {
- // 水上客运
- id: 'waterPassenger',
- title: 'waterPassenger',
- type: 'feature',
- url: layerConfig.waterPassengerLayer,
- visible: false,
- opacity: 1,
- token: '',
- is_goto: false
- },
- {
- // 数字孪生图层
- id: 'digitalTwain',
- title: 'digitalTwain',
- type: 'feature',
- url: layerConfig.digitalTwinLayer,
- visible: false,
- opacity: 1,
- token: '',
- is_goto: false
- },
- {
- // 地图查询图层
- id: 'ghjgCxall',
- title: 'ghjgCxall',
- type: 'shc_map',
- url:layerConfig.ghjgCxAllLayer,
- visible: false,
- opacity: 1,
- token: '',
- is_goto: false
- }
- ]
- export function addDefaultServer(){
- for (let i = 0; i < defaultLayerList.length; i++) {
- let layerObject = defaultLayerList[i];
- addLayer({
- id: layerObject.id,
- title: layerObject.title,
- type: layerObject.type,
- url: layerObject.url,
- visible: layerObject.visible,
- opacity: layerObject.opacity,
- token: layerObject.token,
- is_goto: layerObject.is_goto
- })
- }
- }
- export function closeAllLayer() {
- for (let i = layerList.length-1; i >=0;i--) {
- addLayerByName(layerList[i],false)
- }
- }
- export function addLayerByName(name,isShow,opacity){
- // 存储到打开图层列表
- if(isShow){
- let isExist = false
- for(let i = layerList.length-1; i >=0;i--){
- if(layerList[i] == name){
- isExist = true
- }
- }
- if(!isExist){
- layerList.push(name)
- }
- }else{
- for(let i = layerList.length-1; i >=0;i--){
- if(layerList[i] == name){
- layerList.splice(i,1)
- }
- }
- }
- console.log(layerList)
- switch (name) {
- // 船舶
- case 'cb':
- setBoat(isShow)
- break
- // 码头泊位
- case 'mt':
- addLayer({
- id: 'portLayer',
- title: 'portLayer',
- type: 'feature',
- url: layerConfig.digitalTwinLayer+'/0',
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- break
- // 警戒区
- case 'jjq':
- addLayer({
- id: 'jjqIconLayer',
- title: 'jjqIconLayer',
- type: 'scene',
- url: layerConfig.jjqIconLayer,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- addLayer({
- id: 'jjqAreaLayer',
- title: 'jjqAreaLayer',
- type: 'feature',
- url: layerConfig.jjqLayer,
- visible: isShow,
- opacity: opacity?opacity:0.5,
- token: '',
- is_goto: true
- })
- break
- // 掉头区
- case 'dtq':
- addLayer({
- id: 'dtqIconLayer',
- title: 'dtqIconLayer',
- type: 'scene',
- url: layerConfig.dtqIconLayer,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- addLayer({
- id: 'dtqAreaLayer',
- title: 'dtqAreaLayer',
- type: 'feature',
- url: layerConfig.dtqLayer,
- visible: isShow,
- opacity: opacity?opacity:0.5,
- token: '',
- is_goto: true
- })
- break
- // 锚地
- case 'md':
- addLayer({
- id: 'mdIconLayer',
- title: 'mdIconLayer',
- type: 'scene',
- url: layerConfig.mdIconLayer,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- addLayer({
- id: 'mdAreaLayer',
- title: 'mdAreaLayer',
- type: 'feature',
- url: layerConfig.mdLayer,
- visible: isShow,
- opacity: opacity?opacity:0.5,
- token: '',
- is_goto: true
- })
- break
- // 水上综合绿色服务器
- case 'sszh':
- addLayer({
- id: 'ssfwqIconLayer',
- title: 'ssfwqIconLayer',
- type: 'scene',
- url: layerConfig.sszhIconLayer,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- addLayer({
- id: 'ssfwqAreaLayer',
- title: 'ssfwqAreaLayer',
- type: 'feature',
- url: layerConfig.sszhLayer,
- visible: isShow,
- opacity: opacity?opacity:0.5,
- token: '',
- is_goto: true
- })
- break
- // 航标
- case 'hb':
- addLayer({
- id: 'hbSceneLayer',
- title: 'hbSceneLayer',
- type: 'scene',
- url: layerConfig.hbLayer,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- break
- // 航道
- case 'hd':
- addLayer({
- id: 'channelLayer',
- title: 'channelLayer',
- type: 'feature',
- url: layerConfig.digitalTwinLayer+'/2',
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- break
- // 水下地形
- case 'sxdx':
- addLayer({
- id: 'dbsLayer',
- title: 'dbsLayer',
- type: 'scene',
- url: layerConfig.sxdxLayer202301,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- // if(isShow){
- // setOpacity(0.4)
- // setSxdxCamera()
- // }else{
- // setOpacity(1)
- // setCenter()
- // }
- break
- case '2023.1':
- addLayer({
- id: 'deepthLayer202301',
- title: 'deepthLayer202301',
- type: 'scene',
- url: layerConfig.sxdxLayer202301,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- 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',
- title: 'deepthLayer202201',
- type: 'scene',
- url: layerConfig.sxdxLayer202201,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: false
- })
- break
- case '2022.2':
- addLayer({
- id: 'deepthLayer202202',
- title: 'deepthLayer202202',
- type: 'scene',
- url: layerConfig.sxdxLayer202202,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- case '2021.1':
- addLayer({
- id: 'deepthLayer202101',
- title: 'deepthLayer202101',
- type: 'scene',
- url: layerConfig.sxdxLayer202101,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- case '2021.2':
- addLayer({
- id: 'deepthLayer202102',
- title: 'deepthLayer202102',
- type: 'scene',
- url: layerConfig.sxdxLayer202202,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- case '2020.1':
- addLayer({
- id: 'deepthLayer202001',
- title: 'deepthLayer202001',
- type: 'scene',
- url: layerConfig.sxdxLayer202001,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- case '2020.2':
- addLayer({
- id: 'deepthLayer202002',
- title: 'deepthLayer202002',
- type: 'scene',
- url: layerConfig.sxdxLayer202002,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- // 两岸白膜
- case 'bm':
- addLayer({
- id: 'hpj500mBuildingLayer',
- title: 'hpj500mBuildingLayer',
- type: 'scene',
- url: layerConfig.labmhPJ500Layer,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- addLayer({
- id: 'pxBuildingLayer',
- title: 'pxBuildingLayer',
- type: 'scene',
- url: layerConfig.labmPxLayer,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- // 两岸精膜
- case 'jm':
- addLayer({
- id: 'jmBuildingLayer',
- title: 'jmBuildingLayer',
- type: 'scene',
- url: layerConfig.lajmLayer,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- // 客运码头
- case 'kymt':
- addLayer({
- id: 'kymtLayer',
- title: 'kymtLayer',
- type: 'scene',
- url: layerConfig.kymtLayer,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- // 淤积预警
- case 'yjyj':
- addLayer({
- id: 'yjyjLayer',
- title: 'yjyjLayer',
- type: 'scene',
- url: layerConfig.yjyjLayer202301,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- is_goto: true
- })
- if(isShow){
- addLayer({
- id: 'dbsLayer',
- title: 'dbsLayer',
- type: 'scene',
- url: layerConfig.sxdxLayer202301,
- visible: false,
- opacity: 1,
- token: '',
- is_goto: true
- })
- addLayer({
- id: 'dbsLayer',
- title: 'dbsLayer',
- type: 'scene',
- url: layerConfig.sxdxLayer202301,
- visible: true,
- opacity: 0.4,
- token: '',
- is_goto: false
- })
- }else{
- addLayer({
- id: 'dbsLayer',
- title: 'dbsLayer',
- type: 'scene',
- url: layerConfig.sxdxLayer202301,
- visible: false,
- opacity: 1,
- token: '',
- is_goto: true
- })
- addLayer({
- id: 'dbsLayer',
- title: 'dbsLayer',
- type: 'scene',
- url: layerConfig.sxdxLayer202301,
- visible: true,
- opacity: 1,
- token: '',
- is_goto: false
- })
- }
- break
- // 疏浚前_22年陆家嘴弯道
- case '2022LjzBefore':
- addLayer({
- id: '2022LjzBefore',
- title: '2022LjzBefore',
- type: 'scene',
- url: layerConfig.LjzSjBefore2022,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- // 疏浚后_22年陆家嘴弯道
- case '2022LjzAfter':
- addLayer({
- id: '2022LjzAfterLayer',
- title: '2022LjzAfterLayer',
- type: 'scene',
- url: layerConfig.LjzSjAfter2022,
- visible: isShow,
- opacity: 1,
- token: '',
- is_goto: false
- })
- break
- // 危险品码头
- case 'wxpmt':
- addLayer({
- id: 'dangerPortLayer',
- title: 'dangerPortLayer',
- type: 'scene',
- url: layerConfig.wxpmtLayer,
- visible: isShow,
- opacity: opacity?opacity:1,
- token: '',
- elevationInfo: {
- "mode": "absolute-height",
- "offset": 0.1
- }
- })
- 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: 'warterDepthLine2020H2Layer',
- title: 'warterDepthLine2020H2Layer',
- type: 'scene',
- url: layerConfig.dm2020H2Layer,
- visible: isShow,
- opacity: opacity?opacity:1,
- 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){
- 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
- }
- dataList.push(point)
- }
- }
- }
- 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: '未查询到水深点数据!'
- })
- }
- }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
- }
- }
|