Skip to content
Permalink
Browse files

Allow specifying algorithm configuration when calling create

  • Loading branch information
nyalldawson committed Jul 10, 2017
1 parent 1e13d73 commit 9e8a11455382ca13de7a21d573dfcf477ba8b130
@@ -47,13 +47,19 @@ class QgsProcessingAlgorithm
virtual ~QgsProcessingAlgorithm();


QgsProcessingAlgorithm *create() const /Factory/;
QgsProcessingAlgorithm *create( const QVariantMap &configuration = QVariantMap() ) const /Factory/;
%Docstring
Creates a copy of the algorithm, ready for execution.

This method returns a new, preinitialized copy of the algorithm, ready for
executing.

The ``configuration`` argument allows passing of a map of configuration settings
to the algorithm, allowing it to dynamically adjust its initialized parameters
and outputs according to this configuration. This is generally used only for
algorithms in a model, allowing them to adjust their behavior at run time
according to some user configuration.

.. seealso:: initAlgorithm()
:rtype: QgsProcessingAlgorithm
%End
@@ -33,11 +33,11 @@ QgsProcessingAlgorithm::~QgsProcessingAlgorithm()
qDeleteAll( mOutputs );
}

QgsProcessingAlgorithm *QgsProcessingAlgorithm::create() const
QgsProcessingAlgorithm *QgsProcessingAlgorithm::create( const QVariantMap &configuration ) const
{
std::unique_ptr< QgsProcessingAlgorithm > creation( createInstance() );
creation->setProvider( provider() );
creation->initAlgorithm();
creation->initAlgorithm( configuration );
return creation.release();
}

@@ -77,9 +77,15 @@ class CORE_EXPORT QgsProcessingAlgorithm
* This method returns a new, preinitialized copy of the algorithm, ready for
* executing.
*
* The \a configuration argument allows passing of a map of configuration settings
* to the algorithm, allowing it to dynamically adjust its initialized parameters
* and outputs according to this configuration. This is generally used only for
* algorithms in a model, allowing them to adjust their behavior at run time
* according to some user configuration.
*
* \see initAlgorithm()
*/
QgsProcessingAlgorithm *create() const SIP_FACTORY;
QgsProcessingAlgorithm *create( const QVariantMap &configuration = QVariantMap() ) const SIP_FACTORY;

/**
* Returns the algorithm name, used for identifying the algorithm. This string

0 comments on commit 9e8a114

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