派生自 wuyushui/SewerAndRainNetwork

ChenZeping
2021-05-08 4879421ff17a679a838de208125617d2eaa351a2
Merge remote-tracking branch 'origin/develop' into develop
2个文件已修改
20 ■■■■■ 已修改文件
src/components/LayerController/service/LayerFactory.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/service/WmsLayerService.js 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/service/LayerFactory.js
@@ -17,6 +17,7 @@
    this.layersLogic = {}
    this.minZoomLayers = {}
    this.wmsLayers = []
    this.clickSwitch = true // 图层点击弹窗开关
  }
  init (layerConfig) {
src/components/LayerController/service/WmsLayerService.js
@@ -76,6 +76,9 @@
  clickListener () {
    window.map.on('click', (e) => {
      if (!window.layerFactory.clickSwitch) {
        return
      }
      this.featureGroup.clearLayers()
      var point = this.map.latLngToContainerPoint(e.latlng, this.map.getZoom())
      var size = this.map.getSize()
@@ -148,7 +151,7 @@
    })
  }
  reverse (feature) {
  reverseMultiLine (feature) {
    const coordinates = feature.geometry.coordinates
    var latlng = []
    for (var j = 0; j < coordinates.length; j++) {
@@ -163,15 +166,27 @@
    return latlng
  }
  reversePolyLine (feature) {
    const coordinates = feature.geometry.coordinates
    var latlng = []
    for (var j = 0; j < coordinates.length; j++) {
      const coordinate = coordinates[j]
      latlng.push(coordinate.reverse())
    }
    return latlng
  }
  highlight (feature) {
    const type = feature.geometry.type
    if (type === 'MultiLineString') {
      this.L.polyline(this.reverse(feature), { color: 'red' }).addTo(this.featureGroup)
      this.L.polyline(this.reverseMultiLine(feature), { color: 'red' }).addTo(this.featureGroup)
    } else if (type === 'Point') {
      var myIcon = this.L.divIcon({ className: 'my-div-icon' })
      this.L.marker(feature.geometry.coordinates.reverse(), {
        icon: myIcon
      }).addTo(this.featureGroup)
    } else if (type === 'LineString') {
      this.L.polyline(this.reversePolyLine(feature), { color: 'red' }).addTo(this.featureGroup)
    }
  }
}