From 2483e4562d0373ed571e7efd0d92890c7fdaec80 Mon Sep 17 00:00:00 2001
From: 徐旺旺 <11530253@qq.com>
Date: 星期四, 20 五月 2021 18:05:09 +0800
Subject: [PATCH] 修改图层控制逻辑
---
src/components/LayerController/dataset/WmsLayerList.js | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/components/LayerController/dataset/WmsLayerList.js b/src/components/LayerController/dataset/WmsLayerList.js
index fc0e782..3aaeb12 100644
--- a/src/components/LayerController/dataset/WmsLayerList.js
+++ b/src/components/LayerController/dataset/WmsLayerList.js
@@ -1,5 +1,8 @@
import clone from '../../../utils/utils'
+/**
+ * 缁勮wms鍔犺浇鎵�闇�鐨刲ayers浠ュ強filters鍙傛暟
+ */
class WmsLayerList {
constructor () {
// [{鍥惧眰鍚嶇О锛歔{typeName:xxx,filter:yyy}]}]
@@ -10,7 +13,7 @@
const typeName = config.typeName
const layerGroup = config.layerGroup || typeName
const filter = config.filter
- const index = config.index || 9
+ const index = config.index
if (layerGroup) {
this.addLayer(layerGroup, typeName, filter, index)
}
@@ -18,7 +21,6 @@
addLayer (layerGroup, typeName, filter, index) {
const layer = this._getLayer(layerGroup)
-
if (layer) {
const offset = this.indexOf(typeName, filter)
if (offset < 0) {
@@ -28,7 +30,11 @@
} else {
const layerConfig = {}
layerConfig[layerGroup] = [{ typeName: typeName, filter: filter || 'INCLUDE' }]
- this.layers.push(layerConfig)
+ if (index) {
+ this.layers[index] = layerConfig
+ } else {
+ this.layers.push(layerConfig)
+ }
}
}
@@ -36,7 +42,7 @@
const layers = this.layers
for (let i = 0; i < layers.length; i++) {
const lay = layers[i]
- if (lay[layer]) {
+ if (lay && lay[layer]) {
return lay
}
}
@@ -112,7 +118,9 @@
}
}
}
- cqlFilters.push(filters.join(' OR '))
+ if (filters.length > 0) {
+ cqlFilters.push(filters.join(' OR '))
+ }
}
return cqlFilters.join(';')
}
--
Gitblit v1.8.0