From cf5ab6da9ff676fab8a10d4299bd5a04a07bf50f Mon Sep 17 00:00:00 2001
From: 徐旺旺 <11530253@qq.com>
Date: 星期一, 17 五月 2021 10:05:53 +0800
Subject: [PATCH] 修复默认选中图层时出现的BUG
---
src/components/LayerController/service/LayerFactory.js | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/src/components/LayerController/service/LayerFactory.js b/src/components/LayerController/service/LayerFactory.js
index 51fe254..d88b9a6 100644
--- a/src/components/LayerController/service/LayerFactory.js
+++ b/src/components/LayerController/service/LayerFactory.js
@@ -1,8 +1,7 @@
import WfsLayerService from './WfsLayerService'
-import { clone } from '../../../utils/utils'
+import { clone, pulseEffect } from '../../../utils/utils'
import { logicMapper, SERVICE_TYPE } from '../../../conf/Constants'
import WmsLayerService from './WmsLayerService'
-import AnimalService from './AnimalService'
/**
* init 鍙垵濮嬪寲涓�娆�
@@ -18,16 +17,17 @@
this.layersLogic = {}
this.minZoomLayers = {}
this.wmsLayers = []
+ this.wmsLayerService = null
+ // todo 寰呬紭鍖栵紝wmslayerservice璋冪敤锛屾斁杩欓噷涓嶅悎閫�
this.clickSwitch = true // 鍥惧眰鐐瑰嚮寮圭獥寮�鍏�
- this.animalService = new AnimalService({ L: this.L })
this.hightlightLayer = options.L.featureGroup({}).addTo(window.map)
}
init (layerConfig) {
- this.initConfig(layerConfig)
// wms鏈嶅姟鍙渶瑕佸垵濮嬪寲涓�娆�
- this.wmsLayerService = new WmsLayerService(this.wmsLayers)
+ this.wmsLayerService = new WmsLayerService()
this.wmsLayerService.init()
+ this.initConfig(layerConfig)
}
initConfig (layerConfig) {
@@ -43,8 +43,8 @@
wmsGroupLayerService.init()
continue
} */
- layers && this.init(config.layers)
- childLayer && this.init(config.childLayer)
+ layers && this.initConfig(config.layers)
+ childLayer && this.initConfig(config.childLayer)
this.initMinZoom(config)
this.loadLogic(config)
@@ -78,10 +78,6 @@
logic = new BusiLayer()
} else if (type === SERVICE_TYPE.WFS) {
logic = new WfsLayerService(config)
- } else if (type === SERVICE_TYPE.WMS) {
- var layer = {}
- layer[config.code] = config
- this.wmsLayers.push(layer)
}
}
this.layersLogic[code] = logic
@@ -225,7 +221,7 @@
if (point.length > 2) {
point = [point[0], point[1]]
}
- this.animalService.pulseEffect(point.reverse())
+ pulseEffect(point.reverse())
/* var myIcon = this.L.divIcon({ className: 'my-div-icon' })
this.L.marker(feature.geometry.coordinates.reverse(), {
icon: myIcon
--
Gitblit v1.8.0