Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Move body of reclassifyValue to header so it can be optimised
- Loading branch information
|
@@ -82,19 +82,7 @@ void QgsReclassifyUtils::reclassify( const QVector<QgsReclassifyUtils::RasterCla |
|
|
destinationRaster->setEditable( false ); |
|
|
} |
|
|
|
|
|
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; |
|
|
return c.value; |
|
|
} |
|
|
} |
|
|
return input; |
|
|
} |
|
|
|
|
|
|
|
|
///@endcond |
|
|
|
|
|
|
@@ -23,6 +23,7 @@ |
|
|
#include "qgis.h" |
|
|
#include "qgis_analysis.h" |
|
|
#include "qgsrasterrange.h" |
|
|
#include <QVector> |
|
|
|
|
|
class QgsRasterInterface; |
|
|
class QgsProcessingFeedback; |
|
@@ -104,12 +105,25 @@ 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 ) |
|
|
{ |
|
|
reclassified = false; |
|
|
for ( const QgsReclassifyUtils::RasterClass &c : classes ) |
|
|
{ |
|
|
if ( c.contains( input ) ) |
|
|
{ |
|
|
reclassified = true; |
|
|
return c.value; |
|
|
} |
|
|
} |
|
|
return input; |
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
Q_DECLARE_TYPEINFO( QgsReclassifyUtils::RasterClass, Q_MOVABLE_TYPE ); |
|
|
|
|
|
|
|
|
///@endcond PRIVATE |
|
|
|
|
|
#endif // QGSRECLASSIFYUTILS |
|
|