71 if ( mProviders.contains( provider->
id() ) )
73 QgsLogger::warning( QStringLiteral(
"Duplicate provider %1 registered" ).arg( provider->
id() ) );
78 if ( !provider->
load() )
85 provider->setParent(
this );
86 mProviders[ provider->
id()] = provider;
96 QString
id = provider->
id();
98 if ( !mProviders.contains(
id ) )
103 delete mProviders.take(
id );
116 return mProviders.value(
id,
nullptr );
121 QList< const QgsProcessingAlgorithm * > algs;
122 QMap<QString, QgsProcessingProvider *>::const_iterator it = mProviders.constBegin();
123 for ( ; it != mProviders.constEnd(); ++it )
125 algs.append( it.value()->algorithms() );
132 QMap<QString, QgsProcessingProvider *>::const_iterator it = mProviders.constBegin();
133 for ( ; it != mProviders.constEnd(); ++it )
136 if ( alg->
id() == id )
143 if (
id.startsWith( QStringLiteral(
"qgis:" ) ) )
145 QString newId = QStringLiteral(
"native:" ) +
id.mid( 5 );
157 std::unique_ptr< QgsProcessingAlgorithm > creation( alg->
create( configuration ) );
158 return creation.release();
163 if ( !mParameterTypes.contains( type->
id() ) )
165 mParameterTypes.insert( type->
id(), type );
171 QgsLogger::warning( QStringLiteral(
"Duplicate parameter type %1 (\"%2\") registered" ).arg( type->
id(), type->
name() ) );
173 if ( mParameterTypes.value( type->
id() ) != type )
182 mParameterTypes.remove( type->
id() );
189 return mParameterTypes.value(
id );
194 return mParameterTypes.values();
A feature sink parameter for Processing algorithms.
A vector layer destination parameter, for specifying the destination path for a vector layer created ...
bool removeProvider(QgsProcessingProvider *provider)
Removes a provider implementation from the registry (the provider object is deleted).
QString id() const
Returns the unique ID for the algorithm, which is a combination of the algorithm provider's ID and th...
void providerAdded(const QString &id)
Emitted when a provider has been added to the registry.
~QgsProcessingRegistry() override
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
QgsProcessingAlgorithm * create(const QVariantMap &configuration=QVariantMap()) const
Creates a copy of the algorithm, ready for execution.
static void warning(const QString &msg)
Goes to qWarning.
virtual QString id() const =0
A static id for this type which will be used for storing this parameter type.
A folder destination parameter, for specifying the destination path for a folder created by the algor...
void removeParameterType(QgsProcessingParameterType *type)
Unregister a custom parameter type from processing.
A numeric range parameter for processing algorithms.
An expression parameter for processing algorithms.
Abstract base class for processing providers.
const QgsProcessingAlgorithm * algorithmById(const QString &id) const
Finds an algorithm by its ID.
A vector layer or feature source field parameter for processing algorithms.
QgsProcessingParameterType * parameterType(const QString &id) const
Returns the parameter type registered for id.
void parameterTypeAdded(QgsProcessingParameterType *type)
Emitted when a new parameter type has been added to the registry.
A numeric parameter for processing algorithms.
A distance parameter for processing algorithms.
Abstract base class for processing algorithms.
A string parameter for processing algorithms.
bool addParameterType(QgsProcessingParameterType *type)
Register a new parameter type for processing.
QgsProcessingProvider * providerById(const QString &id)
Returns a matching provider by provider ID.
A vector layer parameter for processing algorithms.
A boolean parameter for processing algorithms.
A generic map layer parameter for processing algorithms.
An input file or folder parameter for processing algorithms.
void providerRemoved(const QString &id)
Emitted when a provider is removed from the registry.
A raster layer parameter for processing algorithms.
QList< const QgsProcessingAlgorithm * > algorithms() const
Returns a list of all available algorithms from registered providers.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
virtual QString id() const =0
Returns the unique provider id, used for identifying the provider.
virtual QString name() const =0
A human readable and translatable short name for this parameter type.
QgsProcessingRegistry(QObject *parent=nullptr)
Constructor for QgsProcessingRegistry.
virtual bool load()
Loads the provider.
QgsProcessingAlgorithm * createAlgorithmById(const QString &id, const QVariantMap &configuration=QVariantMap()) const
Creates a new instance of an algorithm by its ID.
A point parameter for processing algorithms.
bool addProvider(QgsProcessingProvider *provider)
Add a processing provider to the registry.
A table (matrix) parameter for processing algorithms.
A parameter for processing algorithms which accepts multiple map layers.
A crs parameter for processing algorithms.
Makes metadata of processing parameters available.
void parameterTypeRemoved(QgsProcessingParameterType *type)
Emitted when a parameter type has been removed from the registry and is about to be deleted...
An input feature source (such as vector layers) parameter for processing algorithms.
A rectangular map extent parameter for processing algorithms.
QList< QgsProcessingParameterType * > parameterTypes() const
Returns a list with all known parameter types.
An enum based parameter for processing algorithms, allowing for selection from predefined values...
virtual void unload()
Unloads the provider.
A raster band parameter for Processing algorithms.