派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-18 49003d0eeae335ba72a89e9c1156237cdd02ebd8
src/components/helpers/LocateHelper.js
@@ -51,36 +51,42 @@
}
export const highlight = function (feature, icon) {
  const L = window.L
  const type = feature.geometry.type
  window.mapManager.clearHighlight()
  const highlightLayer = window.mapManager.hightlightLayer
  if (type === 'MultiLineString') {
    L.geoJSON(feature, {
      style: function () {
        return {
          fillColor: 'red',
          color: 'red'
        }
      }
    }).addTo(highlightLayer)
  } else if (type === 'Point') {
    // 叠加一个大尺寸的图标
    let point = feature.geometry.coordinates
    point = [point[1], point[0]]
    if (icon) {
      L.marker(point, {
        icon: L.icon({
          iconUrl: '/assets/images/map/' + icon,
          iconSize: [30, 30],
          iconAnchor: [15, 15]
        })
      }).addTo(highlightLayer)
  if (Array.isArray(feature)) {
    for (let i = 0; i < feature.length; i++) {
      highlight(feature[i], icon)
    }
    pulseEffect(point)
  } else if (type === 'LineString') {
    L.polyline(reversePolyLine(feature), { color: 'red' }).addTo(highlightLayer)
  } else {
    const L = window.L
    const type = feature.geometry.type
    window.mapManager.clearHighlight()
    const highlightLayer = window.mapManager.hightlightLayer
    if (type === 'MultiLineString') {
      L.geoJSON(feature, {
        style: function () {
          return {
            fillColor: 'red',
            color: 'red'
          }
        }
      }).addTo(highlightLayer)
    } else if (type === 'Point') {
    // 叠加一个大尺寸的图标
      let point = feature.geometry.coordinates
      point = [point[1], point[0]]
      if (icon) {
        L.marker(point, {
          icon: L.icon({
            iconUrl: '/assets/images/map/' + icon,
            iconSize: [30, 30],
            iconAnchor: [15, 15]
          })
        }).addTo(highlightLayer)
      }
      pulseEffect(point)
    } else if (type === 'LineString') {
      L.polyline(reversePolyLine(feature), { color: 'red' }).addTo(highlightLayer)
    }
  }
}