From 7cc388b27687343c0aa237cfdabf638d83dc2a5d Mon Sep 17 00:00:00 2001
From: wangrui <zephyrs0894@163.com>
Date: 星期六, 19 十二月 2020 01:01:51 +0800
Subject: [PATCH] Merge branch 'master' of http://www.xearth.cn:6600/r/wuyushui/SewerAndRainNetwork

---
 src/components/helpers/BasemapHelper.js |   48 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/src/components/helpers/BasemapHelper.js b/src/components/helpers/BasemapHelper.js
index d608cf8..ddd6c32 100644
--- a/src/components/helpers/BasemapHelper.js
+++ b/src/components/helpers/BasemapHelper.js
@@ -1,28 +1,37 @@
+import AjaxUtils from '@/utils/AjaxUtils'
+import CommonLayerLoad from '../mapmodules/CommonLayerLoad'
 /**
  * 搴曞浘绠$悊鍔╂墜锛岃礋璐e簳鍥惧垱寤哄強寮�鍏�
  */
-function BasemapHelper(map, L) {
-    this.map = map
-    this.L = L
-    this.basemapList = []
+class BasemapHelper{
+    constructor(map, L) {
+        this.map = map
+        this.L = L
+        this.basemapList = []
+        this.basemapMap = new Map()
+        this.basemapLayerGroup = L.layerGroup().addTo(map)
+    }
 
     /**
      * 璇ユ柟娉曡礋璐e悇绉嶅簳鍥惧姞杞藉埌鍦板浘涓�
      * @param map
      * @param defBasemapName 鍒濆鍖栧畬鎴愬悗锛岄粯璁ゆ樉绀虹殑鍥惧眰
      */
-    this.initBasemap = (map, defBasemapName) => {
-        console.log(map, defBasemapName)
-        // todo 鍒涘缓瀹屼互鍚庯紝鎶婂浘灞傞兘鏀惧埌basemapList瀵硅薄淇濆瓨璧锋潵锛屾柟渚垮叾浠栨帴鍙h皟鐢�
+    initBasemap = (mapConfig, isIntranet) => {
+        if(isIntranet) {
+            this._getToken(mapConfig);
+        }else {
+            //
+        }
 
-        return null
+        return this.basemapMap
     }
 
     /**
      * 鑾峰彇鎵�鏈夌殑搴曞浘鍒楄〃
      * @returns {null} 缁撴瀯锛歔{鍚嶇О, 鍥惧眰寮曠敤}]
      */
-    this.getBasemapList = (map) => {
+    getBasemapList = (map) => {
         console.log(map)
         return null
     }
@@ -32,7 +41,7 @@
      * @param map 缁撴瀯锛歔{鍚嶇О, 鍥惧眰寮曠敤}]
      * @param name 鍚嶇О
      */
-    this.getBasemap = (map, name) => {
+    getBasemap = (map, name) => {
         console.log(map, name)
     }
 
@@ -42,7 +51,7 @@
      * @param layer 寰呮樉绀哄浘灞傚紩鐢�
      * @param isHideOthers 鏄惁鍏堝叧闂叾浠栧浘灞傦紝榛樿鏄痶rue
      */
-    this.showBasemap = (map, layer, isHideOthers) => {
+    showBasemap = (map, layer, isHideOthers) => {
         console.log(map, layer, isHideOthers)
     }
 
@@ -51,9 +60,24 @@
      * @param map 鍦板浘瀵硅薄
      * @param layer 寰呭叧闂浘灞傚紩鐢�
      */
-    this.hideBasemap = (map, layer) => {
+    hideBasemap = (map, layer) => {
         console.log(map, layer)
     }
+
+    _getToken = (mapConfig) => {
+        let params = mapConfig.TokenConfig
+        AjaxUtils.GetDataAsynByUrl(params.url, params.option, (token) => {
+            this._showTDT(token)
+        })
+    }
+
+    _showTDT = (token) => {
+        let commonLayerLoad = new CommonLayerLoad()
+        const imgMapm = commonLayerLoad.loadIntranetImgMap(token)
+        const imgMapa = commonLayerLoad.loadIntranetImgMapCia(token)
+        this.basemapLayerGroup.addLayer(imgMapm)
+        this.basemapLayerGroup.addLayer(imgMapa)
+    }
 }
 
 export default BasemapHelper

--
Gitblit v1.8.0