派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-03-02 1264fb6de514634073eb623b0e201df9296baa0b
修改图层控制
3个文件已修改
24 ■■■■ 已修改文件
src/components/LayerController/modules/LcServiceLayer.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/helpers/WfsHelper.js 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/conf/MapConfig.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/modules/LcServiceLayer.vue
@@ -56,7 +56,7 @@
    loadWfs () {
      var wfsHelper = new WfsHelper()
      wfsHelper.addTypeName('管线点')
      wfsHelper.appendEquals('pipename', '研究院01路YS000001')
      wfsHelper.addEquals('pipename', '研究院01路YS000001')
      AjaxUtils.GetDataAsynByUrl(wfsHelper.getUrl(), {}, (res) => {
        console.log(res)
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标签包裹
      if (this.filters.length > 1) {
        return ('FILTER=' + head + '<And>' + filter + '</And>' + end)
      }
      return ('FILTER=' + head + filter + end)
    }
    return null
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 // 公司发布的地图服务,用于测试的地址