Skip to content
Open
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
24 changes: 23 additions & 1 deletion src/cplus_plugin/gui/qgis_cplus_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import datetime

from functools import partial
from random import randint

from pathlib import Path

Expand Down Expand Up @@ -2348,7 +2349,28 @@ def style_models_layer(self, layer, models):
im_name = model.name

raster_val = model.style_pixel_value
color = model.scenario_fill_symbol().color()

model_fill_symbol = model.scenario_fill_symbol()
if model_fill_symbol is None:
self.show_message(
tr(
f"Couldn't fetch color for the implementation model {im_name},"
f" using a random color instead."
),
level=Qgis.Warning,
)
log(
tr(
f"Couldn't fetch color for the implementation model {im_name},"
f" using a random color instead, fill symbol is None"
)
)
color_names = QtGui.QColor.colorNames()
color_name = color_names[randint(0, len(color_names))]
color = QtGui.QColor(color_name)
else:
color = model_fill_symbol.color()

color_ramp_shader = QgsColorRampShader.ColorRampItem(
float(raster_val), QtGui.QColor(color), im_name
)
Expand Down