From be771111fb2a9770a9fbf13c5d7e976bf8688b6d Mon Sep 17 00:00:00 2001 From: 陈泽平 <chenzeping> Date: 星期二, 18 五月 2021 11:08:38 +0800 Subject: [PATCH] 问题修改 --- src/Sgis.js | 59 ++++++++++++++++++----------------------------------------- 1 files changed, 18 insertions(+), 41 deletions(-) diff --git a/src/Sgis.js b/src/Sgis.js index 19c9dfb..64977a5 100644 --- a/src/Sgis.js +++ b/src/Sgis.js @@ -1,52 +1,38 @@ -import BasemapHelper from '@components/helpers/BasemapHelper' -import VectorLayerHelper from '@components/helpers/VectorLayerHelper' -import ServiceLayerHelper from '@components/helpers/ServiceLayerHelper' -import PathDrag from '@components/plugin/PathDrag' -// import MagicMarker from '@components/plugin/MagicMarker' -// import WmtsSupport from '@components/plugin/wmts_plugins' -import MapConfig from '@/conf/MapConfig' +// 鍒濆鍖栨樉绀� +import MapConfig from './conf/MapConfig' import '@components/plugin/PathDashFlow' // 娴佸姩绾垮浘 -// import CanvasMarkers from '@components/plugin/CanvasMarkers' -// import FullScreen from '@components/plugin/FullScreen' -import DownLoad from '@components/plugin/DownLoad' +import DownLoad from './components/plugin/DownLoad' // 娴嬮噺 -import LeafletMeasurePath from '@components/plugin/leaflet-measure-path/leaflet-measure-path' +import '@components/plugin/leaflet-measure-path/leaflet-measure-path' import 'leaflet.markercluster' -// import 'leaflet-canvas-markers' 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 eventBus from './eventBus' let map = null const L = window.L -const initMap = (div) => { +const initMap = (div, mapOption) => { if (map != null) { map.remove() } - - // Leaflet鎵╁睍浠g爜 - // Editable.init(L) // 鍥惧眰缂栬緫 - PathDrag.init(L) // 璺緞鎷栨嫿 - // MagicMarker.init(L) // 鍔ㄧ敾Marker - // WmtsSupport.init(L) // 鎵╁睍锛屼娇鏀寔WMTS - // CustomPopup.init(L) // 鑷畾涔夊脊鍑烘 - // CanvasMarkers.init(L)// 鐢诲竷鍥惧眰 - // 鍏ㄥ睆 - // FullScreen.init(L) - // 涓嬭浇 DownLoad.init(L) - LeafletMeasurePath.init(L) + const option = mapOption || MapConfig.mapOptions + map = L.map(div, option) - map = L.map(div, MapConfig.mapOptions) - - map.on('click', (event, a, b) => { - console.log(event, a, b) - }) + // eventBus.$emit('map-obj', map) window.map = map window.L = L - initTileLayersHelper(map) + return map } @@ -57,16 +43,8 @@ */ 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 } /** @@ -83,6 +61,5 @@ export default { initMap, initBasemapsHelper, - initTileLayersHelper, initVectorLayersHelper } -- Gitblit v1.8.0