mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Allow specifying algorithm configuration when calling create
This commit is contained in:
parent
1e13d733c2
commit
9e8a114553
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user