From d7c50f6207f0f27f4c20aa96f75b7c0b610b2b23 Mon Sep 17 00:00:00 2001
From: 陈泽平 <chenzeping>
Date: 星期四, 20 五月 2021 11:06:54 +0800
Subject: [PATCH] 管线弹框分析修改
---
src/components/LayerController/service/LayerFactory.js | 98 ++----------------------------------------------
1 files changed, 5 insertions(+), 93 deletions(-)
diff --git a/src/components/LayerController/service/LayerFactory.js b/src/components/LayerController/service/LayerFactory.js
index 7bba481..68d8d64 100644
--- a/src/components/LayerController/service/LayerFactory.js
+++ b/src/components/LayerController/service/LayerFactory.js
@@ -1,5 +1,4 @@
import WfsLayerService from './WfsLayerService'
-import { clone } from '../../../utils/utils'
import { logicMapper, SERVICE_TYPE } from '../../../conf/Constants'
import WmsLayerService from './WmsLayerService'
@@ -17,14 +16,14 @@
this.layersLogic = {}
this.minZoomLayers = {}
this.wmsLayers = []
- this.clickSwitch = true // 鍥惧眰鐐瑰嚮寮圭獥寮�鍏�
+ this.wmsLayerService = null
}
init (layerConfig) {
- this.initConfig(layerConfig)
// wms鏈嶅姟鍙渶瑕佸垵濮嬪寲涓�娆�
- this.wmsLayerService = new WmsLayerService(this.wmsLayers)
+ this.wmsLayerService = new WmsLayerService()
this.wmsLayerService.init()
+ this.initConfig(layerConfig)
}
initConfig (layerConfig) {
@@ -40,8 +39,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)
@@ -75,10 +74,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
@@ -165,89 +160,6 @@
this.hide(config)
}
}
- }
- }
-
- /**
- *
- * 鏍规嵁浼犵殑 feature瀵硅薄瀹氫綅锛�
- * @param code
- * @param feature
- */
- flyByFeature (feature, code) {
- const type = feature.geometry.type
- var point = []
- switch (type) {
- case 'Point':
- point = clone(feature.geometry.coordinates)
- break
- case 'MultiLineString':
- var coordinates = feature.geometry.coordinates
- var coordinate = coordinates[parseInt(coordinates.length / 2)][0]
- if (coordinate.length > 2) {
- point = [coordinate[0], coordinate[1]]
- }
- break
- case 'LineString':
- var lineString = feature.geometry.coordinates
- point = lineString[parseInt(lineString.length / 2)][0]
- break
- }
- if (point.length > 2) {
- point.splice(2, 1)
- }
- window.map.setView(point.reverse(), 17)
- code && this.openPopup(code, feature.id)
- }
-
- openPopup (layerId, id) {
- const layer = this.layers[layerId]
-
- if (layer.eachLayer) {
- layer.eachLayer(function (layer) {
- const layers = layer.getLayers()
- for (var i = 0; i < layers.length; i++) {
- const lay = layers[i]
- const feature = lay.feature
- lay.closePopup()
- if (feature.id === id) {
- lay.openPopup()
- break
- }
- }
- })
- }
- /* for (var k in this.layers) {
- var layerGroup = this.layers[k]
- layerGroup.eachLayer(function (layer) {
- console.log(layer)
- console.log(layer.getAttribution())
- })
- var layers = layerGroup.getLayers()
- if (layers) {
- for (var m = 0; m < layers.length; m++) {
- var layer = layers[m]
- console.log(layer)
- console.log(layer.getLayerId(val.id))
- /!* var feature = layer.feature
- if (feature.id === layerId) {
- this.map.flyToBounds(bound)
- return layer
- } *!/
- }
- }
- } */
- return null
- }
-
- findLayerById (layer, id) {
- const layers = layer.getLayers
- if (layers) {
- this.findLayerById(layer.getLayers(), id)
- } else {
- layer.eachLayer(function (layer) {
- // console.log(layer)
- })
}
}
}
--
Gitblit v1.8.0