派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-04-18 e25ff993695e7a4b394a5d1aa102f113dbe5316b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
/**
 *  管线动画控制逻辑
 */
const LayerPipeLines = require('../../../conf/layers/LayerPipeLines').LayerPipeLines
const STYLES = require('../../../conf/Constants').STYLES
 
module.exports = function () {
  this.init = () => {
    const layers = LayerPipeLines.layers
    for (var i = 0; i < layers.length; i++) {
      const config = layers[i]
      const code = config.code
      // window.layerFactory.show(config)
      const layer = window.layerFactory.layers[code]
      if (layer) {
        if (layer.eachLayer) {
          layer.eachLayer(function (layer) {
            layer.setStyle({
              fill: STYLES.FILL,
              weight: STYLES.WEIGHT,
              fillColor: STYLES.FILL_COLOR,
              color: STYLES.COLOR,
              fillOpacity: STYLES.FILL_OPACITY,
              opacity: STYLES.OPACITY,
              dashArray: STYLES.DASH_ARRAY,
              dashSpeed: STYLES.DASH_SPPED
            })
          })
          // 重新添加到地图上,动画才有效果
          window.map.removeLayer(layer)
          window.layerFactory.show(config)
        }
      }
    }
    /* window.$layer.iframe({
      content: {
        content: publicBounced,
        parent: this,
        data: {
          info: this.info,
          fn: () => {
            alert(1)
          }
        }
      },
      area: ['901px', '101px'],
      title: '这是一个标题这是一个标题这是一个标题这是一个标题',
      maxmin: true,
      shade: false,
      shadeClose: false,
      scrollbar: false,
      resize: true,
      btn: ['a', 'b'],
      cancel: () => {
        alert(2110)
      }
    }) */
  }
 
  this.destory = () => {
    console.log('destory!!!')
    const layers = LayerPipeLines.layers
    for (var i = 0; i < layers.length; i++) {
      const config = layers[i]
      const code = config.code
      // window.layerFactory.show(config)
      const layer = window.layerFactory.layers[code]
      if (layer) {
        if (layer.eachLayer) {
          layer.eachLayer(function (layer) {
            layer.resetStyle()
          })
        }
      }
    }
  }
}