// 初始化显示
|
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 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
|
}
|