From 57b93c75dac23bd9b4c8400d32169eaef62414d5 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期五, 14 五月 2021 15:52:17 +0800 Subject: [PATCH] 点击弹窗加筛选条件 --- src/components/LayerController/service/WmsLayerService.js | 4 ++++ src/conf/MapConfig.js | 2 +- src/components/LayerController/service/LayerFactory.js | 7 +++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/LayerController/service/LayerFactory.js b/src/components/LayerController/service/LayerFactory.js index 51fe254..8d7c1c6 100644 --- a/src/components/LayerController/service/LayerFactory.js +++ b/src/components/LayerController/service/LayerFactory.js @@ -1,8 +1,7 @@ import WfsLayerService from './WfsLayerService' -import { clone } from '../../../utils/utils' +import { clone, pulseEffect } from '../../../utils/utils' import { logicMapper, SERVICE_TYPE } from '../../../conf/Constants' import WmsLayerService from './WmsLayerService' -import AnimalService from './AnimalService' /** * init 鍙垵濮嬪寲涓�娆� @@ -18,8 +17,8 @@ this.layersLogic = {} this.minZoomLayers = {} this.wmsLayers = [] + // todo 寰呬紭鍖栵紝wmslayerservice璋冪敤锛屾斁杩欓噷涓嶅悎閫� this.clickSwitch = true // 鍥惧眰鐐瑰嚮寮圭獥寮�鍏� - this.animalService = new AnimalService({ L: this.L }) this.hightlightLayer = options.L.featureGroup({}).addTo(window.map) } @@ -225,7 +224,7 @@ if (point.length > 2) { point = [point[0], point[1]] } - this.animalService.pulseEffect(point.reverse()) + pulseEffect(point.reverse()) /* var myIcon = this.L.divIcon({ className: 'my-div-icon' }) this.L.marker(feature.geometry.coordinates.reverse(), { icon: myIcon diff --git a/src/components/LayerController/service/WmsLayerService.js b/src/components/LayerController/service/WmsLayerService.js index 076340e..fbc74bd 100644 --- a/src/components/LayerController/service/WmsLayerService.js +++ b/src/components/LayerController/service/WmsLayerService.js @@ -92,6 +92,7 @@ var size = this.map.getSize() // const bbox = this.L.latLngBounds(this.L.latLng(e.latlng.lng, e.latlng.lat)).toBBoxString() const layers = this.wmsLayerList.getLayers() + const filter = this.wmsLayerList.getFilters() if (layers.length > 0) { const params = Object.assign({ LAYERS: layers, @@ -102,6 +103,9 @@ Y: Math.round(point.y), BBOX: this.map.getBounds().toBBoxString() }, this.params) + if (filter.length > 0) { + params.cql_filter = filter + } AjaxUtils.get4JsonDataByUrl(WMS_URL, params, (res) => { const features = res.data.features /** diff --git a/src/conf/MapConfig.js b/src/conf/MapConfig.js index d41d182..ec1f64e 100644 --- a/src/conf/MapConfig.js +++ b/src/conf/MapConfig.js @@ -22,7 +22,7 @@ const mapOptions = { crs: L.CRS.EPSG4326, minZoom: 3, - maxZoom: 17, + maxZoom: 21, // center: [26, 104], center: [34.828558921813965, 117.41676807403564], zoom: 5, -- Gitblit v1.8.0