Skip to content
Permalink
Browse files

Move body of reclassifyValue to header so it can be optimised

  • Loading branch information
nyalldawson committed Jun 10, 2018
1 parent a534286 commit dc77c59a4519f6d3de7f94a7bc10d01f7be51c55
Showing with 16 additions and 14 deletions.
  1. +1 −13 src/analysis/processing/qgsreclassifyutils.cpp
  2. +15 −1 src/analysis/processing/qgsreclassifyutils.h
@@ -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

0 comments on commit dc77c59

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