Skip to content
Permalink
Browse files

Remove duplicated code

The input check was already done before entering
in the GPU branch
  • Loading branch information
elpaso committed Dec 1, 2018
1 parent e01c162 commit 5ef87371aa62ff2e1abec90d460c38ba1faaf0a7
Showing with 0 additions and 23 deletions.
  1. +0 −23 src/analysis/raster/qgsrastercalculator.cpp
@@ -315,32 +315,9 @@ QgsRasterCalculator::Result QgsRasterCalculator::processCalculation( QgsFeedback
#ifdef HAVE_OPENCL
QgsRasterCalculator::Result QgsRasterCalculator::processCalculationGPU( QgsFeedback *feedback )
{
//prepare search string / tree
std::unique_ptr< QgsRasterCalcNode > calcNode( QgsRasterCalcNode::parseRasterCalcString( mFormulaString, mLastError ) );
if ( !calcNode )
{
//error
return ParserError;
}

QString cExpression( calcNode->toString( true ) );

// Safety check
for ( const auto &r : mRasterEntries )
{
if ( !r.raster ) // no raster layer in entry
{
mLastError = QObject::tr( "No raster layer for entry %1" ).arg( r.ref );
return InputLayerError;
}

if ( r.bandNumber <= 0 || r.bandNumber > r.raster->bandCount() )
{
mLastError = QObject::tr( "Band number %1 is not valid for entry %2" ).arg( r.bandNumber ).arg( r.ref );
return BandError;
}
}

QList<const QgsRasterCalcNode *> nodeList( calcNode->findNodes( QgsRasterCalcNode::Type::tRasterRef ) );
QSet<QString> capturedTexts;
for ( const auto &r : qgis::as_const( nodeList ) )

0 comments on commit 5ef8737

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