Skip to content
Permalink
Browse files

Formatting

  • Loading branch information
nyalldawson committed Jun 8, 2018
1 parent 059f343 commit 3ca9618cef03aaeabc16e17d706696cd02a6ffb7
@@ -37,7 +37,7 @@ QString QgsReclassifyAlgorithmBase::groupId() const
return QStringLiteral( "rasteranalysis" );
}

void QgsReclassifyAlgorithmBase::initAlgorithm( const QVariantMap &configuration )
void QgsReclassifyAlgorithmBase::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterRasterLayer( QStringLiteral( "INPUT_RASTER" ),
QObject::tr( "Raster layer" ) ) );
@@ -26,10 +26,10 @@

///@cond PRIVATE

void QgsReclassifyUtils::reclassify(const QVector<QgsReclassifyUtils::RasterClass> &classes, QgsRasterInterface *sourceRaster, int band,
const QgsRectangle &extent, int sourceWidthPixels, int sourceHeightPixels,
void QgsReclassifyUtils::reclassify( const QVector<QgsReclassifyUtils::RasterClass> &classes, QgsRasterInterface *sourceRaster, int band,
const QgsRectangle &extent, int sourceWidthPixels, int sourceHeightPixels,
QgsRasterDataProvider *destinationRaster, double destNoDataValue, bool useNoDataForMissingValues,
QgsProcessingFeedback *feedback )
QgsProcessingFeedback *feedback )
{
int maxWidth = 4000;
int maxHeight = 4000;
@@ -52,8 +52,8 @@ void QgsReclassifyUtils::reclassify(const QVector<QgsReclassifyUtils::RasterClas
bool reclassed = false;
while ( iter.readNextRasterPart( band, iterCols, iterRows, &rasterBlock, iterLeft, iterTop ) )
{
if ( feedback )
feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks );
if ( feedback )
feedback->setProgress( 100 * ( ( iterTop / maxHeight * nbBlocksWidth ) + iterLeft / maxWidth ) / nbBlocks );
std::unique_ptr< QgsRasterBlock > reclassifiedBlock = qgis::make_unique< QgsRasterBlock >( Qgis::Float32, iterCols, iterRows );

for ( int row = 0; row < iterRows; row++ )
@@ -82,14 +82,14 @@ void QgsReclassifyUtils::reclassify(const QVector<QgsReclassifyUtils::RasterClas
destinationRaster->setEditable( false );
}

double QgsReclassifyUtils::reclassifyValue(const QVector<QgsReclassifyUtils::RasterClass> &classes, double input, bool &reclassified)
double QgsReclassifyUtils::reclassifyValue( const QVector<QgsReclassifyUtils::RasterClass> &classes, double input, bool &reclassified )
{
reclassified = false;
for ( const QgsReclassifyUtils::RasterClass &c : classes )
{
if ( c.contains( input ) )
{
reclassified = true;
reclassified = true;
return c.value;
}
}
@@ -46,22 +46,22 @@ class ANALYSIS_EXPORT QgsReclassifyUtils
*/
class RasterClass : public QgsRasterRange
{
public:
public:

//! Default constructor for an empty class
RasterClass() = default;

/**
* Constructor for RasterClass, with the specified range of min to max values.
* The \a value argument gives the desired output value for this raster class.
*/
RasterClass( double minValue, double maxValue, QgsRasterRange::BoundsType type, double value )
: QgsRasterRange( minValue, maxValue, type )
, value( value )
{}

//! Desired output value for class
double value = 0;
RasterClass() = default;

/**
* Constructor for RasterClass, with the specified range of min to max values.
* The \a value argument gives the desired output value for this raster class.
*/
RasterClass( double minValue, double maxValue, QgsRasterRange::BoundsType type, double value )
: QgsRasterRange( minValue, maxValue, type )
, value( value )
{}

//! Desired output value for class
double value = 0;
};

/**
@@ -85,15 +85,15 @@ class ANALYSIS_EXPORT QgsReclassifyUtils
* The \a feedback argument gives an optional processing feedback, for progress reports
* and cancelation.
*/
static void reclassify(const QVector< RasterClass > &classes,
QgsRasterInterface *sourceRaster,
int band,
const QgsRectangle& extent,
int sourceWidthPixels,
int sourceHeightPixels,
QgsRasterDataProvider *destinationRaster,
double destNoDataValue, bool useNoDataForMissingValues,
QgsProcessingFeedback *feedback = nullptr );
static void reclassify( const QVector< RasterClass > &classes,
QgsRasterInterface *sourceRaster,
int band,
const QgsRectangle &extent,
int sourceWidthPixels,
int sourceHeightPixels,
QgsRasterDataProvider *destinationRaster,
double destNoDataValue, bool useNoDataForMissingValues,
QgsProcessingFeedback *feedback = nullptr );

/**
* Reclassifies a single \a input value, using the specified list of \a classes.
@@ -104,7 +104,7 @@ class ANALYSIS_EXPORT QgsReclassifyUtils
* If no matching class was found then \a reclassified will be set to false, and the
* original \a input value returned unchanged.
*/
static double reclassifyValue( const QVector< RasterClass > &classes, double input, bool& reclassified );
static double reclassifyValue( const QVector< RasterClass > &classes, double input, bool &reclassified );

};

0 comments on commit 3ca9618

Please sign in to comment.
You can’t perform that action at this time.