Skip to content

Commit

Permalink
Qml files for caduta sassi
Browse files Browse the repository at this point in the history
  • Loading branch information
domi4484 committed Sep 15, 2023
1 parent 0dfcb09 commit 0151077
Show file tree
Hide file tree
Showing 5 changed files with 2,178 additions and 56 deletions.
18 changes: 11 additions & 7 deletions pzp/add_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ def _add_process(self, process_type, gpkg_directory_path):

utils.add_field_to_layer(area_layer, "fonte_proc", "Fonte del processo (es. nome riale)", QVariant.String)

utils.set_qml_style(area_layer, "area")
utils.set_not_null_constraint_to_field(area_layer, "fonte_proc")
utils.set_unique_constraint_to_field(area_layer, "fonte_proc")
# For caduta sassi fonte_proc are multiple in separate layer
if process_type != 3000: # Caduta sassi
utils.set_qml_style(area_layer, "area")

utils.set_not_null_constraint_to_field(area_layer, "fonte_proc")
utils.set_unique_constraint_to_field(area_layer, "fonte_proc")
else:
utils.set_qml_style(area_layer, "area_caduta_sassi")

utils.set_default_value_to_field(area_layer, "proc_parz", "@pzp_process")
utils.set_not_null_constraint_to_field(area_layer, "proc_parz")
utils.remove_unique_constraint_to_field(area_layer, "proc_parz")
Expand Down Expand Up @@ -276,10 +282,9 @@ def _add_process_caduta_sassi_propagation(self, zone_di_stacco_gpkg_layer):
QVariant.String,
)
utils.add_field_to_layer(propagation_layer, "prob_rottura", "Probabilità di rottura", QVariant.Int)
utils.set_qml_style(propagation_layer, "propagation")
utils.set_qml_style(propagation_layer, "propagation_caduta_sassi")
utils.set_not_null_constraint_to_field(propagation_layer, "fonte_proc")
utils.remove_unique_constraint_to_field(propagation_layer, "fonte_proc")
utils.set_value_relation_field(propagation_layer, "fonte_proc", zone_di_stacco_gpkg_layer, "nome", "nome")

utils.add_layer_to_gpkg(propagation_layer, self._gpkg_path)
propagation_gpkg_layer = utils.load_gpkg_layer(propagation_layer.name(), self._gpkg_path)
Expand Down Expand Up @@ -312,8 +317,7 @@ def _add_process_caduta_sassi_breaking(self, zone_di_stacco_gpkg_layer):

utils.set_default_value_to_field(breaking_layer, "proc_parz", "@pzp_process")

utils.set_qml_style(breaking_layer, "breaking")
utils.set_value_relation_field(breaking_layer, "fonte_proc", zone_di_stacco_gpkg_layer, "nome", "nome")
utils.set_qml_style(breaking_layer, "breaking_caduta_sassi")

utils.add_layer_to_gpkg(breaking_layer, self._gpkg_path)
breaking_gpkg_layer = utils.load_gpkg_layer(breaking_layer.name(), self._gpkg_path)
Expand Down
Loading

0 comments on commit 0151077

Please sign in to comment.