Skip to content

Commit

Permalink
Merge pull request #896 from nens/fix_water_on_street_duration_styling
Browse files Browse the repository at this point in the history
Fix water on street duration styling
  • Loading branch information
leendertvanwolfswinkel authored Sep 13, 2023
2 parents 45f1f77 + 692e9dc commit 66c6514
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions tool_statistics/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ def apply(self, qgis_layer, style_kwargs):
self.styling_method(qgis_layer, self.qml, **style_kwargs)


def style_on_single_column(layer, qml: str, column: str):
def style_on_single_column(layer, qml: str, column: str, update_classes: bool = True):
layer.loadNamedStyle(qml)
layer.renderer().setClassAttribute(column)
layer.renderer().updateClasses(
vlayer=layer,
mode=layer.renderer().mode(),
nclasses=len(layer.renderer().ranges()),
)
if update_classes:
layer.renderer().updateClasses(
vlayer=layer,
mode=layer.renderer().mode(),
nclasses=len(layer.renderer().ranges()),
)
layer.triggerRepaint()
utils.iface.layerTreeView().refreshLayerSymbology(layer.id())

Expand Down Expand Up @@ -245,13 +246,6 @@ def style_ts_reduction_analysis(
utils.iface.layerTreeView().refreshLayerSymbology(layer.id())


def style_fixed_style(layer, qml: str):
""" Load a style as-is. """
layer.loadNamedStyle(qml)
layer.triggerRepaint()
utils.iface.layerTreeView().refreshLayerSymbology(layer.id())


STYLE_FLOW_DIRECTION = Style(
name="Flow direction",
output_type="flowline",
Expand Down Expand Up @@ -297,7 +291,12 @@ def style_fixed_style(layer, qml: str):
output_type="node",
params={"column": "column"},
qml="water_on_street_duration.qml",
styling_method=style_fixed_style,
styling_method=lambda layer, qml, column, update_classes=False: style_on_single_column(
layer,
qml,
column,
update_classes
),
)

STYLE_CHANGE_WL = Style(
Expand Down

0 comments on commit 66c6514

Please sign in to comment.