Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] Pass algorithm configuration on run
Because if it's not passed here, it's basically like writing it to /dev/null right from the beginning.
  • Loading branch information
m-kuhn committed Apr 9, 2018
1 parent 5b7b7be commit 9e8c995
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/core/processing/qgsprocessingalgorithm.sip.in
Expand Up @@ -276,7 +276,7 @@ Returns true if this algorithm generates HTML outputs.
%End

QVariantMap run( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok /Out/ = 0 ) const;
QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok /Out/ = 0, const QVariantMap &configuration = QVariantMap() ) const;
%Docstring
Executes the algorithm using the specified ``parameters``. This method internally
creates a copy of the algorithm before running it, so it is safe to call
Expand Down
2 changes: 1 addition & 1 deletion src/core/processing/models/qgsprocessingmodelalgorithm.cpp
Expand Up @@ -288,7 +288,7 @@ QVariantMap QgsProcessingModelAlgorithm::processAlgorithm( const QVariantMap &pa

bool ok = false;
std::unique_ptr< QgsProcessingAlgorithm > childAlg( child.algorithm()->create( child.configuration() ) );
QVariantMap results = childAlg->run( childParams, context, &modelFeedback, &ok );
QVariantMap results = childAlg->run( childParams, context, &modelFeedback, &ok, child.configuration() );
childAlg.reset( nullptr );
if ( !ok )
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/processing/qgsprocessingalgorithm.cpp
Expand Up @@ -371,9 +371,9 @@ bool QgsProcessingAlgorithm::hasHtmlOutputs() const
return false;
}

QVariantMap QgsProcessingAlgorithm::run( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok ) const
QVariantMap QgsProcessingAlgorithm::run( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok, const QVariantMap &configuration ) const
{
std::unique_ptr< QgsProcessingAlgorithm > alg( create() );
std::unique_ptr< QgsProcessingAlgorithm > alg( create( configuration ) );
if ( ok )
*ok = false;

Expand Down
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingalgorithm.h
Expand Up @@ -311,7 +311,7 @@ class CORE_EXPORT QgsProcessingAlgorithm
* if you need to run algorithms from a background thread, or use the QgsProcessingAlgRunnerTask class.
*/
QVariantMap run( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok SIP_OUT = nullptr ) const;
QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok SIP_OUT = nullptr, const QVariantMap &configuration = QVariantMap() ) const;

/**
* Prepares the algorithm for execution. This must be run in the main thread, and allows the algorithm
Expand Down

0 comments on commit 9e8c995

Please sign in to comment.