派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-04-20 704714d2bbb1cf97cb16d452332c4334bc78a24c
加排口, 比例尺显示隐藏有BUG,暂时注释
4个文件已修改
57 ■■■■ 已修改文件
public/assets/images/map/sewers/雨水排口.png 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/service/LayerFactory.js 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/conf/LayerTopic.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/conf/layers/LayerPk.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/assets/images/map/sewers/ÓêË®ÅÅ¿Ú.png

src/components/LayerController/service/LayerFactory.js
@@ -8,6 +8,7 @@
    this.map = window.map
    this.layers = {}
    this.layersLogic = {}
    this.minZoomLayers = {}
  }
  init (layerConfig) {
@@ -21,10 +22,17 @@
        layers && this.init(config.layers)
        childLayer && this.init(config.childLayer)
        this.initMinZoom(config)
        this.loadLogic(config)
        this.toggleZoomByConfig(config)
        checked && this.show(config)
      }
    }
  }
  initMinZoom (config) {
    const minZoom = parseInt(config.minZoom)
    if (minZoom) {
      this.minZoomLayers[minZoom] = config
    }
  }
@@ -93,32 +101,19 @@
     * @param layerConfig
     */
  initEvent (layerConfig) {
    this.map.on('zoomend ', (e) => this.toggleZoomByLayer(layerConfig))
    // this.map.on('zoomend ', () => this.toggleByZoom())
  }
  toggleZoomByLayer (layerConfig) {
    var config = layerConfig
    if (Array.isArray(layerConfig)) {
      for (var i = 0, l = layerConfig.length; i < l; i++) {
        config = layerConfig[i]
        var layers = config.layers
        var childLayer = config.childLayer
        layers && this.toggleZoomByLayer(layers)
        childLayer && this.toggleZoomByLayer(childLayer)
        this.toggleZoomByConfig(config)
      }
    } else {
      this.toggleZoomByConfig(layerConfig)
    }
  }
  toggleZoomByConfig (config) {
  toggleByZoom () {
    const zoom = this.map.getZoom()
    var checked = config.checked
    if (checked && config.minZoom) {
      if (zoom > config.minZoom) {
    for (var k in this.minZoomLayers) {
      const config = this.minZoomLayers[k]
      const checked = config.checked
      console.log(zoom)
      console.log(k)
      if (checked && zoom > k) {
        this.show(config)
      } else {
      } else if (checked && zoom < k) {
        this.hide(config)
      }
    }
src/conf/LayerTopic.js
@@ -11,11 +11,12 @@
import { LayerPipeLines } from './layers/LayerPipeLines'
import { LayerArea } from './layers/LayerArea'
import { LayerVideo } from './layers/LayerVideo'
import { LayerPk } from './layers/LayerPk'
export const LayerTopic = {
  code: 'sewersTopic',
  name: '专题图层',
  checked: false,
  isShow: true,
  layers: [LayerPollutionSources, LayerWasteWater, LayerWasteGas, LayerWasteSolid, LayerAirQuality, LayerEnvRisk, LayerSoilGroundWater, LayerPipeLines, LayerVideo, LayerArea]
  layers: [LayerPollutionSources, LayerWasteWater, LayerWasteGas, LayerWasteSolid, LayerAirQuality, LayerEnvRisk, LayerSoilGroundWater, LayerPipeLines, LayerPk, LayerVideo, LayerArea]
}
src/conf/layers/LayerPk.js
@@ -1,11 +1,10 @@
/**
 * æŽ’口
 */
import { PIPELINE_WFS } from '../Constants'
const WFS_URL = PIPELINE_WFS
export const LayerPk = {
  code: 'sewersPk',
  name: '排口',
  code: 'sewersDischargeport',
  name: '排放口',
  icon: 'sewers/雨水排口.png',
  checked: true,
  layers: [
    {
@@ -13,15 +12,17 @@
      name: '内排口',
      sname: '内排口',
      checked: true,
      wfs: WFS_URL + '?TYPENAME=内排口',
      icon: 'sewers/雨水排口.png',
      wfs: 'http://xearth.cn:6240/geoserver/sewer/wfs?service=WFS&version=1.0.0&request=GetFeature&typeName=sewer:dischargeport&maxFeatures=50&outputFormat=application/json&cql_filter=pfktype=\'内排\'',
      minZoom: 10 // åœ¨æŒ‡å®šçº§åˆ«æ˜¾ç¤º
    },
    {
      code: 'sewersWpk',
      name: '外排口',
      sname: '外排口',
      icon: 'sewers/雨水排口.png',
      checked: true, // é»˜è®¤é€‰ä¸­çŠ¶æ€
      wfs: WFS_URL + '?TYPENAME=外排口',
      wfs: 'http://xearth.cn:6240/geoserver/sewer/wfs?service=WFS&version=1.0.0&request=GetFeature&typeName=sewer:dischargeport&maxFeatures=50&outputFormat=application/json&cql_filter=pfktype=\'外排\'',
      minZoom: 10
    }
  ]