| | |
| | | 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' |
| | | |
| | | /** |
| | |
| | | this.layersLogic = {} |
| | | this.minZoomLayers = {} |
| | | this.wmsLayers = [] |
| | | this.clickSwitch = false |
| | | this.clickSwitch = true // 图层点击弹窗开关 |
| | | } |
| | | |
| | | init (layerConfig) { |
| | |
| | | var childLayer = config.childLayer |
| | | var checked = config.checked |
| | | /* if (config.groupName) { |
| | | const wmsGroupLayerService = new WmsGroupLayerService(config) |
| | | const wmsGroupLayerService = new WmsLayerGroupService(config) |
| | | wmsGroupLayerService.init() |
| | | continue |
| | | } */ |
| | |
| | | |
| | | 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] |
| | |
| | | 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) |
| | |
| | | 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) |
| | | } |