派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-30 0110b78419d98e114c59fa9fb6f69663fbdc3c98
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
// 初始化显示
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
import '@components/plugin/L.CircleEditor'
import BasemapHelper from './components/helpers/BasemapHelper'
import VectorLayerHelper from './components/helpers/VectorLayerHelper'
 
import '@/components/plugin/leaflet-echart'
// import '@/components/plugin/flowline'
// import eventBus from './eventBus'
 
let map = null
const L = window.L
const initMap = (div, mapOption) => {
  if (map != null) {
    map.remove()
  }
  DownLoad.init(L)
  const option = mapOption || MapConfig.mapOptions
  map = L.map(div, option)
 
  // eventBus.$emit('map-obj', map)
 
  window.map = map
  window.L = L
 
  return map
}
/**
 * 基础底图初始化
 * @param map
 * @param L
 */
const initBasemapsHelper = (map) => {
  // todo 这里进行底图地图的初始化
  console.log(map)
  return new BasemapHelper({ map })
}
 
/**
 * 矢量地图初始化
 * @param map
 * @param L
 */
const initVectorLayersHelper = (map) => {
  // todo 这里进行地图的初始化
  window.vectorLayerHelper = new VectorLayerHelper({ map })
  return window.vectorLayerHelper
}
 
export default {
  initMap,
  initBasemapsHelper,
  initVectorLayersHelper
}