From 32c49e86a7876f9252b0a88a0685c203830476f1 Mon Sep 17 00:00:00 2001 From: 陈泽平 <chenzeping> Date: 星期五, 28 五月 2021 16:40:23 +0800 Subject: [PATCH] 企业应急-事件上报-搜索定位 --- src/components/LayerController/service/WmsLayerService.js | 46 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/components/LayerController/service/WmsLayerService.js b/src/components/LayerController/service/WmsLayerService.js index 4706862..20f2af7 100644 --- a/src/components/LayerController/service/WmsLayerService.js +++ b/src/components/LayerController/service/WmsLayerService.js @@ -19,6 +19,7 @@ INFO_FORMAT: 'application/json', TRANSPARENT: true, FEATURE_COUNT: 50, + maxZoom: 21, SRS: 'EPSG:4326', EXCEPTIONS: 'application/vnd.ogc.se_inimage' } @@ -39,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 () { @@ -64,6 +89,7 @@ const params = { format: 'image/png', // 杩斿洖鐨勬暟鎹牸寮� transparent: true, + maxZoom: 21, BBOX: this.map.getBounds().toBBoxString() } if (layers) { -- Gitblit v1.8.0