From 204b8af237555feb1af83250dfdc28a5dc0a467c Mon Sep 17 00:00:00 2001 From: chenyabin <Chenab123!> Date: 星期一, 10 五月 2021 17:22:07 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/develop' into develop --- src/components/LayerController/service/LayerFactory.js | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/LayerController/service/LayerFactory.js b/src/components/LayerController/service/LayerFactory.js index f9810db..f781247 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' /** @@ -65,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] @@ -74,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) @@ -184,9 +183,17 @@ 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 } + console.log(point) window.map.flyTo(point.reverse(), 17) code && this.openPopup(code, feature.id) } -- Gitblit v1.8.0