-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from qgis.core import QgsExpressionContextUtils, edit | ||
|
||
|
||
def a_b(layer): | ||
process_type = int( | ||
QgsExpressionContextUtils.layerScope(layer).variable("pzp_process") | ||
) | ||
selection = layer.selectedFeatures() | ||
|
||
if not selection: | ||
selection = layer.getFeatures() | ||
|
||
with edit(layer): | ||
for feature in selection: | ||
matrice = feature["matrice"] | ||
if process_type == 1200: # Flusso detrito | ||
if matrice == 2: | ||
feature["grado_pericolo"] = 1003 | ||
elif matrice == 4: | ||
feature["grado_pericolo"] = 1003 | ||
elif matrice == 6: | ||
feature["grado_pericolo"] = 1004 | ||
|
||
elif process_type in [2001, 2002]: # Sciv. spontaneo and colata detritica | ||
if matrice == 3: | ||
feature["grado_pericolo"] = 1003 | ||
elif matrice == 5: | ||
feature["grado_pericolo"] = 1003 | ||
elif process_type == 3000: # Caduta sassi | ||
if matrice == 6: | ||
feature["grado_pericolo"] = 1004 | ||
else: | ||
pass | ||
|
||
layer.updateFeature(feature) | ||
|
||
|
||
def b_a(layer): | ||
process_type = int( | ||
QgsExpressionContextUtils.layerScope(layer).variable("pzp_process") | ||
) | ||
selection = layer.selectedFeatures() | ||
|
||
if not selection: | ||
selection = layer.getFeatures() | ||
|
||
with edit(layer): | ||
for feature in selection: | ||
matrice = feature["matrice"] | ||
if process_type == 1200: # Flusso detrito | ||
if matrice == 2: | ||
feature["grado_pericolo"] = 1002 | ||
elif matrice == 4: | ||
feature["grado_pericolo"] = 1002 | ||
elif matrice == 6: | ||
feature["grado_pericolo"] = 1003 | ||
|
||
elif process_type in [2001, 2002]: # Sciv. spontaneo and colata detritica | ||
if matrice == 3: | ||
feature["grado_pericolo"] = 1002 | ||
elif matrice == 5: | ||
feature["grado_pericolo"] = 1002 | ||
elif process_type == 3000: # Caduta sassi | ||
if matrice == 6: | ||
feature["grado_pericolo"] = 1003 | ||
else: | ||
pass | ||
|
||
layer.updateFeature(feature) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters