From 1264fb6de514634073eb623b0e201df9296baa0b Mon Sep 17 00:00:00 2001
From: 徐旺旺 <11530253@qq.com>
Date: 星期二, 02 三月 2021 14:10:56 +0800
Subject: [PATCH] 修改图层控制
---
src/conf/MapConfig.js | 4 ++--
src/components/helpers/WfsHelper.js | 18 ++++++++++++++++--
src/components/LayerController/modules/LcServiceLayer.vue | 2 +-
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/components/LayerController/modules/LcServiceLayer.vue b/src/components/LayerController/modules/LcServiceLayer.vue
index 64b2361..de69136 100644
--- a/src/components/LayerController/modules/LcServiceLayer.vue
+++ b/src/components/LayerController/modules/LcServiceLayer.vue
@@ -56,7 +56,7 @@
loadWfs () {
var wfsHelper = new WfsHelper()
wfsHelper.addTypeName('绠$嚎鐐�')
- wfsHelper.appendEquals('pipename', '鐮旂┒闄�01璺痀S000001')
+ wfsHelper.addEquals('pipename', '鐮旂┒闄�01璺痀S000001')
AjaxUtils.GetDataAsynByUrl(wfsHelper.getUrl(), {}, (res) => {
console.log(res)
diff --git a/src/components/helpers/WfsHelper.js b/src/components/helpers/WfsHelper.js
index 64a6dd3..3208ca8 100644
--- a/src/components/helpers/WfsHelper.js
+++ b/src/components/helpers/WfsHelper.js
@@ -1,10 +1,11 @@
/**
* 鍔犺浇WMS,鎷兼帴FILTER,LAYERS鍙傛暟绛�
*/
+import MapConfig from '../../conf/MapConfig'
function WfsHelper () {
this.filters = []
this.typeNames = []
- this.url = 'http://xearth.cn:6289/server/ogcserver/PipeLine/wfs'
+ this.url = MapConfig.BLUEMAP_HOST + '/server/ogcserver/PipeLine/wfs'
this.params = {
REQUEST: 'getfeature',
OUTPUTFORMAT: 'JSON',
@@ -16,11 +17,20 @@
this.typeNames.push(typeName)
}
- this.appendEquals = (property, literal) => {
+ this.addEquals = (property, literal) => {
var filter = '<PropertyIsEqualTo><PropertyName>' + property + '</PropertyName><Literal>' + literal + '</Literal></PropertyIsEqualTo>'
this.filters.push(filter)
}
+ this.addLike = (property, literal) => {
+ var filter = '<PropertyIsLike><PropertyName>' + property + '</PropertyName><Literal>' + literal + '</Literal></PropertyIsLike>'
+ this.filters.push(filter)
+ }
+
+ /**
+ * 寰楀埌filter鍙傛暟鍊�
+ * @returns {string|null}
+ */
this.getFilterParams = () => {
var head = '<Filter xmlns="http://www.opengis.net/ogc">'
var end = '</Filter>'
@@ -29,6 +39,10 @@
for (var i = 0; i < this.filters.length; i++) {
filter += this.filters[i]
}
+ // 褰撴潯浠舵暟 > 1鏃讹紝闇�瑕佺敤and鏍囩鍖呰9
+ if (this.filters.length > 1) {
+ return ('FILTER=' + head + '<And>' + filter + '</And>' + end)
+ }
return ('FILTER=' + head + filter + end)
}
return null
diff --git a/src/conf/MapConfig.js b/src/conf/MapConfig.js
index fdaa00f..4512d66 100644
--- a/src/conf/MapConfig.js
+++ b/src/conf/MapConfig.js
@@ -7,8 +7,8 @@
const HOST_URL = curWwwPath.substring(0, pos)
// service涓绘満閰嶇疆
-const APP_GIS_HOST = 'http://xearth.cn:6299'
-// const APP_GIS_HOST_PIPELINE = 'http://xearth.cn:6289'
+// const APP_GIS_HOST = 'http://xearth.cn:6299'
+const APP_GIS_HOST = 'http://xearth.cn:6289'
// 鑷畾涔変富鏈洪厤缃�
const BLUEMAP_HOST = APP_GIS_HOST // 鍏徃鍙戝竷鐨勫湴鍥炬湇鍔★紝鐢ㄤ簬娴嬭瘯鐨勫湴鍧�
--
Gitblit v1.8.0