From dc77c59a4519f6d3de7f94a7bc10d01f7be51c55 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 11 Jun 2018 09:02:47 +1000 Subject: [PATCH] Move body of reclassifyValue to header so it can be optimised --- src/analysis/processing/qgsreclassifyutils.cpp | 14 +------------- src/analysis/processing/qgsreclassifyutils.h | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/analysis/processing/qgsreclassifyutils.cpp b/src/analysis/processing/qgsreclassifyutils.cpp index e9b909322419..da2ffd198891 100644 --- a/src/analysis/processing/qgsreclassifyutils.cpp +++ b/src/analysis/processing/qgsreclassifyutils.cpp @@ -82,19 +82,7 @@ void QgsReclassifyUtils::reclassify( const QVectorsetEditable( false ); } -double QgsReclassifyUtils::reclassifyValue( const QVector &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 diff --git a/src/analysis/processing/qgsreclassifyutils.h b/src/analysis/processing/qgsreclassifyutils.h index 0888bf734bda..7b47623d18ce 100644 --- a/src/analysis/processing/qgsreclassifyutils.h +++ b/src/analysis/processing/qgsreclassifyutils.h @@ -23,6 +23,7 @@ #include "qgis.h" #include "qgis_analysis.h" #include "qgsrasterrange.h" +#include 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