派生自 wuyushui/SewerAndRainNetwork

zhangshuaibao
2021-03-30 f80248814174b15864d289311e8ddc132d8d3bba
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
79
import BasemapHelper from '@components/helpers/BasemapHelper'
import VectorLayerHelper from '@components/helpers/VectorLayerHelper'
// 初始化显示
import ServiceLayerHelper from '@components/helpers/ServiceLayerHelper'
 
import '@components/plugin/PathDrag'
import MapConfig from '@/conf/MapConfig'
import '@components/plugin/PathDashFlow' // 流动线图
import DownLoad from '@components/plugin/DownLoad'
// 测量
import '@components/plugin/leaflet-measure-path/leaflet-measure-path'
 
import 'leaflet.markercluster'
import './components/plugin/Leaflet.GridLayer.FadeOut' // 瓦片图层切换淡入淡出
import './components/plugin/leaflet-canvas-markers' // 画布marker
import './components/plugin/Editable' // 标绘操作
import './components/plugin/MagicMarker' // 动画Marker
import './assets/css/map/magic.min.css' // 动画Marker css
import '@/components/plugin/magicMarker.css'
import '@components/plugin/pulse/Pulse' // marker 外圈波
import '@components/plugin/pulse/Pulse.css' // marker 外圈波 css
 
let map = null
const L = window.L
const initMap = (div) => {
  if (map != null) {
    map.remove()
  }
  DownLoad.init(L)
 
  map = L.map(div, MapConfig.mapOptions)
 
  map.on('click', (event, a, b) => {
    console.log(event, a, b)
  })
 
  window.map = map
  window.L = L
 
  initTileLayersHelper(map)
 
  return map
}
 
/**
 * 基础底图初始化
 * @param map
 * @param L
 */
const initBasemapsHelper = (map) => {
  // todo 这里进行底图地图的初始化
  return new BasemapHelper({ map })
}
/**
 * 业务底图初始化
 * @param map
 * @param L
 */
const initTileLayersHelper = (map) => {
  var serviceLayerHelper = new ServiceLayerHelper({ map })
  return serviceLayerHelper
}
/**
 * 矢量地图初始化
 * @param map
 * @param L
 */
const initVectorLayersHelper = (map) => {
  // todo 这里进行地图的初始化
  window.vectorLayerHelper = new VectorLayerHelper({ map })
  return window.vectorLayerHelper
}
 
export default {
  initMap,
  initBasemapsHelper,
  initTileLayersHelper,
  initVectorLayersHelper
}