From 94ae577b548d2f4c51f82f57feadde0048a69f9a Mon Sep 17 00:00:00 2001
From: seatonwan9 <seatonwan9@163.com>
Date: 星期一, 31 五月 2021 13:35:02 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop
---
src/Sgis.js | 136 +++++++++++++++------------------------------
1 files changed, 46 insertions(+), 90 deletions(-)
diff --git a/src/Sgis.js b/src/Sgis.js
index 378fcba..16feefe 100644
--- a/src/Sgis.js
+++ b/src/Sgis.js
@@ -1,112 +1,68 @@
-import * as L from 'leaflet'
-import BasemapHelper from '@components/helpers/BasemapHelper'
-import VectorLayerHelper from '@components/helpers/VectorLayerHelper'
+// 鍒濆鍖栨樉绀�
+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 Editable from '@components/plugin/Editable'
-// import PathDrag from '@components/plugin/PathDrag'
-// import CanvasIcon from '@components/plugin/CanvasMarkers'
-// import MagicMarker from '@components/plugin/MagicMarker'
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 MapConfig from '@/conf/MapConfig'
-import CommonLayerLoad from '@components/mapmodules/CommonLayerLoad'
-// import DashFlow from '@components/plugin/PathDashFlow'
-// import AjaxUtils from '@/utils/AjaxUtils'
+import '@/components/plugin/leaflet-echart'
+// import '@/components/plugin/flowline'
+// import eventBus from './eventBus'
+
let map = null
-// let baseMapGroup = null
-let commonLayerLoad = null
-const initMap = (div) => {
- if (map != null) {
- map.remove()
- // baseMapGroup = null
- commonLayerLoad = 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)
- // Leaflet鎵╁睍浠g爜
- // Editable.init(L) // 鍥惧眰缂栬緫
- // PathDrag.init(L) // 璺緞鎷栨嫿
- // MagicMarker.init(L) // 鍔ㄧ敾Marker
- // CanvasIcon.init(L) // 浣跨敤canvas缁樺埗Marker
+ // eventBus.$emit('map-obj', map)
- // CustomPopup.init(L) // 鑷畾涔夊脊鍑烘
- // DashFlow.DashFlow(L) // 娴佸姩绾垮浘
- // Leaflet鎵╁睍浠g爜
+ window.map = map
+ window.L = L
- map = L.map(div, MapConfig.mapOptions)
-
-
- // getToken()
- // L.control.scale({ maxWidth: 200, metric: true, imperial: false }).addTo(map)
- // L.control.layers(SgisConfig.baseLayers, SgisConfig.overlayLayers, { position: 'bottomright' }).addTo(map)
-
- window.map = map
- window.L = L
-
- // showLngLat()
- return { map: map, L: L }
+ return map
}
-
-// let getToken = () => {
-// let params = MapConfig.TokenConfig
-// AjaxUtils.GetDataAsynByUrl(params.url, params.option, function(token) {
-// showTdt(token)
-// })
-// }
-// let showTdt = (token) => {
-// const imgMapm = commonLayerLoad.loadIntranetImgMap(token)
-// const imgMapa = commonLayerLoad.loadIntranetImgMapCia(token)
-// baseMapGroup.addLayer(imgMapm)
-// baseMapGroup.addLayer(imgMapa)
-// }
-
/**
- * 鐡︾墖搴曞浘鍒濆鍖�
+ * 鍩虹搴曞浘鍒濆鍖�
* @param map
+ * @param L
*/
-const initBasemaps = (map, L) => {
- // todo 杩欓噷杩涜搴曞浘鍦板浘鐨勫垵濮嬪寲
- var basemapHelper = new BasemapHelper(map, L)
- return basemapHelper
-}
-
-const initTileLayers = (map, L) => {
- // DashFlow.DashFlow(L, map)
- commonLayerLoad = new CommonLayerLoad()
- // const blueMap = commonLayerLoad.loadBlueMap()
- // baseMapGroup = L.layerGroup([blueMap]).addTo(map)
-
- const imgMapm = commonLayerLoad.loadImgMapm()
- const imgMapa = commonLayerLoad.loadImgMapa()
-
- L.layerGroup([imgMapm, imgMapa]).addTo(map)
+const initBasemapsHelper = (map) => {
+ // todo 杩欓噷杩涜搴曞浘鍦板浘鐨勫垵濮嬪寲
+ console.log(map)
+ return new BasemapHelper({ map })
}
/**
* 鐭㈤噺鍦板浘鍒濆鍖�
* @param map
- */
-/**
- *
- * @param map
* @param L
- * @param obj { name: 'trackPlayer', ref: this.$refs.trackPlayer } 缁勪欢鐨勫悕绉� 鍜� 缁勪欢鐨勫紩鐢�
- * @param loadMethodNames
*/
-const initVectorLayers = (map, L, obj, env) => {
- // todo 杩欓噷杩涜鍦板浘鐨勫垵濮嬪寲
- var vectorLayerHelper = new VectorLayerHelper(map, L, env)
- if (obj != null) {
- vectorLayerHelper.setVueRef(obj.name, obj.ref)
- }
- // let loadMethodNames = ['dock', 'petro', 'fillingStation', 'storeHouse', 'productOil', 'transDisplay', 'ship', 'train', 'warningCar', 'trackQuery', 'weather']
- vectorLayerHelper.initVectorLayers()
- window.vectorLayerHelper = vectorLayerHelper
- return vectorLayerHelper
+const initVectorLayersHelper = (map) => {
+ // todo 杩欓噷杩涜鍦板浘鐨勫垵濮嬪寲
+ window.vectorLayerHelper = new VectorLayerHelper({ map })
+ return window.vectorLayerHelper
}
export default {
- initMap,
- initBasemaps,
- initTileLayers,
- initVectorLayers
+ initMap,
+ initBasemapsHelper,
+ initVectorLayersHelper
}
--
Gitblit v1.8.0