派生自 wuyushui/SewerAndRainNetwork

chenzeping
2021-03-08 3cc9f0efa740810f88738788b062f348d8d9b48a
src/components/helpers/ServiceLayerHelper.js
@@ -25,7 +25,18 @@
  }
  getByLayerId (layerId) {
    for (var k in this.layerArray) {
      var layer = this.layerArray[k]
      var geojson = layer.toGeoJSON()
      var features = geojson.features
      for (var j = 0; j < features.length; j++) {
        var feature = features[j]
        if (feature.id === layerId) {
          return layer
        }
      }
    }
    return null
  }
  initDisplayZoom (layerConfig) {
@@ -129,7 +140,6 @@
  loadGeojson (res, opt) {
    var that = this
    var icon = opt.icon
    const featureGroup = that.L.featureGroup().addTo(that.map)
    const geojson = that.L.geoJSON(res.features, {
      style: function (feature) {
        return {
@@ -205,14 +215,14 @@
            }
          })
        }
      }).addTo(featureGroup)
      }).addTo(that.map)
    store.commit('addSewersDatas', geojson)
    if (Object.prototype.hasOwnProperty.call(res, 'features') && res.features.length > 0 && (res.features[0].geometry.type === 'LineString' || res.features[0].geometry.type === 'MultiLineString')) {
      geojson.bringToBack()
    } else {
      geojson.bringToFront()
    }
    return featureGroup
    return geojson
  }
  removeLayer (item) {