From 26e060f15e0ac993dd8bcc842387b7e1c1e5b71f Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期二, 16 三月 2021 20:43:12 +0800
Subject: [PATCH] 修改
---
src/components/panel/ToolBoxPanel.vue | 53 +++++++++++++++++++++++++++++++++++------------------
1 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/src/components/panel/ToolBoxPanel.vue b/src/components/panel/ToolBoxPanel.vue
index b1b862e..e7ef163 100644
--- a/src/components/panel/ToolBoxPanel.vue
+++ b/src/components/panel/ToolBoxPanel.vue
@@ -233,12 +233,17 @@
methods: {
changeChoose (index) {
this.active = index
+ if (this.drawLayer == null) {
+ this.drawLayer = this.L.layerGroup().addTo(this.map)
+ }
},
changeSelect () {
this.selectGroup = !this.selectGroup
},
choiceItem (itemT, indexT) {
this.Selecd = indexT
+ // eslint-disable-next-line no-unused-vars
+ const layerGroups = []
switch (itemT.label) {
case '鐐规爣缁�':
var myIcon = this.L.icon({
@@ -247,20 +252,36 @@
iconAnchor: [13, 16],
popupAnchor: [26, -32]
})
- this.drawLayer = this.map.editTools.startMarker()
- this.drawLayer.setIcon(myIcon)
+ // eslint-disable-next-line no-case-declarations
+ const drawLayer = this.map.editTools.startMarker()
+ drawLayer.setIcon(myIcon)
+ this.drawLayer.addLayer(drawLayer)
+ this.drawLayer.addLayer(this.setLogic(drawLayer))
break
case '绾挎爣缁�':
- this.drawLayer = this.map.editTools.startPolyline()
+ // eslint-disable-next-line no-case-declarations
+ const drawLayerLine = this.map.editTools.startPolyline()
+ this.drawLayer.addLayer(drawLayerLine)
+ this.setLogic(drawLayerLine)
break
case '澶氳竟褰�':
- this.drawLayer = this.map.editTools.startPolygon()
+ var drawLayerPolygonD = this.map.editTools.startPolygon()
+ this.drawLayer.addLayer(drawLayerPolygonD)
+ this.setLogic(drawLayerPolygonD)
break
case '鐭╁舰':
- this.drawLayer = this.map.editTools.startRectangle()
+ var drawLayerPolygonJ = this.map.editTools.startRectangle()
+ this.drawLayer.addLayer(drawLayerPolygonJ)
+ this.setLogic(drawLayerPolygonJ)
break
case '鍦嗗舰':
- this.drawLayer = this.map.editTools.startCircle()
+ // eslint-disable-next-line no-case-declarations
+ const drawLayerPolygonY = this.map.editTools.startCircle()
+ this.drawLayer.addLayer(drawLayerPolygonY)
+ this.setLogic(drawLayerPolygonY)
+ break
+ case '鍒犻櫎':
+ this.drawLayer.clearLayers()
break
case '璺濈':
Measure.startMeasureLen(this.map, this.L)
@@ -276,7 +297,7 @@
exportOnly: true,
hideControlContainer: true
}).addTo(this.map)
- printer.printMap('CurrentSize', 'MyManualPrint')
+ printer.printMap('CurrentSize', '鍏ㄥ睆')
break
case 'A4妯悜':
var printerX = this.L.easyPrint({
@@ -285,7 +306,7 @@
exportOnly: true,
hideControlContainer: true
}).addTo(this.map)
- printerX.printMap('A4Landscape page', 'MyManualPrint')
+ printerX.printMap('A4Landscape page', '妯悜')
break
case 'A4绾靛悜':
var printerY = this.L.easyPrint({
@@ -294,18 +315,14 @@
exportOnly: true,
hideControlContainer: true
}).addTo(this.map)
- printerY.printMap('A4Portrait page', 'MyManualPrint')
- break
- case '鍒犻櫎':
- this.map.removeLayer(this.drawLayer)
+ printerY.printMap('A4Portrait page', '绾靛悜')
break
}
- this.drawLayer.on('dblclick', this.L.DomEvent.stop).on('dblclick', this.drawLayer.toggleEdit)
- this.drawLayer.setStyle({
- color: 'red',
- fillColor: '#ffffff',
- fillOpacity: 0.1,
- fill: true
+ },
+ setLogic (layer) {
+ layer.on('dblclick', this.L.DomEvent.stop).on('dblclick', layer.toggleEdit)
+ layer.setStyle({
+ color: 'red'
})
}
}
--
Gitblit v1.8.0