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

Add styling for output layer of main plugin #188

Merged
merged 6 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -46,6 +46,7 @@ RELEASING:
- Additional parameter for the "smoothing factor" to isochrones processing algorithms ([#172](https://github.com/GIScience/orstools-qgis-plugin/issues/172))
- Mention omission of configuration options when using traveling salesman
- option to set location type for isochrones ([#191](https://github.com/GIScience/orstools-qgis-plugin/pull/191))
- 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))

Expand Down
16 changes: 15 additions & 1 deletion ORStools/gui/ORStoolsDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
)
from qgis.gui import QgsMapCanvasAnnotationItem

from PyQt5.QtCore import QSizeF, QPointF, QCoreApplication
from PyQt5.QtCore import QSizeF, QPointF, QCoreApplication, QSettings
from PyQt5.QtGui import QIcon, QTextDocument
from PyQt5.QtWidgets import QAction, QDialog, QApplication, QMenu, QMessageBox, QDialogButtonBox

Expand Down Expand Up @@ -243,6 +243,20 @@ def run_gui_control(self):
layer_out.dataProvider().addAttributes(directions_core.get_fields())
layer_out.updateFields()

basepath = os.path.dirname(__file__)

# add ors svg path
my_new_path = os.path.join(basepath, "img/svg")
svg_paths = QSettings().value("svg/searchPathsForSVG")
if my_new_path not in svg_paths:
svg_paths.append(my_new_path)
QSettings().setValue("svg/searchPathsForSVG", svg_paths)

# style output layer
qml_path = os.path.join(basepath, "linestyle.qml")
layer_out.loadNamedStyle(qml_path, True)
layer_out.triggerRepaint()

# Associate annotations with map layer, so they get deleted when layer is deleted
for annotation in self.dlg.annotations:
# Has the potential to be pretty cool: instead of deleting, associate with mapLayer
Expand Down
9 changes: 9 additions & 0 deletions ORStools/gui/img/svg/endpoint_marker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions ORStools/gui/img/svg/startpoint_marker.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading