Skip to content
Permalink
Browse files

[processing] Fix duplicate parameter

And throw warnings when other duplicate parameters are registered.

GRASS has a lot.
  • Loading branch information
nyalldawson committed Jan 28, 2018
1 parent 7e20fe4 commit 285bb0631b38ec485b3d8099a6a64e3f726d12cf
@@ -62,8 +62,6 @@ void QgsAddUniqueValueIndexAlgorithm::initAlgorithm( const QVariantMap & )
classedOutput->setCreateByDefault( true );
addParameter( classedOutput.release() );

addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Layer with index field" ), QgsProcessing::TypeVector, QVariant(), true ) );

std::unique_ptr< QgsProcessingParameterFeatureSink > summaryOutput = qgis::make_unique< QgsProcessingParameterFeatureSink >( QStringLiteral( "SUMMARY_OUTPUT" ), QObject::tr( "Class summary" ),
QgsProcessing::TypeVector, QVariant(), true );
summaryOutput->setCreateByDefault( false );
@@ -244,7 +244,10 @@ bool QgsProcessingAlgorithm::addParameter( QgsProcessingParameterDefinition *def

// check for duplicate named parameters
if ( QgsProcessingAlgorithm::parameterDefinition( definition->name() ) )
{
QgsLogger::warning( QStringLiteral( "Duplicate parameter %1 registered for alg %2" ).arg( definition->name(), id() ) );
return false;
}

if ( definition->isDestination() && mProvider )
{
@@ -75,7 +75,10 @@ bool QgsProcessingProvider::addAlgorithm( QgsProcessingAlgorithm *algorithm )
return false;

if ( mAlgorithms.contains( algorithm->name() ) )
{
QgsLogger::warning( QStringLiteral( "Duplicate algorithm name %1 for provider %2" ).arg( algorithm->name(), id() ) );
return false;
}

// init the algorithm - this allows direct querying of the algorithm's parameters
// and outputs from the provider's copy

0 comments on commit 285bb06

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