If waypoints are selected in the list, only these will be deleted. Else all waypoints will be deleted.
"))
self.routing_fromline_list.setToolTip(_translate("ORStoolsDialogBase", "Select waypoints from the map!"))
self.save_vertices.setToolTip(_translate("ORStoolsDialogBase", "
Save points in list to layer. Use the processing algorithms (batch jobs) to work with points from layers.
"))
diff --git a/ORStools/gui/ORStoolsDialogUI.ui b/ORStools/gui/ORStoolsDialogUI.ui
index 68aa672..f8f1548 100644
--- a/ORStools/gui/ORStoolsDialogUI.ui
+++ b/ORStools/gui/ORStoolsDialogUI.ui
@@ -273,7 +273,7 @@
- <html><head/><body><p>Add wayoints interactively from the map canvas.</p><p>Double-click will terminate waypoint selection.</p></body></html>
+ <html><head/><body><p>Add wayoints interactively from the map canvas.</p><p>The Escape key, right- or double-click will terminate waypoint selection.</p></body></html>
diff --git a/ORStools/i18n/orstools_de.ts b/ORStools/i18n/orstools_de.ts
index 6dfcda0..2c24ecf 100644
--- a/ORStools/i18n/orstools_de.ts
+++ b/ORStools/i18n/orstools_de.ts
@@ -428,8 +428,8 @@ Duplikate entfernen oder Wegpunktoptimierung abwählen.
-
- <html><head/><body><p>Wegpunkte aus Kartenansicht hinzufügen</p><p>Doppelklick beendet die Wegpunkt-Auswahl</p></body></html>
+
+ <html><head/><body><p>Wegpunkte aus Kartenansicht hinzufügen</p><p>Escape, Rechts- oder Doppelklick beendeen die Wegpunkt-Auswahl.</p></body></html>
@@ -466,7 +466,7 @@ p, li { white-space: pre-wrap; }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
+</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
<p style=" padding: 10px; -qt-block-indent:0; text-indent:0px ; background-color:#e7f2fa; color: #999999"><img stype="margin: 10px" src=":/plugins/ORStools/img/icon_about.png" width=16 height=16 /> Sämtliche Einstellungen werden überschrieben</p></body></html>
@@ -776,7 +776,7 @@ Duplikate entfernen oder Wegpunktoptimierung abwählen.
Haben Sie einen <b>API-Key</b> für den openrouteservice gesetzt?<br><br>
diff --git a/ORStools/utils/maptools.py b/ORStools/utils/maptools.py
index 76b05ba..46011f9 100644
--- a/ORStools/utils/maptools.py
+++ b/ORStools/utils/maptools.py
@@ -30,7 +30,7 @@
from qgis.core import QgsWkbTypes
from qgis.gui import QgsMapToolEmitPoint, QgsRubberBand
-from qgis.PyQt.QtCore import pyqtSignal
+from qgis.PyQt.QtCore import pyqtSignal, Qt
from qgis.PyQt.QtGui import QColor
from ORStools import DEFAULT_COLOR
@@ -66,14 +66,22 @@ def reset(self):
pointDrawn = pyqtSignal(["QgsPointXY", "int"])
+ def keyPressEvent(self, event) -> None:
+ # Check if the pressed key is the Escape key
+ if event.key() == Qt.Key_Escape:
+ self.end_digitization()
+
def canvasReleaseEvent(self, e):
"""Add marker to canvas and shows line."""
- new_point = self.toMapCoordinates(e.pos())
- self.points.append(new_point)
+ if e.button() == Qt.RightButton:
+ self.end_digitization()
+ else:
+ new_point = self.toMapCoordinates(e.pos())
+ self.points.append(new_point)
- # noinspection PyUnresolvedReferences
- self.pointDrawn.emit(new_point, self.points.index(new_point))
- self.showLine()
+ # noinspection PyUnresolvedReferences
+ self.pointDrawn.emit(new_point, self.points.index(new_point))
+ self.showLine()
def showLine(self):
"""Builds rubber band from all points and adds it to the map canvas."""
@@ -84,16 +92,19 @@ def showLine(self):
self.rubberBand.addPoint(point, False)
self.rubberBand.show()
- doubleClicked = pyqtSignal()
+ digitizationEnded = pyqtSignal()
# noinspection PyUnusedLocal
def canvasDoubleClickEvent(self, e):
"""Ends line drawing and deletes rubber band and markers from map canvas."""
# noinspection PyUnresolvedReferences
- self.doubleClicked.emit()
- self.canvas.scene().removeItem(self.rubberBand)
- del self.rubberBand
+ self.end_digitization()
def deactivate(self):
super(LineTool, self).deactivate()
self.deactivated.emit()
+
+ def end_digitization(self):
+ self.digitizationEnded.emit()
+ self.canvas.scene().removeItem(self.rubberBand)
+ del self.rubberBand
diff --git a/tests/conftest.py b/tests/conftest.py
index 78dcd20..d2ac028 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -12,6 +12,7 @@
s = QgsSettings()
data = s.value("ORStools/config")
+
def pytest_sessionstart(session):
"""
Called after the Session object has been created and
diff --git a/tests/test_gui.py b/tests/test_gui.py
index b9b0372..4986b81 100644
--- a/tests/test_gui.py
+++ b/tests/test_gui.py
@@ -63,6 +63,4 @@ def test_ORStoolsDialog(self):
dlg.line_tool.canvasDoubleClickEvent(map_dclick)
self.assertTrue(dlg.isVisible())
- self.assertEqual(
- dlg.routing_fromline_list.item(0).text(), "Point 0: -0.187575, 56.516620"
- )
+ self.assertEqual(dlg.routing_fromline_list.item(0).text(), "Point 0: -0.187575, 56.516620")
diff --git a/tests/test_proc.py b/tests/test_proc.py
index ebe9f3d..083da84 100644
--- a/tests/test_proc.py
+++ b/tests/test_proc.py
@@ -195,7 +195,9 @@ def test_export(self):
export = ORSExportAlgo().create()
dest_id = export.processAlgorithm(parameters, self.context, self.feedback)
processed_layer = QgsProcessingUtils.mapLayerFromString(dest_id["OUTPUT"], self.context)
- processed_nodes = QgsProcessingUtils.mapLayerFromString(dest_id["OUTPUT_POINT"], self.context)
+ processed_nodes = QgsProcessingUtils.mapLayerFromString(
+ dest_id["OUTPUT_POINT"], self.context
+ )
self.assertEqual(type(processed_layer), QgsVectorLayer)
self.assertEqual(type(processed_nodes), QgsVectorLayer)