Skip to content

Commit

Permalink
Merge pull request #288 from Samweli/update_highest_position_tool
Browse files Browse the repository at this point in the history
Fix pixel value passing to the highest position tool
  • Loading branch information
Samweli authored Nov 8, 2023
2 parents b1a529f + 56b97d3 commit 7c97341
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cplus_plugin/gui/qgis_cplus_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ def run_analysis(self):
if item.isEnabled()
]

self.analysis_weighted_ims = []

base_dir = settings_manager.get_value(Settings.BASE_DIR)

if self.analysis_scenario_name == "" or self.analysis_scenario_name is None:
Expand Down Expand Up @@ -911,6 +913,9 @@ def run_highest_position_analysis(self):
self.analysis_weighted_ims,
key=lambda model_instance: model_instance.style_pixel_value,
)
for index, model in enumerate(all_models):
model.style_pixel_value = index + 1

all_models_names = [model.name for model in all_models]
sources = []

Expand Down Expand Up @@ -2232,7 +2237,7 @@ def post_analysis(self, scenario_result):
scenario_layer = qgis_instance.addMapLayer(layer)

# Scenario result layer styling
renderer = self.style_models_layer(layer, list_models)
renderer = self.style_models_layer(layer, self.analysis_weighted_ims)
layer.setRenderer(renderer)
layer.triggerRepaint()

Expand Down Expand Up @@ -2330,7 +2335,7 @@ def style_models_layer(self, layer, models):
:type layer: QgsRasterLayer
:param models: List which contains the implementation
models
models that were passed to the highest position analysis tool
:type models: list
:returns: Renderer for the symbology.
Expand Down

0 comments on commit 7c97341

Please sign in to comment.