From 93a9b3228d214602a899791992726a01925c5ac4 Mon Sep 17 00:00:00 2001
From: ChenZeping02609 <chenzeping02609@163.com>
Date: 星期四, 13 五月 2021 14:20:07 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop
---
src/components/LayerController/service/WfsLayerService.js | 97 +++++++++++++++++++++++++++---------------------
1 files changed, 55 insertions(+), 42 deletions(-)
diff --git a/src/components/LayerController/service/WfsLayerService.js b/src/components/LayerController/service/WfsLayerService.js
index f00eaeb..b139a63 100644
--- a/src/components/LayerController/service/WfsLayerService.js
+++ b/src/components/LayerController/service/WfsLayerService.js
@@ -1,8 +1,9 @@
/**
- * 鍔犺浇涓氬姟鏁版嵁鍥惧眰
+ * 鍔犺浇wfs鏈嶅姟鍥惧眰
*/
import { STYLES } from '../../../conf/Constants'
import AjaxUtils from '../../../utils/AjaxUtils'
+import { setZIndex } from '../../../utils/utils'
class WfsLayerService {
constructor (config) {
@@ -10,8 +11,8 @@
this.params = {
version: '1.0.0',
REQUEST: 'getfeature',
- OUTPUTFORMAT: 'json',
- maxFeatures: 20000
+ OUTPUTFORMAT: 'json'
+ // maxFeatures: 20000
}
this.popupComp = window.popupComp
this.L = window.L
@@ -34,46 +35,57 @@
}
draw (features) {
- const icon = this.config.icon
- const geojsonLayer = this.L.geoJSON(features, {
- style: function (feature) {
- return {
- fill: STYLES.FILL,
- weight: STYLES.WEIGHT,
- fillColor: STYLES.FILL_COLOR,
- color: STYLES.COLOR,
- fillOpacity: STYLES.FILL_OPACITY,
- opacity: STYLES.OPACITY
- // dashArray: STYLES.DASH_ARRAY,
- // dashSpeed: STYLES.DASH_SPPED
- }
- },
- pointToLayer: (geoJsonPoint, latlng) => {
- return this.L.canvasMarker(latlng,
- {
- img: {
- // url: 'assets/images/map/marker-icon.png',
- url: '/assets/images/map/' + icon,
- size: STYLES.ICON_SIZE
- }
+ if (features && features.length > 0) {
+ const icon = this.config.icon
+ const styles = this.config.styles
+ Object.assign(STYLES, styles)
+ const geojsonLayer = this.L.geoJSON(features, {
+ style: function (feature) {
+ return {
+ fill: STYLES.FILL,
+ weight: STYLES.WEIGHT,
+ fillColor: STYLES.FILL_COLOR,
+ color: STYLES.COLOR,
+ fillOpacity: STYLES.FILL_OPACITY,
+ opacity: STYLES.OPACITY
+ // dashArray: STYLES.DASH_ARRAY,
+ // dashSpeed: STYLES.DASH_SPPED
+ }
+ },
+ pointToLayer: (geoJsonPoint, latlng) => {
+ return this.L.canvasMarker(latlng,
+ {
+ img: {
+ // url: 'assets/images/map/marker-icon.png',
+ url: '/assets/images/map/' + icon,
+ size: STYLES.ICON_SIZE
+ }
+ })
+ },
+ onEachFeature: (feature, layer) => {
+ const popupDatas = []
+ const properties = feature.properties
+ popupDatas.push({
+ title: properties.wellname || properties.devicename || properties.name,
+ name: feature.id,
+ content: properties
})
- },
- onEachFeature: (feature, layer) => {
- layer.bindPopup((layer) => {
- this.popupComp.setDatas(layer)
- this.popupComp.setShow()
- return this.popupComp.$el
- }, {
- className: 's-map-popup',
- minWidth: 300,
- closeButton: false,
- autoClose: false
- })
- .bindTooltip((layer) => this.tooltipListener(layer), { direction: 'bottom', offset: [0, 15], sticky: true })
- .on('mouseover', (e) => this.mouseOverListener(e, layer)).on('mouseout', (e) => this.mouseOutListener(e, layer))
- }
- }).addTo(this.layer)
- window.layerFactory.setZIndex(geojsonLayer)
+ layer.bindPopup((layer) => {
+ this.popupComp.setDatas(popupDatas)
+ this.popupComp.setShow()
+ return this.popupComp.$el
+ }, {
+ className: 's-map-popup',
+ minWidth: 300,
+ closeButton: false,
+ autoClose: false
+ })
+ .bindTooltip((layer) => this.tooltipListener(layer), { direction: 'bottom', offset: [0, 15], sticky: true })
+ .on('mouseover', (e) => this.mouseOverListener(e, layer)).on('mouseout', (e) => this.mouseOutListener(e, layer))
+ }
+ }).addTo(this.layer)
+ setZIndex(geojsonLayer)
+ }
}
mouseOverListener (e, layer) {
@@ -122,4 +134,5 @@
return name
}
}
+
export default WfsLayerService
--
Gitblit v1.8.0