From da21171cc9b248ad9c7f062e41f039eceb910c23 Mon Sep 17 00:00:00 2001 From: YANGDL <114714267@qq.com> Date: 星期六, 09 一月 2021 14:08:19 +0800 Subject: [PATCH] 优化天地图矢量瓦片切换 --- src/components/helpers/ServiceLayerHelper.js | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/helpers/ServiceLayerHelper.js b/src/components/helpers/ServiceLayerHelper.js index 7175040..21d9aca 100644 --- a/src/components/helpers/ServiceLayerHelper.js +++ b/src/components/helpers/ServiceLayerHelper.js @@ -10,6 +10,7 @@ this.L = options.L this.tileLayersMap = new Map() this.tileLayersWMSArray = [] + this.tileLayerWmslayerGroup = L.layerGroup().addTo(this.map) this.tileLayersWMTSArray = [] this.tileLayersTileArray = [] this.mapConfig = {} @@ -72,7 +73,7 @@ layer.config = config if (isAddToMap) { - layer.addTo(this.map) + layer.addTo(this.tileLayerWmslayerGroup) } this.tileLayersMap.set(options.code, layer) this.tileLayersWMSArray.push(layer) @@ -152,7 +153,7 @@ getWMSConfig (code) { const mc = this.mapConfig for (let i = 0, len = mc.mapConfig.ServiceLayers.length; i < len; ++i) { - if (code == mc.mapConfig.ServiceLayers[i].code && mc.mapConfig.ServiceLayers[i].type === 'wms') { + if (code === mc.mapConfig.ServiceLayers[i].code && mc.mapConfig.ServiceLayers[i].type === 'wms') { return mc.mapConfig.ServiceLayers[i] } } -- Gitblit v1.8.0