QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
|
Registry for various processing components, including providers, algorithms and various parameters and outputs. More...
#include <qgsprocessingregistry.h>
Signals | |
void | parameterTypeAdded (QgsProcessingParameterType *type) |
Emitted when a new parameter type has been added to the registry. | |
void | parameterTypeRemoved (QgsProcessingParameterType *type) |
Emitted when a parameter type has been removed from the registry and is about to be deleted. | |
void | providerAdded (const QString &id) |
Emitted when a provider has been added to the registry. | |
void | providerRemoved (const QString &id) |
Emitted when a provider is removed from the registry. | |
Public Member Functions | |
QgsProcessingRegistry (const QgsProcessingRegistry &other)=delete | |
QgsProcessingRegistry (QObject *parent=nullptr) | |
Constructor for QgsProcessingRegistry. | |
~QgsProcessingRegistry () override | |
void | addAlgorithmAlias (const QString &aliasId, const QString &actualId) |
Adds a new alias to an existing algorithm. | |
bool | addParameterType (QgsProcessingParameterType *type) |
Register a new parameter type for processing. | |
bool | addProvider (QgsProcessingProvider *provider) |
Add a processing provider to the registry. | |
const QgsProcessingAlgorithm * | algorithmById (const QString &id) const |
Finds an algorithm by its ID. | |
QgsProcessingAlgorithmInformation | algorithmInformation (const QString &id) const |
Returns basic algorithm information for the algorithm with matching ID. | |
QList< const QgsProcessingAlgorithm * > | algorithms () const |
Returns a list of all available algorithms from registered providers. | |
QgsProcessingAlgorithm * | createAlgorithmById (const QString &id, const QVariantMap &configuration=QVariantMap()) const |
Creates a new instance of an algorithm by its ID. | |
QgsProcessingRegistry & | operator= (const QgsProcessingRegistry &other)=delete |
QgsProcessingParameterType * | parameterType (const QString &id) const |
Returns the parameter type registered for id. | |
QList< QgsProcessingParameterType * > | parameterTypes () const |
Returns a list with all known parameter types. | |
QgsProcessingProvider * | providerById (const QString &id) const |
Returns a matching provider by provider ID. | |
QList< QgsProcessingProvider * > | providers () const |
Gets list of available providers. | |
void | removeParameterType (QgsProcessingParameterType *type) |
Unregister a custom parameter type from processing. | |
bool | removeProvider (const QString &providerId) |
Removes a provider implementation from the registry (the provider object is deleted). | |
bool | removeProvider (QgsProcessingProvider *provider) |
Removes a provider implementation from the registry (the provider object is deleted). | |
Friends | |
class | TestQgsProcessing |
Registry for various processing components, including providers, algorithms and various parameters and outputs.
QgsProcessingRegistry is not usually directly created, but rather accessed through QgsApplication::processingRegistry().
Definition at line 56 of file qgsprocessingregistry.h.
QgsProcessingRegistry::QgsProcessingRegistry | ( | QObject * | parent = nullptr | ) |
Constructor for QgsProcessingRegistry.
Definition at line 29 of file qgsprocessingregistry.cpp.
|
override |
Definition at line 87 of file qgsprocessingregistry.cpp.
|
delete |
void QgsProcessingRegistry::addAlgorithmAlias | ( | const QString & | aliasId, |
const QString & | actualId | ||
) |
Adds a new alias to an existing algorithm.
This allows algorithms to be referred to by a different provider ID and algorithm name to their actual underlying provider and algorithm name. It provides a mechanism to allow algorithms to be moved between providers without breaking existing scripts or plugins.
The aliasId argument specifies the "fake" algorithm id (eg "fake_provider:fake_alg") by which the algorithm can be referred to, and the actualId argument specifies the real algorithm ID for the algorithm.
Definition at line 257 of file qgsprocessingregistry.cpp.
bool QgsProcessingRegistry::addParameterType | ( | QgsProcessingParameterType * | type | ) |
Register a new parameter type for processing.
Ownership is transferred to the registry. Will emit parameterTypeAdded.
Definition at line 262 of file qgsprocessingregistry.cpp.
bool QgsProcessingRegistry::addProvider | ( | QgsProcessingProvider * | provider | ) |
Add a processing provider to the registry.
Ownership of the provider is transferred to the registry, and the provider's parent will be set to the registry. Returns false
if the provider could not be added (eg if a provider with a duplicate ID already exists in the registry). Adding a provider to the registry automatically triggers the providers QgsProcessingProvider::load() method to populate the provider with algorithms.
Definition at line 103 of file qgsprocessingregistry.cpp.
const QgsProcessingAlgorithm * QgsProcessingRegistry::algorithmById | ( | const QString & | id | ) | const |
Finds an algorithm by its ID.
If no matching algorithm is found, nullptr
is returned.
Definition at line 201 of file qgsprocessingregistry.cpp.
QgsProcessingAlgorithmInformation QgsProcessingRegistry::algorithmInformation | ( | const QString & | id | ) | const |
Returns basic algorithm information for the algorithm with matching ID.
This method uses an internal cache to ensure that information is quickly returned and is suitable for calling many times.
Definition at line 185 of file qgsprocessingregistry.cpp.
QList< const QgsProcessingAlgorithm * > QgsProcessingRegistry::algorithms | ( | ) | const |
Returns a list of all available algorithms from registered providers.
Definition at line 174 of file qgsprocessingregistry.cpp.
QgsProcessingAlgorithm * QgsProcessingRegistry::createAlgorithmById | ( | const QString & | id, |
const QVariantMap & | configuration = QVariantMap() |
||
) | const |
Creates a new instance of an algorithm by its ID.
If no matching algorithm is found, nullptr
is returned. Callers take responsibility for deleting the returned object.
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.
Definition at line 247 of file qgsprocessingregistry.cpp.
|
delete |
QgsProcessingParameterType * QgsProcessingRegistry::parameterType | ( | const QString & | id | ) | const |
Returns the parameter type registered for id.
Definition at line 288 of file qgsprocessingregistry.cpp.
|
signal |
Emitted when a new parameter type has been added to the registry.
|
signal |
Emitted when a parameter type has been removed from the registry and is about to be deleted.
QList< QgsProcessingParameterType * > QgsProcessingRegistry::parameterTypes | ( | ) | const |
Returns a list with all known parameter types.
Definition at line 293 of file qgsprocessingregistry.cpp.
|
signal |
Emitted when a provider has been added to the registry.
QgsProcessingProvider * QgsProcessingRegistry::providerById | ( | const QString & | id | ) | const |
Returns a matching provider by provider ID.
Definition at line 161 of file qgsprocessingregistry.cpp.
|
signal |
Emitted when a provider is removed from the registry.
|
inline |
Gets list of available providers.
Definition at line 75 of file qgsprocessingregistry.h.
void QgsProcessingRegistry::removeParameterType | ( | QgsProcessingParameterType * | type | ) |
Unregister a custom parameter type from processing.
The type will be deleted. Will emit parameterTypeRemoved.
Definition at line 281 of file qgsprocessingregistry.cpp.
bool QgsProcessingRegistry::removeProvider | ( | const QString & | providerId | ) |
Removes a provider implementation from the registry (the provider object is deleted).
Returns false
if the provider could not be removed (eg provider does not exist in the registry).
Definition at line 155 of file qgsprocessingregistry.cpp.
bool QgsProcessingRegistry::removeProvider | ( | QgsProcessingProvider * | provider | ) |
Removes a provider implementation from the registry (the provider object is deleted).
Returns false
if the provider could not be removed (eg provider does not exist in the registry).
Definition at line 135 of file qgsprocessingregistry.cpp.
|
friend |
Definition at line 249 of file qgsprocessingregistry.h.