From e46c7f58112c13ed09b325bf164f0d2a440f1012 Mon Sep 17 00:00:00 2001
From: 徐旺旺 <11530253@qq.com>
Date: 星期四, 13 五月 2021 16:13:17 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop

---
 src/components/LayerController/service/LayerFactory.js |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/components/LayerController/service/LayerFactory.js b/src/components/LayerController/service/LayerFactory.js
index 57bb1cf..7bba481 100644
--- a/src/components/LayerController/service/LayerFactory.js
+++ b/src/components/LayerController/service/LayerFactory.js
@@ -1,6 +1,6 @@
 import WfsLayerService from './WfsLayerService'
 import { clone } from '../../../utils/utils'
-import { logicMapper } from '../../../conf/Constants'
+import { logicMapper, SERVICE_TYPE } from '../../../conf/Constants'
 import WmsLayerService from './WmsLayerService'
 
 /**
@@ -17,6 +17,7 @@
     this.layersLogic = {}
     this.minZoomLayers = {}
     this.wmsLayers = []
+    this.clickSwitch = true // 鍥惧眰鐐瑰嚮寮圭獥寮�鍏�
   }
 
   init (layerConfig) {
@@ -35,7 +36,7 @@
         var childLayer = config.childLayer
         var checked = config.checked
         /* if (config.groupName) {
-          const wmsGroupLayerService = new WmsGroupLayerService(config)
+          const wmsGroupLayerService = new WmsLayerGroupService(config)
           wmsGroupLayerService.init()
           continue
         } */
@@ -64,8 +65,7 @@
 
   loadLogic (config) {
     var code = config.code
-    var wfs = config.wfs
-    var wmsLayers = config.wmsLayers
+    var type = config.type
 
     const file = logicMapper[code]
     var logic = this.layersLogic[code]
@@ -73,9 +73,9 @@
       if (file) {
         var BusiLayer = require('../logic/' + file)
         logic = new BusiLayer()
-      } else if (wfs) {
+      } else if (type === SERVICE_TYPE.WFS) {
         logic = new WfsLayerService(config)
-      } else if (wmsLayers) {
+      } else if (type === SERVICE_TYPE.WMS) {
         var layer = {}
         layer[config.code] = config
         this.wmsLayers.push(layer)
@@ -183,10 +183,20 @@
         break
       case 'MultiLineString':
         var coordinates = feature.geometry.coordinates
-        point = coordinates[parseInt(coordinates.length / 2)][0]
+        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
     }
-    window.map.flyTo(point.reverse(), 15)
+    if (point.length > 2) {
+      point.splice(2, 1)
+    }
+    window.map.setView(point.reverse(), 17)
     code && this.openPopup(code, feature.id)
   }
 

--
Gitblit v1.8.0