From 10b9b5456665b902781fe2dc1526e239da2d631a Mon Sep 17 00:00:00 2001
From: YANGDL <114714267@qq.com>
Date: 星期五, 26 二月 2021 16:13:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/components/helpers/ServiceLayerHelper.js | 36 +++++++++++++++++-------------------
1 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/src/components/helpers/ServiceLayerHelper.js b/src/components/helpers/ServiceLayerHelper.js
index bf9883e..fa100b0 100644
--- a/src/components/helpers/ServiceLayerHelper.js
+++ b/src/components/helpers/ServiceLayerHelper.js
@@ -5,6 +5,7 @@
import AjaxUtils from '@/utils/AjaxUtils'
import store from '@/store'
+var myRenderer = window.L.canvas()
class ServiceLayerHelper {
constructor (options) {
this.map = options.map
@@ -69,16 +70,16 @@
}
}
- loadGeojsonLayer (url, layer) {
+ loadGeojsonLayer (url, item) {
var matches = this.regex.exec(url)
- var matchValue = layer[matches[1]]
- var code = layer.code
+ var matchValue = item[matches[1]]
+ var code = item.code
var newUrl = url.replace(this.regex, matchValue)
var that = this
if (!that.geojsonArray[code]) {
AjaxUtils.GetDataAsynByUrl(newUrl, {}, function (res) {
store.commit('setSewersDatas', res)
- var layer = that.loadGeojson(res)
+ var layer = that.loadGeojson(res, item)
that.geojsonArray[code] = layer
})
}
@@ -88,12 +89,10 @@
* 鍔犺浇鐐规暟鎹�
* @param res
*/
- loadGeojson (res) {
+ loadGeojson (res, layer) {
var that = this
- const featureGroup = that.L.featureGroup([], {
- attribution: { id: '123' }
- }).addTo(that.map)
- that.L.geoJSON(res.features, {
+ var icon = layer.icon
+ return that.L.geoJSON(res.features, {
style: function (feature) {
return {
fill: true,
@@ -101,10 +100,9 @@
fillColor: '#06cccc',
color: '#06cccc',
fillOpacity: 0.2,
- opacity: 0.8
- // ,
- // dashArray: '10,4',
- // dashSpeed: -10
+ opacity: 0.8,
+ dashArray: '10,4',
+ dashSpeed: -10
}
},
pointToLayer: function (geoJsonPoint, latlng) {
@@ -112,16 +110,16 @@
{
radius: 20,
img: {
- url: 'assets/images/map/marker-icon.png',
+ // url: 'assets/images/map/marker-icon.png',
+ url: '/assets/images/map/' + icon,
size: [20, 20]
}
})
- }
+ },
+ renderer: myRenderer
}).bindPopup(function (layer) {
- // return layer.feature.properties.linenumber
- }).addTo(featureGroup)
- featureGroup.bringToBack()
- return featureGroup
+ return layer.feature.properties.linenumber
+ }).addTo(that.map)
}
removeLayer (item) {
--
Gitblit v1.8.0