派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-31 f3ab28fd376caec5b142145d9b779d846f9fbc10
src/utils/utils.js
@@ -27,7 +27,8 @@
 * 脉冲效果
 */
export function pulseEffect (xy) {
  let times = 50
  window.mapManager.clearHighlight()
  let times = 1000
  const colors = ['#00f100', '#ff0000']
  // 插件 效果实现
  var pulsingIcon = window.L.icon.pulse({
@@ -35,7 +36,7 @@
    color: colors[0],
    fillColor: ''
  })
  var picGroupMarker = window.L.marker(xy, { icon: pulsingIcon }).addTo(window.map)
  var picGroupMarker = window.L.marker(xy, { icon: pulsingIcon }).addTo(window.mapManager.hightlightLayer)
  // 定时
  var timeInterval = setInterval(() => {
    if (times > 0) {
@@ -48,23 +49,27 @@
}
export function reversePolyLine (feature) {
  const coordinates = feature.geometry.coordinates
  const coordinates = clone(feature.geometry.coordinates)
  var latlng = []
  for (var j = 0; j < coordinates.length; j++) {
    const coordinate = coordinates[j]
    latlng.push(coordinate.reverse())
    let coordinate = coordinates[j]
    coordinate = [coordinate[1], coordinate[0]]
    latlng.push(coordinate)
  }
  return latlng
}
export function reverseMultiLine (feature) {
  const coordinates = feature.geometry.coordinates
  const coordinates = clone(feature.geometry.coordinates)
  var latlng = []
  for (var j = 0; j < coordinates.length; j++) {
    const coordinate = coordinates[j]
    var xy = []
    for (var k = 0; k < coordinate.length; k++) {
      const coor = coordinate[k]
      let coor = coordinate[k]
      if (coor.length > 2) {
        coor = coor.splice(2, 1)
      }
      xy.push(coor.reverse())
    }
    latlng.push(xy)
@@ -141,4 +146,13 @@
  }
}
/**
 * 去掉两头空格
 * @param str
 * @returns {*}
 */
export function lrtrim (str) {
  return str.replace(/^\s+|\s+$/g, '')
}
export default clone