From 02d584c8d0f31b56f24e367681aa034cd2acf0e9 Mon Sep 17 00:00:00 2001
From: wangrui <zephyrs0894@163.com>
Date: 星期六, 19 十二月 2020 02:20:38 +0800
Subject: [PATCH] 重构地图加载的逻辑

---
 src/views/MapTemplate.vue |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/views/MapTemplate.vue b/src/views/MapTemplate.vue
index a441c66..6ee012d 100644
--- a/src/views/MapTemplate.vue
+++ b/src/views/MapTemplate.vue
@@ -9,6 +9,7 @@
 <script>
 import 'leaflet/dist/leaflet.css'
 import Sgis from '@src/Sgis'
+import mapConfig from '@/conf/MapConfig'
 import SgisLayerController from '@components/LayerController/LayerController'
 import MonitorPanel from '@components/panel/MonitorPanel'
 import { mapMutations, mapState } from 'vuex'
@@ -32,9 +33,17 @@
       init() {
         const mapcontainer = this.$refs.rootmap
         this.mapObj = Sgis.initMap(mapcontainer)
-        this.basemapHelper = Sgis.initBasemaps(this.mapObj.map, this.mapObj.L) // 鍒濆鍖栧簳鍥�
-        this.serviceLayerHelper = Sgis.initTileLayers(this.mapObj.map, this.mapObj.L) // 鍒濆鍖栧簳鍥�
-        this.vectorLayerHelper = Sgis.initVectorLayers(this.mapObj.map, this.mapObj.L, {}) // 鍒濆鍖栦笟鍔″浘灞�
+
+        this.basemapHelper = Sgis.initBasemapsHelper(this.mapObj.map, this.mapObj.L) // 鍒濆鍖栧熀纭�搴曞浘鍔╂墜
+        this.basemapHelper.initBasemap(mapConfig, false) // 绗簩涓弬鏁帮紝琛ㄧず鏄惁鍐呯綉搴曞浘
+
+
+        this.serviceLayerHelper = Sgis.initTileLayersHelper(this.mapObj.map, this.mapObj.L) // 鍒濆鍖栦笟鍔″簳鍥惧姪鎵�
+        this.serviceLayerHelper.initServiceLayers()
+
+        this.vectorLayerHelper = Sgis.initVectorLayersHelper(this.mapObj.map, this.mapObj.L) // 鍒濆鍖栧姩鎬佽绱犲浘灞傚姪鎵�
+        this.vectorLayerHelper.initVectorLayers()
+
         this.setLayerHelper(this.vectorLayerHelper)
         return this.map
       }

--
Gitblit v1.8.0