@@ -60,6 +60,11 @@ void QgsReclassifyAlgorithmBase::initAlgorithm( const QVariantMap &configuration
60
60
boundsHandling->setFlags ( QgsProcessingParameterDefinition::FlagAdvanced );
61
61
addParameter ( boundsHandling.release () );
62
62
63
+ std::unique_ptr< QgsProcessingParameterBoolean > missingValuesParam = qgis::make_unique< QgsProcessingParameterBoolean >( QStringLiteral ( " NODATA_FOR_MISSING" ),
64
+ QObject::tr ( " Use no data when no range matches value" ), false , false );
65
+ missingValuesParam->setFlags ( QgsProcessingParameterDefinition::FlagAdvanced );
66
+ addParameter ( missingValuesParam.release () );
67
+
63
68
addParameter ( new QgsProcessingParameterRasterDestination ( QStringLiteral ( " OUTPUT" ), QObject::tr ( " Reclassified raster" ) ) );
64
69
}
65
70
@@ -80,7 +85,7 @@ bool QgsReclassifyAlgorithmBase::prepareAlgorithm( const QVariantMap ¶meters
80
85
mNbCellsYProvider = mInterface ->ySize ();
81
86
82
87
mNoDataValue = parameterAsDouble ( parameters, QStringLiteral ( " NO_DATA" ), context );
83
-
88
+ mUseNoDataForMissingValues = parameterAsBool ( parameters, QStringLiteral ( " NODATA_FOR_MISSING " ), context );
84
89
85
90
int boundsType = parameterAsEnum ( parameters, QStringLiteral ( " RANGE_BOUNDARIES" ), context );
86
91
switch ( boundsType )
@@ -107,7 +112,7 @@ bool QgsReclassifyAlgorithmBase::prepareAlgorithm( const QVariantMap ¶meters
107
112
108
113
QVariantMap QgsReclassifyAlgorithmBase::processAlgorithm ( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
109
114
{
110
- QVector< QgsReclassifyUtils::RasterClass > classes = createClasses ( parameters, context, feedback );
115
+ QVector< QgsReclassifyUtils::RasterClass > classes = createClasses ( mBoundsType , parameters, context, feedback );
111
116
112
117
const QString outputFile = parameterAsOutputLayer ( parameters, QStringLiteral ( " OUTPUT" ), context );
113
118
QFileInfo fi ( outputFile );
@@ -122,7 +127,8 @@ QVariantMap QgsReclassifyAlgorithmBase::processAlgorithm( const QVariantMap &par
122
127
123
128
provider->setNoDataValue ( 1 , mNoDataValue );
124
129
125
- QgsReclassifyUtils::reclassify ( classes, mInterface .get (), mBand , mExtent , mNbCellsXProvider , mNbCellsYProvider , provider.get (), mNoDataValue , feedback );
130
+ QgsReclassifyUtils::reclassify ( classes, mInterface .get (), mBand , mExtent , mNbCellsXProvider , mNbCellsYProvider , provider.get (), mNoDataValue , mUseNoDataForMissingValues ,
131
+ feedback );
126
132
127
133
QVariantMap outputs;
128
134
outputs.insert ( QStringLiteral ( " OUTPUT" ), outputFile );
0 commit comments