Skip to content

Commit

Permalink
Change style for water on street duration preset.
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanverkerk committed Jul 31, 2023
1 parent c8a0235 commit ba6e32d
Show file tree
Hide file tree
Showing 4 changed files with 493 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Removed a lot of unused code
- Water Balance: updated Water Balance tool (#856, #868, #855)
- Statistics: added preset "Water on street duration" (#845)
- Statistics: Change style for water on street duration preset (#872)


3.1.5 (2023-06-21)
Expand Down
6 changes: 2 additions & 4 deletions tool_statistics/presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
STYLE_VECTOR,
STYLE_TIMESTEP_REDUCTION_ANALYSIS,
STYLE_BALANCE,
STYLE_WATER_ON_STREET_DURATION_NODE,
)


Expand Down Expand Up @@ -257,12 +258,9 @@ def aggregations(self):
name="Water on street duration",
description="Duration of waterlevel above manhole drain level.",
aggregations=water_on_street_aggregations,
nodes_style=STYLE_SINGLE_COLUMN_GRADUATED_NODE,
cells_style=STYLE_SINGLE_COLUMN_GRADUATED_CELL,
nodes_style=STYLE_WATER_ON_STREET_DURATION_NODE,
nodes_style_param_values={"column": "s1_time_above_threshold"},
cells_style_param_values={"column": "s1_time_above_threhsold"},
nodes_layer_name="Water on street duration (nodes)",
cells_layer_name="Water on street duration (cells)",
raster_layer_name="Water on street duration (raster)",
only_manholes=True,
)
Expand Down
16 changes: 16 additions & 0 deletions tool_statistics/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ 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 @@ -285,6 +292,14 @@ def style_ts_reduction_analysis(
styling_method=style_on_single_column,
)

STYLE_WATER_ON_STREET_DURATION_NODE = Style(
name="Water on street duration",
output_type="node",
params={},
qml="water_on_street_duration.qml",
styling_method=style_fixed_style,
)

STYLE_CHANGE_WL = Style(
name="Change in water level",
output_type="cell",
Expand Down Expand Up @@ -334,6 +349,7 @@ def style_ts_reduction_analysis(
STYLE_SINGLE_COLUMN_GRADUATED_CELL,
STYLE_CHANGE_WL,
STYLE_BALANCE,
STYLE_WATER_ON_STREET_DURATION_NODE,
]

DEFAULT_STYLES = {
Expand Down
Loading

0 comments on commit ba6e32d

Please sign in to comment.