Skip to content

Commit

Permalink
[processing] adapt algorithms to use new band parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Aug 4, 2017
1 parent 49bfe69 commit 7c706d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/qgis/RasterLayerStatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from qgis.core import (QgsRectangle,
QgsRasterBandStats,
QgsProcessingParameterRasterLayer,
QgsProcessingParameterNumber,
QgsProcessingParameterBand,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingOutputNumber)
Expand Down Expand Up @@ -60,10 +60,10 @@ def __init__(self):
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT,
self.tr('Input layer')))
self.addParameter(QgsProcessingParameterNumber(self.BAND,
self.tr('Band number'),
QgsProcessingParameterNumber.Integer,
1, False, 1, 999))
self.addParameter(QgsProcessingParameterBand(self.BAND,
self.tr('Band number'),
1,
self.INPUT))
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('Statistics'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('Statistics')))

Expand Down
9 changes: 5 additions & 4 deletions python/plugins/processing/algs/qgis/ZonalStatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
QgsProcessingParameterVectorLayer,
QgsProcessingParameterRasterLayer,
QgsProcessingParameterString,
QgsProcessingParameterNumber,
QgsProcessingParameterBand,
QgsProcessingParameterEnum,
QgsProcessingOutputVectorLayer)

Expand Down Expand Up @@ -78,9 +78,10 @@ def initAlgorithm(self, config=None):

self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT_RASTER,
self.tr('Raster layer')))
self.addParameter(QgsProcessingParameterNumber(self.RASTER_BAND,
self.tr('Raster band'),
minValue=1, maxValue=999, defaultValue=1))
self.addParameter(QgsProcessingParameterBand(self.RASTER_BAND,
self.tr('Raster band'),
1,
self.INPUT_RASTER))
self.addParameter(QgsProcessingParameterVectorLayer(self.INPUT_VECTOR,
self.tr('Vector layer containing zones'),
[QgsProcessing.TypeVectorPolygon]))
Expand Down

0 comments on commit 7c706d2

Please sign in to comment.