Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make vertices draggable and droppable #268

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9d74f0f
Copy from other branch and make it work
merydian Jun 10, 2024
fbe34e3
feat: remove rubberband when annotations are deleted
merydian Jun 10, 2024
d3c3c7a
style: run ruff
merydian Jun 10, 2024
72b8df4
docs: add changelog entry
merydian Jun 10, 2024
72e291d
feat: drop shapely dependency
merydian Jul 22, 2024
d2661c8
fix: reset if api key not set
merydian Aug 15, 2024
ce58295
style: some refactoring
merydian Aug 15, 2024
3929e8b
fix: points not draggable after 2010 error
merydian Aug 16, 2024
f60ffa2
feat: reload rubber band when live preview is toggled
merydian Nov 12, 2024
d788b3a
refactor: some methods to reuse code
merydian Nov 13, 2024
38d2348
fix: Use message bar instead of box
merydian Nov 13, 2024
3cd13d2
fix: error with livePreview toggle and empty routing list
merydian Nov 13, 2024
47bc9c4
style: run ruff
merydian Nov 13, 2024
0c8f763
fix: message bar when connection refused
merydian Nov 15, 2024
1c1351f
fix: maptool not reset after double click
merydian Nov 15, 2024
3e175de
feat: use tr method to translate user prompts
merydian Nov 25, 2024
e85c3bb
feat: reload rubber band on profile change
merydian Nov 25, 2024
2a59f79
refactor: remove unused canvas variable
merydian Nov 25, 2024
429c212
refactor: make _toggle_preview more readable
merydian Nov 25, 2024
8e624a4
feat: drag & drop even after double click
merydian Nov 25, 2024
3512212
fix: remove unused file
merydian Nov 25, 2024
0fe9da6
feat: move maptool things to maptool.py and make it work
merydian Nov 26, 2024
16a37f9
fix: rubber band created with one too many vertices
merydian Nov 29, 2024
4c15f92
feat: add tests
merydian Nov 29, 2024
f2324a1
style: run ruff
merydian Dec 2, 2024
2453e17
refactor: reuse router.py functionality in ORStoolsDialogMain
merydian Dec 2, 2024
29cd9c4
style: run ruff
merydian Dec 2, 2024
dcfe083
feat: improve tooltip of green + button
merydian Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RELEASING:
-->

## [Unreleased]
- Make vertex marker on map drag and droppable, add live preview ([#204](https://github.com/GIScience/orstools-qgis-plugin/issues/204))

## [1.10.0] - 2024-11-21

Expand Down
1 change: 1 addition & 0 deletions ORStools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def classFactory(iface): # pylint: disable=invalid-name
# Define plugin wide constants
PLUGIN_NAME = "ORS Tools"
DEFAULT_COLOR = "#a8b1f5"
ROUTE_COLOR = "#c62828"
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

RESOURCE_PREFIX = ":plugins/ORStools/img/"
Expand Down
274 changes: 53 additions & 221 deletions ORStools/gui/ORStoolsDialog.py

Large diffs are not rendered by default.

34 changes: 19 additions & 15 deletions ORStools/gui/ORStoolsDialogUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ def setupUi(self, ORStoolsDialogBase):
self.save_vertices.setIcon(icon4)
self.save_vertices.setObjectName("save_vertices")
self.gridLayout.addWidget(self.save_vertices, 2, 0, 1, 1)
self.toggle_preview = QtWidgets.QCheckBox(self.widget)
self.toggle_preview.setObjectName("toggle_preview")
self.gridLayout.addWidget(self.toggle_preview, 3, 0, 1, 1)
merydian marked this conversation as resolved.
Show resolved Hide resolved
self.verticalLayout_7.addWidget(self.widget)
self.advances_group = QgsCollapsibleGroupBox(self.qwidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
Expand All @@ -219,8 +222,8 @@ def setupUi(self, ORStoolsDialogBase):
self.advances_group.setMaximumSize(QtCore.QSize(16777215, 20))
self.advances_group.setCheckable(False)
self.advances_group.setChecked(False)
self.advances_group.setCollapsed(True)
self.advances_group.setSaveCollapsedState(False)
self.advances_group.setProperty("collapsed", True)
self.advances_group.setProperty("saveCollapsedState", False)
self.advances_group.setObjectName("advances_group")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.advances_group)
self.verticalLayout_3.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
Expand All @@ -235,8 +238,8 @@ def setupUi(self, ORStoolsDialogBase):
self.optimization_group.setMaximumSize(QtCore.QSize(16777215, 20))
self.optimization_group.setCheckable(True)
self.optimization_group.setChecked(False)
self.optimization_group.setCollapsed(True)
self.optimization_group.setSaveCollapsedState(False)
self.optimization_group.setProperty("collapsed", True)
self.optimization_group.setProperty("saveCollapsedState", False)
self.optimization_group.setObjectName("optimization_group")
self.gridLayout_2 = QtWidgets.QGridLayout(self.optimization_group)
self.gridLayout_2.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
Expand Down Expand Up @@ -280,8 +283,8 @@ def setupUi(self, ORStoolsDialogBase):
self.routing_avoid_tags_group.setSizePolicy(sizePolicy)
self.routing_avoid_tags_group.setCheckable(True)
self.routing_avoid_tags_group.setChecked(False)
self.routing_avoid_tags_group.setCollapsed(True)
self.routing_avoid_tags_group.setSaveCollapsedState(False)
self.routing_avoid_tags_group.setProperty("collapsed", True)
self.routing_avoid_tags_group.setProperty("saveCollapsedState", False)
self.routing_avoid_tags_group.setObjectName("routing_avoid_tags_group")
self.gridLayout_4 = QtWidgets.QGridLayout(self.routing_avoid_tags_group)
self.gridLayout_4.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
Expand Down Expand Up @@ -311,8 +314,8 @@ def setupUi(self, ORStoolsDialogBase):
self.routing_avoid_countries_group.setMaximumSize(QtCore.QSize(16777215, 20))
self.routing_avoid_countries_group.setCheckable(True)
self.routing_avoid_countries_group.setChecked(False)
self.routing_avoid_countries_group.setCollapsed(True)
self.routing_avoid_countries_group.setSaveCollapsedState(False)
self.routing_avoid_countries_group.setProperty("collapsed", True)
self.routing_avoid_countries_group.setProperty("saveCollapsedState", False)
self.routing_avoid_countries_group.setObjectName("routing_avoid_countries_group")
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.routing_avoid_countries_group)
self.verticalLayout_4.setObjectName("verticalLayout_4")
Expand All @@ -330,13 +333,13 @@ def setupUi(self, ORStoolsDialogBase):
self.avoidpolygon_group.setMaximumSize(QtCore.QSize(16777215, 20))
self.avoidpolygon_group.setCheckable(True)
self.avoidpolygon_group.setChecked(False)
self.avoidpolygon_group.setCollapsed(True)
self.avoidpolygon_group.setSaveCollapsedState(False)
self.avoidpolygon_group.setProperty("collapsed", True)
self.avoidpolygon_group.setProperty("saveCollapsedState", False)
self.avoidpolygon_group.setObjectName("avoidpolygon_group")
self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.avoidpolygon_group)
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.avoidpolygon_dropdown = QgsMapLayerComboBox(self.avoidpolygon_group)
self.avoidpolygon_dropdown.setShowCrs(False)
self.avoidpolygon_dropdown.setProperty("showCrs", False)
self.avoidpolygon_dropdown.setObjectName("avoidpolygon_dropdown")
self.verticalLayout_6.addWidget(self.avoidpolygon_dropdown)
self.verticalLayout_3.addWidget(self.avoidpolygon_group)
Expand Down Expand Up @@ -407,8 +410,8 @@ def setupUi(self, ORStoolsDialogBase):
self.ors_log_group.setMinimumSize(QtCore.QSize(0, 0))
self.ors_log_group.setMaximumSize(QtCore.QSize(16777215, 20))
self.ors_log_group.setFlat(True)
self.ors_log_group.setCollapsed(True)
self.ors_log_group.setSaveCollapsedState(False)
self.ors_log_group.setProperty("collapsed", True)
self.ors_log_group.setProperty("saveCollapsedState", False)
self.ors_log_group.setObjectName("ors_log_group")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.ors_log_group)
self.verticalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
Expand Down Expand Up @@ -484,10 +487,11 @@ def retranslateUi(self, ORStoolsDialogBase):
self.routing_travel_label.setText(_translate("ORStoolsDialogBase", "Go with"))
self.routing_travel_combo.setToolTip(_translate("ORStoolsDialogBase", "Mode of travel"))
self.routing_preference_combo.setToolTip(_translate("ORStoolsDialogBase", "Preference"))
self.routing_fromline_map.setToolTip(_translate("ORStoolsDialogBase", "<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>"))
self.routing_fromline_map.setToolTip(_translate("ORStoolsDialogBase", "<html><head/><body><p>Add wayoints interactively from the map canvas.</p><p>Right- or double-click will pause waypoint selection, drag and drop will still be enabled. Another click on the green + button will continue the selection process. The ESC-button will terminate it and delete all waypoints.</p></body></html>"))
self.routing_fromline_clear.setToolTip(_translate("ORStoolsDialogBase", "<html><head/><body><p>If waypoints are selected in the list, only these will be deleted. Else all waypoints will be deleted.</p></body></html>"))
self.routing_fromline_list.setToolTip(_translate("ORStoolsDialogBase", "Select waypoints from the map!"))
self.save_vertices.setToolTip(_translate("ORStoolsDialogBase", "<html><head/><body><p>Save points in list to layer. Use the processing algorithms (batch jobs) to work with points from layers.</p></body></html>"))
self.toggle_preview.setText(_translate("ORStoolsDialogBase", "LivePreview"))
self.advances_group.setTitle(_translate("ORStoolsDialogBase", "Advanced Configuration"))
self.optimization_group.setToolTip(_translate("ORStoolsDialogBase", "<html><head/><body><p>Enabling Traveling Salesman will omit all other advanced configuration and assume the preference to be <span style=\" font-weight:600;\">fastest</span>.</p></body></html>"))
self.optimization_group.setTitle(_translate("ORStoolsDialogBase", "Traveling Salesman"))
Expand Down Expand Up @@ -538,4 +542,4 @@ def retranslateUi(self, ORStoolsDialogBase):
from qgscollapsiblegroupbox import QgsCollapsibleGroupBox
from qgsfilterlineedit import QgsFilterLineEdit
from qgsmaplayercombobox import QgsMapLayerComboBox
from . import resources_rc
# import resources_rc
39 changes: 23 additions & 16 deletions ORStools/gui/ORStoolsDialogUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add wayoints interactively from the map canvas.&lt;/p&gt;&lt;p&gt;The Escape key, right- or double-click will terminate waypoint selection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add wayoints interactively from the map canvas.&lt;/p&gt;&lt;p&gt;Right- or double-click will pause waypoint selection, drag and drop will still be enabled. Another click on the green + button will continue the selection process. The ESC-button will terminate it and delete all waypoints.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
Expand Down Expand Up @@ -361,6 +361,13 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="toggle_preview">
<property name="text">
<string>LivePreview</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand All @@ -387,10 +394,10 @@
<property name="checked">
<bool>false</bool>
</property>
<property name="collapsed">
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<property name="saveCollapsedState">
<property name="saveCollapsedState" stdset="0">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand Down Expand Up @@ -429,10 +436,10 @@
<property name="checked">
<bool>false</bool>
</property>
<property name="collapsed">
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<property name="saveCollapsedState">
<property name="saveCollapsedState" stdset="0">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0">
Expand Down Expand Up @@ -551,10 +558,10 @@ p, li { white-space: pre-wrap; }
<property name="checked">
<bool>false</bool>
</property>
<property name="collapsed">
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<property name="saveCollapsedState">
<property name="saveCollapsedState" stdset="0">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
Expand Down Expand Up @@ -625,10 +632,10 @@ p, li { white-space: pre-wrap; }
<property name="checked">
<bool>false</bool>
</property>
<property name="collapsed">
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<property name="saveCollapsedState">
<property name="saveCollapsedState" stdset="0">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
Expand All @@ -637,7 +644,7 @@ p, li { white-space: pre-wrap; }
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Avoid countries based on ISO 3166 Alpha-2 or Alpha-3 codes.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="qgisRelation">
<property name="qgisRelation" stdset="0">
<string notr="true"/>
</property>
</widget>
Expand Down Expand Up @@ -671,10 +678,10 @@ p, li { white-space: pre-wrap; }
<property name="checked">
<bool>false</bool>
</property>
<property name="collapsed">
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<property name="saveCollapsedState">
<property name="saveCollapsedState" stdset="0">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand All @@ -683,7 +690,7 @@ p, li { white-space: pre-wrap; }
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Avoid areas by specifying a (Multi-)Polygon layer. &lt;/p&gt;&lt;p&gt;Does &lt;span style=&quot; font-weight:600;&quot;&gt;not work&lt;/span&gt; for memory (scratch) Polygon layers!&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Note&lt;/span&gt;, only the first feature of the layer will be respected.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="showCrs">
<property name="showCrs" stdset="0">
<bool>false</bool>
</property>
</widget>
Expand Down Expand Up @@ -793,7 +800,7 @@ p, li { white-space: pre-wrap; }
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint">
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
Expand Down Expand Up @@ -831,10 +838,10 @@ p, li { white-space: pre-wrap; }
<property name="flat">
<bool>true</bool>
</property>
<property name="collapsed">
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<property name="saveCollapsedState">
<property name="saveCollapsedState" stdset="0">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
Expand Down
Loading
Loading