| | |
| | | /* eslint-disable no-debugger */ |
| | | import AjaxUtils from '@/utils/AjaxUtils' |
| | | import * as utils from '../../utils/utils' |
| | | |
| | | /** |
| | | * 底图管理助手,负责底图创建及开关 |
| | |
| | | */ |
| | | showBasemap = (code, showAnnotation, isHideOthers = true) => { |
| | | const basemap = this.basemapMap.get(code) |
| | | |
| | | if (isHideOthers) { |
| | | this.basemapLayerGroup.clearLayers() |
| | | } |
| | | setTimeout(() => { |
| | | // const layer = this.basemapLayerGroup.hasLayer(basemap.layer) |
| | | // if (!layer) { |
| | | this.basemapLayerGroup.addLayer(basemap.layer) |
| | | // } |
| | | |
| | | if (showAnnotation) { |
| | | // if() |
| | | this.basemapLayerGroup.addLayer(basemap.annotation) |
| | | } else { |
| | | this.basemapLayerGroup.removeLayer(basemap.annotation) |
| | | } |
| | | }, 300) |
| | | this.basemapLayerGroup.addLayer(basemap.layer) |
| | | if (showAnnotation) { |
| | | this.basemapLayerGroup.addLayer(basemap.annotation) |
| | | } else { |
| | | this.basemapLayerGroup.removeLayer(basemap.annotation) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | const internetBasemaps = config.mapConfig.InternetBaseMaps |
| | | for (let i = 0, len = internetBasemaps.length; i < len; ++i) { |
| | | const basemapConfig = internetBasemaps[i] |
| | | const mapToken = utils.getRandomTDTToken() |
| | | const mapUrl = utils.changeURLArg(basemapConfig.map.url, 'tk', mapToken) |
| | | console.log(mapToken) |
| | | console.log(mapUrl) |
| | | console.log(basemapConfig.map.url) |
| | | const basemapLayer = this.L.tileLayer(basemapConfig.map.url, basemapConfig.map.option) |
| | | const basemapAnnotationLayer = this.L.tileLayer(basemapConfig.annotation.url, basemapConfig.annotation.option) |
| | | |