QgsProcessingProvider class
Abstract base class for processing providers.
Contents
An algorithm provider is a set of related algorithms, typically from the same external application or related to a common area of analysis.
Derived classes
- class QgsNativeAlgorithms
- Native c++ processing algorithm provider.
Constructors, destructors, conversion operators
- QgsProcessingProvider(QObject* parent = nullptr)
- Constructor for QgsProcessingProvider.
- QgsProcessingProvider(const QgsProcessingProvider& other) deleted
- Providers cannot be copied.
Public functions
- auto algorithm(const QString& name) const -> const QgsProcessingAlgorithm*
- Returns the matching algorithm by name, or a nullptr if no matching algorithm is contained by this provider.
- auto algorithms() const -> QList<const QgsProcessingAlgorithm*>
- Returns a list of algorithms supplied by this provider.
- auto canBeActivated() const -> bool virtual
- Returns true if the provider can be activated, or false if it cannot be activated (e.g.
- auto defaultRasterFileExtension() const -> QString virtual
- Returns the default file extension to use for raster outputs created by the provider.
- auto defaultVectorFileExtension(bool hasGeometry = true) const -> QString virtual
- Returns the default file extension to use for vector outputs created by the provider.
- auto helpId() const -> QString virtual
- Returns the provider help id string, used for creating QgsHelp urls for algorithms belong to this provider.
- auto icon() const -> QIcon virtual
- Returns an icon for the provider.
- auto id() const -> QString pure virtual
- Returns the unique provider id, used for identifying the provider.
- auto isActive() const -> bool virtual
- Returns true if the provider is active and able to run algorithms.
- auto load() -> bool virtual
- Loads the provider.
- auto longName() const -> QString virtual
- Returns the longer version of the provider name, which can include extra details such as version numbers.
- auto name() const -> QString pure virtual
- Returns the provider name, which is used to describe the provider within the GUI.
- auto operator=(const QgsProcessingProvider& other) -> QgsProcessingProvider& deleted
- Providers cannot be copied.
- void refreshAlgorithms()
- Refreshes the algorithms available from the provider, causing it to re-populate with all associated algorithms.
- auto supportedOutputRasterLayerExtensions() const -> QStringList virtual
- Returns a list of the raster format file extensions supported by this provider.
- auto supportedOutputTableExtensions() const -> QStringList virtual
- Returns a list of the table (geometry-less vector layers) file extensions supported by this provider.
- auto supportedOutputVectorLayerExtensions() const -> QStringList virtual
- Returns a list of the vector format file extensions supported by this provider.
- auto supportsNonFileBasedOutput() const -> bool virtual
- Returns true if the provider supports non-file based outputs (such as memory layers or direct database outputs).
- auto svgIconPath() const -> QString virtual
- Returns a path to an SVG version of the provider's icon.
- void unload() virtual
- Unloads the provider.
Signals
- void algorithmsLoaded()
- Emitted when the provider has loaded (or refreshed) its list of available algorithms.
Protected functions
- auto addAlgorithm(QgsProcessingAlgorithm* algorithm) -> bool
- Adds an algorithm to the provider.
- void loadAlgorithms() pure virtual
- Loads all algorithms belonging to this provider.
Function documentation
const QgsProcessingAlgorithm* QgsProcessingProvider:: algorithm(const QString& name) const
Returns the matching algorithm by name, or a nullptr if no matching algorithm is contained by this provider.
QList<const QgsProcessingAlgorithm*> QgsProcessingProvider:: algorithms() const
Returns a list of algorithms supplied by this provider.
bool QgsProcessingProvider:: canBeActivated() const virtual
Returns true if the provider can be activated, or false if it cannot be activated (e.g.
due to missing external dependencies).
QString QgsProcessingProvider:: defaultRasterFileExtension() const virtual
Returns the default file extension to use for raster outputs created by the provider.
The default implementation returns the user's default Processing raster output format setting, if it's supported by the provider (see supportedOutputRasterLayerExtensions()). Otherwise the first reported supported raster format will be used.
QString QgsProcessingProvider:: defaultVectorFileExtension(bool hasGeometry = true) const virtual
Returns the default file extension to use for vector outputs created by the provider.
If hasGeometry is true then the output file format must have support for geometry. If hasGeometry is false then non-spatial formats can be used.
The default implementation returns the user's default Processing vector output format setting, if it's supported by the provider (see supportedOutputVectorLayerExtensions()). Otherwise the first reported supported vector format will be used.
QIcon QgsProcessingProvider:: icon() const virtual
Returns an icon for the provider.
QString QgsProcessingProvider:: id() const pure virtual
Returns the unique provider id, used for identifying the provider.
This string should be a unique, short, character only string, eg "qgis" or "gdal". This string should not be localised.
bool QgsProcessingProvider:: load() virtual
Loads the provider.
| Returns | true if provider could be successfully loaded |
|---|
This will be called when the plugin is being loaded, and any general setup actions should occur in an overridden version of this method. Subclasses should not individually load any algorithms in their load() implementations, as that must occur within the loadAlgorithms() method. Instead, subclasses should call refreshAlgorithms() from any overloaded load() method to trigger an initial load of the provider's algorithms.
QString QgsProcessingProvider:: longName() const virtual
Returns the longer version of the provider name, which can include extra details such as version numbers.
E.g. "Lastools LIDAR tools (version 2.2.1)". This string should be localised.
The default implementation returns the same string as name().
QString QgsProcessingProvider:: name() const pure virtual
Returns the provider name, which is used to describe the provider within the GUI.
This string should be short (e.g. "Lastools") and localised.
QStringList QgsProcessingProvider:: supportedOutputRasterLayerExtensions() const virtual
Returns a list of the raster format file extensions supported by this provider.
QStringList QgsProcessingProvider:: supportedOutputTableExtensions() const virtual
Returns a list of the table (geometry-less vector layers) file extensions supported by this provider.
By default this is the same as supportedOutputVectorLayerExtensions(). Providers which utilize different formats for geometry-less layers can override this method to return a different list of supported formats.
QStringList QgsProcessingProvider:: supportedOutputVectorLayerExtensions() const virtual
Returns a list of the vector format file extensions supported by this provider.
bool QgsProcessingProvider:: supportsNonFileBasedOutput() const virtual
Returns true if the provider supports non-file based outputs (such as memory layers or direct database outputs).
If a provider returns false for this method than it indicates that none of the outputs from any of the provider's algorithms have support for non-file based outputs. Returning true indicates that the algorithm's parameters will each individually declare their non-file based support.
The default behavior for providers is to support non-file based outputs, and most providers which rely solely on QGIS API (and which do not depend on third-party scripts or external dependencies) will automatically support this.
QString QgsProcessingProvider:: svgIconPath() const virtual
Returns a path to an SVG version of the provider's icon.
void QgsProcessingProvider:: unload() virtual
Unloads the provider.
Any tear-down steps required by the provider should be implemented here.
void QgsProcessingProvider:: algorithmsLoaded() signal
Emitted when the provider has loaded (or refreshed) its list of available algorithms.
bool QgsProcessingProvider:: addAlgorithm(QgsProcessingAlgorithm* algorithm) protected
Adds an algorithm to the provider.
Ownership of the algorithm is transferred to the provider.
void QgsProcessingProvider:: loadAlgorithms() pure virtual protected
Loads all algorithms belonging to this provider.
Subclasses should implement this, calling addAlgorithm() to register all their associated algorithms.