| | |
| | | import BasemapHelper from '@components/helpers/BasemapHelper' |
| | | import VectorLayerHelper from '@components/helpers/VectorLayerHelper' |
| | | import ServiceLayerHelper from '@components/helpers/ServiceLayerHelper' |
| | | |
| | | import Editable from '@components/plugin/Editable' |
| | | import PathDrag from '@components/plugin/PathDrag' |
| | | import CanvasIcon from '@components/plugin/CanvasMarkers' |
| | | import MagicMarker from '@components/plugin/MagicMarker' |
| | | import WmtsSupport from '@components/plugin/wmts_plugins' |
| | | |
| | | // 初始化显示 |
| | | // import '@components/plugin/PathDrag' |
| | | import MapConfig from '@/conf/MapConfig' |
| | | import DashFlow from '@components/plugin/PathDashFlow' |
| | | 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) => { |
| | | const initMap = (div, mapOption) => { |
| | | if (map != null) { |
| | | map.remove() |
| | | } |
| | | |
| | | // Leaflet扩展代码 |
| | | Editable.init(L) // 图层编辑 |
| | | PathDrag.init(L) // 路径拖拽 |
| | | MagicMarker.init(L) // 动画Marker |
| | | CanvasIcon.init(L) // 使用canvas绘制Marker |
| | | WmtsSupport.init(L) // 扩展,使支持WMTS |
| | | // CustomPopup.init(L) // 自定义弹出框 |
| | | DashFlow.DashFlow(L) // 流动线图 |
| | | // Leaflet扩展代码 |
| | | |
| | | map = L.map(div, MapConfig.mapOptions) |
| | | DownLoad.init(L) |
| | | const option = mapOption || MapConfig.mapOptions |
| | | map = L.map(div, option) |
| | | |
| | | map.on('click', (event, a, b) => { |
| | | console.log(event, a, b) |
| | | }) |
| | | |
| | | window.map = map |
| | | initTileLayersHelper(map) |
| | | window.L = L |
| | | |
| | | return map |
| | | } |
| | | |
| | |
| | | */ |
| | | const initBasemapsHelper = (map) => { |
| | | // todo 这里进行底图地图的初始化 |
| | | console.log(map) |
| | | return new BasemapHelper({ map }) |
| | | } |
| | | /** |
| | | * 业务底图初始化 |
| | | * @param map |
| | | * @param L |
| | | */ |
| | | const initTileLayersHelper = (map) => { |
| | | var serviceLayerHelper = new ServiceLayerHelper({ map }) |
| | | return serviceLayerHelper |
| | | } |
| | | |
| | | /** |
| | |
| | | export default { |
| | | initMap, |
| | | initBasemapsHelper, |
| | | initTileLayersHelper, |
| | | initVectorLayersHelper |
| | | } |