From 426cd9a6f06aa39cf13c1281c17b6ebf7be22fa5 Mon Sep 17 00:00:00 2001 From: Till Frankenbach <81414045+Merydian@users.noreply.github.com> Date: Fri, 22 Dec 2023 09:41:47 +0100 Subject: [PATCH] feat: remove blue lines when using GUI fixes #120 Co-authored-by: Jakob Schnell --- CHANGELOG.md | 1 + ORStools/gui/ORStoolsDialog.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6abf4e54..c151e4c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ RELEASING: - Add styling of routing output in main plugin ([#149](https://github.com/GIScience/orstools-qgis-plugin/issues/149)) - make items in centroid list drag and droppable ([#144](https://github.com/GIScience/orstools-qgis-plugin/issues/144)) - Add save button for vertices ([#144](https://github.com/GIScience/orstools-qgis-plugin/issues/144)) +- remove blue lines every time the red X button is clicked ([#120](https://github.com/GIScience/orstools-qgis-plugin/issues/120)) ## [1.6.0] - 2023-07-25 diff --git a/ORStools/gui/ORStoolsDialog.py b/ORStools/gui/ORStoolsDialog.py index 2ed5ebe6..baeb6619 100644 --- a/ORStools/gui/ORStoolsDialog.py +++ b/ORStools/gui/ORStoolsDialog.py @@ -505,6 +505,10 @@ def _on_clear_listwidget_click(self): self.routing_fromline_list.clear() self._clear_annotations() + # Remove blue lines (rubber band) + if self.line_tool: + self.line_tool.canvas.scene().removeItem(self.line_tool.rubberBand) + def _linetool_annotate_point(self, point, idx, crs=None): if not crs: crs = self._iface.mapCanvas().mapSettings().destinationCrs() @@ -533,6 +537,10 @@ def _clear_annotations(self): def _on_linetool_init(self): """Hides GUI dialog, inits line maptool and add items to line list box.""" + # Remove blue lines (rubber band) + if self.line_tool: + self.line_tool.canvas.scene().removeItem(self.line_tool.rubberBand) + self.hide() self.routing_fromline_list.clear() # Remove all annotations which were added (if any)