From 593f6ccd3aec8045a26b4b330f2b034df05bfd9f Mon Sep 17 00:00:00 2001 From: seatonwan9 <seatonwan9@163.com> Date: 星期五, 28 五月 2021 09:27:55 +0800 Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop --- src/components/LayerController/service/WmsLayerService.js | 44 ++++++++++++++++++++++++++++++++++---------- 1 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/components/LayerController/service/WmsLayerService.js b/src/components/LayerController/service/WmsLayerService.js index b64e539..20f2af7 100644 --- a/src/components/LayerController/service/WmsLayerService.js +++ b/src/components/LayerController/service/WmsLayerService.js @@ -40,23 +40,47 @@ init () { } + addAll (configs) { + for (let i = 0; i < configs.length; i++) { + const config = configs[i] + const layers = config.layers + if (layers) { + this.addAll(layers) + } + this.wmsLayerList.addConfig(config) + } + this.reload() + } + add (config) { this.wmsLayerList.addConfig(config) + this.reload() + } + + removeAll (configs) { + for (let i = 0; i < configs.length; i++) { + const config = configs[i] + const layers = config.layers + if (layers) { + this.removeAll(layers) + } + this.wmsLayerList.remove(config.typeName, config.filter) + } + this.reload() + } + + remove (config) { + this.wmsLayerList.remove(config.typeName, config.filter) + this.reload() + } + + reload () { const layers = this.wmsLayerList.getLayers() || '' const filter = this.wmsLayerList.getFilters() || '' const params = {} params.cql_filter = filter params.layers = layers - this.wmsLayer.setParams(params) - } - - remove (config) { - this.wmsLayerList.remove(config.typeName, config.filter) - const layers = this.wmsLayerList.getLayers() || '' - const filter = this.wmsLayerList.getFilters() || '' - const params = { layers: layers } - params.cql_filter = filter - this.wmsLayer.setParams(params) + this.wmsLayer.setParams(params, false) } load () { -- Gitblit v1.8.0