Skip to content

Commit

Permalink
Merge pull request #286 from Samweli/fix_weighted_ims
Browse files Browse the repository at this point in the history
Fix weighted IMs styles
  • Loading branch information
Samweli authored Nov 7, 2023
2 parents a6002fd + c66fc41 commit c1dff35
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/cplus_plugin/gui/qgis_cplus_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@
SCENARIO_OUTPUT_FILE_NAME,
SCENARIO_OUTPUT_LAYER_NAME,
USER_DOCUMENTATION_SITE,
PILOT_AREA_SCENARIO_SYMBOLOGY,
IM_COLOUR_RAMPS,
)
from ..definitions.constants import (
IM_GROUP_LAYER_NAME,
Expand Down Expand Up @@ -233,6 +231,7 @@ def prepare_input(self):
self.analysis_scenario_description = None
self.analysis_extent = None
self.analysis_implementation_models = None
self.analysis_weighted_ims = []
self.analysis_priority_layers_groups = []

def priority_groups_update(self, target_item, selected_items):
Expand Down Expand Up @@ -2111,6 +2110,8 @@ def priority_layers_analysis_done(
if output is not None and output.get("OUTPUT") is not None:
model.path = output.get("OUTPUT")

self.analysis_weighted_ims.append(model)

if model_index == len(models) - 1:
self.run_highest_position_analysis()

Expand Down Expand Up @@ -2299,21 +2300,18 @@ def post_analysis(self, scenario_result):

im_index = im_index + 1

for weighted_im in list_weighted_ims:
if not weighted_im.endswith(".tif"):
continue
for model in self.analysis_weighted_ims:
weighted_im_path = model.path
weighted_im_name = model.name

weighted_im_name = weighted_im[: len(weighted_im) - 9]
if not weighted_im_path.endswith(".tif"):
continue

im_weighted_layer = QgsRasterLayer(
im_weighted_dir + weighted_im, weighted_im_name, QGIS_GDAL_PROVIDER
)

weighted_im_model = settings_manager.find_implementation_model_by_name(
weighted_im
weighted_im_path, weighted_im_name, QGIS_GDAL_PROVIDER
)

renderer = self.style_model_layer(im_weighted_layer, weighted_im_model)
renderer = self.style_model_layer(im_weighted_layer, model)
im_weighted_layer.setRenderer(renderer)
im_weighted_layer.triggerRepaint()

Expand Down

0 comments on commit c1dff35

Please sign in to comment.