nens / threedi-schematisation-editor

QGIS tool for editing schematisations
0 stars 0 forks source link

Error when adding a cross section location to a Channel between two cross section locations with bank_level IS NULL #102

Closed leendertvanwolfswinkel closed 1 year ago

leendertvanwolfswinkel commented 1 year ago

I have a channel that already contains 2 cross section locations. Both have NULL as bank level. I want to add a third one in between. I activate the Add Point Feature tool and click on the channel, in between the two existing cross section locations.

I get this error:

An error occurred during execution of following code:
open_edit_form( _qgis_featureform_19_15, _qgis_layer_Cross_section_location_13b796e3_977a_416b_8715_510d14ccfd05_15, _qgis_feature_20230103115228035)

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\threedi_schematisation_editor\utils.py", line 381, in open_edit_form
    plugin.layer_manager.populate_edit_form(dialog, layer, feature)
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\threedi_schematisation_editor\user_layer_manager.py", line 417, in populate_edit_form
    self.form_factory.set_layer_form_logic(dialog, layer, feature)
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\threedi_schematisation_editor\user_layer_forms.py", line 25, in set_layer_form_logic
    current_instance.setup_form_widgets()
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\threedi_schematisation_editor\forms\custom_forms.py", line 94, in setup_form_widgets
    self.toggle_edit_mode()
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\threedi_schematisation_editor\forms\custom_forms.py", line 132, in toggle_edit_mode
    self.populate_with_extra_widgets()
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\threedi_schematisation_editor\forms\custom_forms.py", line 1151, in populate_with_extra_widgets
    self.fill_related_attributes()
  File "C:\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\threedi_schematisation_editor\forms\custom_forms.py", line 1134, in fill_related_attributes
    before_bank_level + ((after_bank_level - before_bank_level) * interpolation_coefficient), 3
TypeError: unsupported operand type(s) for -: 'QVariant' and 'QVariant'

Python version:
3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]

QGIS version:
3.22.3-Białowieża 'Białowieża', 1628765ec7

Python path:
['C:\\Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\threedi_beta_processing', 'C:\\Users\\leendert.vanwolfswin\\AppData\\Roaming\\QGIS\\QGIS3\\profiles\\default\\python\\plugins\\ThreeDiToolbox\\deps', 'C:/PROGRA~1/QGIS32~1.3/apps/qgis/./python', 'C:/Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python', 'C:/Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins', 'C:/PROGRA~1/QGIS32~1.3/apps/qgis/./python/plugins', 'C:\\Program Files\\QGIS 3.22.3\\bin\\python39.zip', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\DLLs', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib', 'C:\\Program Files\\QGIS 3.22.3\\bin', 'C:\\Users\\leendert.vanwolfswin\\AppData\\Roaming\\Python\\Python39\\site-packages', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages\\GDAL-3.4.1-py3.9-win-amd64.egg', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages\\win32', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages\\win32\\lib', 'C:\\PROGRA~1\\QGIS32~1.3\\apps\\Python39\\lib\\site-packages\\Pythonwin', 'C:/Users/leendert.vanwolfswin/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python', '.']
ldebek commented 1 year ago

@leendertvanwolfswinkel Fix available on branch minor_bugs_fixes