From 1abc6d35b10491214b0ad77b0e0365453b3c29cb Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期二, 20 四月 2021 21:54:01 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop
---
public/assets/images/map/sewers/雨水排口.png | 0
src/conf/LayerTopic.js | 3 ++-
src/conf/layers/LayerPk.js | 13 +++++++------
src/components/LayerController/service/LayerFactory.js | 41 ++++++++++++++++++-----------------------
4 files changed, 27 insertions(+), 30 deletions(-)
diff --git "a/public/assets/images/map/sewers/\351\233\250\346\260\264\346\216\222\345\217\243.png" "b/public/assets/images/map/sewers/\351\233\250\346\260\264\346\216\222\345\217\243.png"
index 04e5ae6..3646905 100644
--- "a/public/assets/images/map/sewers/\351\233\250\346\260\264\346\216\222\345\217\243.png"
+++ "b/public/assets/images/map/sewers/\351\233\250\346\260\264\346\216\222\345\217\243.png"
Binary files differ
diff --git a/src/components/LayerController/service/LayerFactory.js b/src/components/LayerController/service/LayerFactory.js
index 5aedc79..9387933 100644
--- a/src/components/LayerController/service/LayerFactory.js
+++ b/src/components/LayerController/service/LayerFactory.js
@@ -8,6 +8,7 @@
this.map = window.map
this.layers = {}
this.layersLogic = {}
+ this.minZoomLayers = {}
}
init (layerConfig) {
@@ -21,10 +22,17 @@
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
}
}
@@ -93,32 +101,19 @@
* @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)
}
}
diff --git a/src/conf/LayerTopic.js b/src/conf/LayerTopic.js
index 4cf11c4..0e1f844 100644
--- a/src/conf/LayerTopic.js
+++ b/src/conf/LayerTopic.js
@@ -11,11 +11,12 @@
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]
}
diff --git a/src/conf/layers/LayerPk.js b/src/conf/layers/LayerPk.js
index 5547507..3750c1f 100644
--- a/src/conf/layers/LayerPk.js
+++ b/src/conf/layers/LayerPk.js
@@ -1,11 +1,10 @@
/**
* 鎺掑彛
*/
-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: [
{
@@ -13,15 +12,17 @@
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
}
]
--
Gitblit v1.8.0