| | |
| | | this.map = window.map |
| | | this.layers = {} |
| | | this.layersLogic = {} |
| | | this.minZoomLayers = {} |
| | | } |
| | | |
| | | init (layerConfig) { |
| | |
| | | layers && this.init(config.layers) |
| | | childLayer && this.init(config.childLayer) |
| | | |
| | | this.initMinZoom(config) |
| | | this.loadLogic(config) |
| | | this.toggleZoomByConfig(config) |
| | | checked && this.show(config) |
| | | } |
| | | } |
| | | } |
| | | |
| | | initMinZoom (config) { |
| | | const minZoom = parseInt(config.minZoom) |
| | | if (minZoom) { |
| | | this.minZoomLayers[minZoom] = config |
| | | } |
| | | } |
| | | |
| | |
| | | * @param layerConfig |
| | | */ |
| | | initEvent (layerConfig) { |
| | | this.map.on('zoomend ', (e) => this.toggleZoomByLayer(layerConfig)) |
| | | // this.map.on('zoomend ', () => this.toggleByZoom()) |
| | | } |
| | | |
| | | toggleZoomByLayer (layerConfig) { |
| | | var config = layerConfig |
| | | if (Array.isArray(layerConfig)) { |
| | | for (var i = 0, l = layerConfig.length; i < l; i++) { |
| | | config = layerConfig[i] |
| | | var layers = config.layers |
| | | var childLayer = config.childLayer |
| | | layers && this.toggleZoomByLayer(layers) |
| | | childLayer && this.toggleZoomByLayer(childLayer) |
| | | this.toggleZoomByConfig(config) |
| | | } |
| | | } else { |
| | | this.toggleZoomByConfig(layerConfig) |
| | | } |
| | | } |
| | | |
| | | toggleZoomByConfig (config) { |
| | | toggleByZoom () { |
| | | const zoom = this.map.getZoom() |
| | | var checked = config.checked |
| | | if (checked && config.minZoom) { |
| | | if (zoom > config.minZoom) { |
| | | for (var k in this.minZoomLayers) { |
| | | const config = this.minZoomLayers[k] |
| | | const checked = config.checked |
| | | console.log(zoom) |
| | | console.log(k) |
| | | if (checked && zoom > k) { |
| | | this.show(config) |
| | | } else { |
| | | } else if (checked && zoom < k) { |
| | | this.hide(config) |
| | | } |
| | | } |
| | |
| | | import { LayerPipeLines } from './layers/LayerPipeLines' |
| | | import { LayerArea } from './layers/LayerArea' |
| | | import { LayerVideo } from './layers/LayerVideo' |
| | | import { LayerPk } from './layers/LayerPk' |
| | | |
| | | export const LayerTopic = { |
| | | code: 'sewersTopic', |
| | | name: 'ä¸é¢å¾å±', |
| | | checked: false, |
| | | isShow: true, |
| | | layers: [LayerPollutionSources, LayerWasteWater, LayerWasteGas, LayerWasteSolid, LayerAirQuality, LayerEnvRisk, LayerSoilGroundWater, LayerPipeLines, LayerVideo, LayerArea] |
| | | layers: [LayerPollutionSources, LayerWasteWater, LayerWasteGas, LayerWasteSolid, LayerAirQuality, LayerEnvRisk, LayerSoilGroundWater, LayerPipeLines, LayerPk, LayerVideo, LayerArea] |
| | | } |
| | |
| | | /** |
| | | * æå£ |
| | | */ |
| | | import { PIPELINE_WFS } from '../Constants' |
| | | const WFS_URL = PIPELINE_WFS |
| | | export const LayerPk = { |
| | | code: 'sewersPk', |
| | | name: 'æå£', |
| | | code: 'sewersDischargeport', |
| | | name: 'ææ¾å£', |
| | | icon: 'sewers/鍿°´æå£.png', |
| | | checked: true, |
| | | layers: [ |
| | | { |
| | |
| | | name: 'å
æå£', |
| | | sname: 'å
æå£', |
| | | checked: true, |
| | | wfs: WFS_URL + '?TYPENAME=å
æå£', |
| | | icon: 'sewers/鍿°´æå£.png', |
| | | wfs: 'http://xearth.cn:6240/geoserver/sewer/wfs?service=WFS&version=1.0.0&request=GetFeature&typeName=sewer:dischargeport&maxFeatures=50&outputFormat=application/json&cql_filter=pfktype=\'å
æ\'', |
| | | minZoom: 10 // 卿å®çº§å«æ¾ç¤º |
| | | }, |
| | | { |
| | | code: 'sewersWpk', |
| | | name: '夿å£', |
| | | sname: '夿å£', |
| | | icon: 'sewers/鍿°´æå£.png', |
| | | checked: true, // é»è®¤éä¸ç¶æ |
| | | wfs: WFS_URL + '?TYPENAME=夿å£', |
| | | wfs: 'http://xearth.cn:6240/geoserver/sewer/wfs?service=WFS&version=1.0.0&request=GetFeature&typeName=sewer:dischargeport&maxFeatures=50&outputFormat=application/json&cql_filter=pfktype=\'夿\'', |
| | | minZoom: 10 |
| | | } |
| | | ] |