Skip to content

Commit

Permalink
update QGIS
Browse files Browse the repository at this point in the history
  • Loading branch information
landam committed Nov 13, 2023
1 parent 4c433fb commit 16ad560
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Requirements: QGIS 3.28.10 and higher
Set path to the plugin from command line:

```sh
QGIS_PLUGINPATH=`pwd`/bin/qgis qgis tests/data/qgis_project.qgz
QGIS_PLUGINPATH=`pwd`/bin/qgis qgis tests/data/nucice/qgis_project.qgz
```

or define `QGIS_PLUGINPATH` in `Settings -> Options -> System` and restart QGIS:
Expand Down
3 changes: 2 additions & 1 deletion bin/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, label, section_arguments=()):
'soil': Argument('Soil polygons feature layer'),
'landuse': Argument('Landuse polygons feature layer'),
'points': Argument('Input points feature layer'),
'points_field': Argument('Field with the input points identifier'),
'stream': Argument('Stream network feature layer'),
'rainfall': Argument('Definition of the rainfall event'),
'output': Argument('Output directory'),
Expand All @@ -49,7 +50,7 @@ def __init__(self, label, section_arguments=()):
'Spatial data',
(
'elevation', 'soil', 'soil_type_field', 'landuse',
'landuse_type_field', 'points', 'stream', 'rainfall'
'landuse_type_field', 'points', 'points_field', 'stream', 'rainfall'
)
),
Section(
Expand Down
2 changes: 1 addition & 1 deletion bin/grass/r.smoderp2d/r.smoderp2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
# %end
# %option G_OPT_DB_COLUMN
# % key: points_fieldname
# % description: Point code
# % description: Field with the input points idenfifier
# % required: no
# % guisection: Settings
# %end
Expand Down
15 changes: 13 additions & 2 deletions bin/qgis/smoderp2d-plugin/smoderp_2D_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def __init__(self, parent=None):
self.vegetation_toolButton = QtWidgets.QToolButton()
self.points_comboBox = QgsMapLayerComboBox()
self.points_toolButton = QtWidgets.QToolButton()
self.points_field_comboBox = QgsFieldComboBox()
self.stream_comboBox = QgsMapLayerComboBox()
self.stream_toolButton = QtWidgets.QToolButton()
self.rainfall_lineEdit = QtWidgets.QLineEdit()
Expand Down Expand Up @@ -210,6 +211,7 @@ def set_widgets(self):
self.arguments['landuse'].addWidget(self.vegetation_toolButton)
self.arguments['points'].addWidget(self.points_comboBox)
self.arguments['points'].addWidget(self.points_toolButton)
self.arguments['points_field'].addWidget(self.points_field_comboBox)
self.arguments['stream'].addWidget(self.stream_comboBox)
self.arguments['stream'].addWidget(self.stream_toolButton)
self.arguments['rainfall'].addWidget(self.rainfall_lineEdit)
Expand Down Expand Up @@ -276,6 +278,9 @@ def setupButtonSlots(self):
self.vegetation_comboBox.layerChanged.connect(
lambda: self.setFields('vegetation')
)
self.points_comboBox.layerChanged.connect(
lambda: self.setFields('points')
)

# 2nd tab - Computation
self.rainfall_toolButton.clicked.connect(
Expand Down Expand Up @@ -316,6 +321,7 @@ def setupCombos(self):

self.setFields('soil')
self.setFields('vegetation')
self.setFields('points')

# 3rd tab - Settings
self.table_soil_vegetation_comboBox.setFilters(
Expand Down Expand Up @@ -454,6 +460,7 @@ def _getInputParams(self):
'vegetation_type_fieldname':
self.vegetation_type_comboBox.currentText(),
'points': self.points_comboBox.currentText(),
'points_fieldname': self.points_field_comboBox.currentText(),
# 'output': self.output_lineEdit.text().strip(),
'streams': self.stream_comboBox.currentText(),
'rainfall_file': self.rainfall_lineEdit.text(),
Expand Down Expand Up @@ -642,7 +649,6 @@ def openFileDialog(self, t, widget):

def setFields(self, t):
"""Set fields of soil and vegetation type."""

if self.soil_comboBox.currentLayer() is not None and t == 'soil':
self.soil_type_comboBox.setLayer(self.soil_comboBox.currentLayer())
self.soil_type_comboBox.setField(
Expand Down Expand Up @@ -672,7 +678,11 @@ def setFields(self, t):
else:
self.table_stream_shape_code_comboBox.setLayer(None)
self.table_stream_shape_code_comboBox.setField("")

elif self.points_comboBox.currentLayer() is not None and t == 'points':
self.points_field_comboBox.setLayer(self.points_comboBox.currentLayer())
self.points_field_comboBox.setField(
self.points_comboBox.currentLayer().fields()[0].name()
)
else:
pass

Expand Down Expand Up @@ -705,6 +715,7 @@ def _loadTestParams(self):
self.points_comboBox.setLayer(
QgsProject.instance().mapLayersByName('points')[0]
)
self.points_field_comboBox.setCurrentText('point_id')
self.stream_comboBox.setLayer(
QgsProject.instance().mapLayersByName('stream')[0]
)
Expand Down

0 comments on commit 16ad560

Please sign in to comment.