QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
Abstract base class for processing providers. More...
#include <qgsprocessingprovider.h>
Public Types | |
enum | Flag { FlagDeemphasiseSearchResults = 1 << 1 } |
Flags indicating how and when an provider operates and should be exposed to users. More... | |
Signals | |
void | algorithmsLoaded () |
Emitted when the provider has loaded (or refreshed) its list of available algorithms. More... | |
Public Member Functions | |
QgsProcessingProvider (const QgsProcessingProvider &other)=delete | |
Providers cannot be copied. More... | |
QgsProcessingProvider (QObject *parent=nullptr) | |
Constructor for QgsProcessingProvider. More... | |
~QgsProcessingProvider () override | |
const QgsProcessingAlgorithm * | algorithm (const QString &name) const |
Returns the matching algorithm by name, or nullptr if no matching algorithm is contained by this provider. More... | |
QList< const QgsProcessingAlgorithm * > | algorithms () const |
Returns a list of algorithms supplied by this provider. More... | |
virtual bool | canBeActivated () const |
Returns true if the provider can be activated, or false if it cannot be activated (e.g. More... | |
virtual QString | defaultRasterFileExtension () const |
Returns the default file extension to use for raster outputs created by the provider. More... | |
virtual QString | defaultVectorFileExtension (bool hasGeometry=true) const |
Returns the default file extension to use for vector outputs created by the provider. More... | |
virtual Flags | flags () const |
Returns the flags indicating how and when the provider operates and should be exposed to users. More... | |
virtual QString | helpId () const |
Returns the provider help id string, used for creating QgsHelp urls for algorithms belong to this provider. More... | |
virtual QIcon | icon () const |
Returns an icon for the provider. More... | |
virtual QString | id () const =0 |
Returns the unique provider id, used for identifying the provider. More... | |
virtual bool | isActive () const |
Returns true if the provider is active and able to run algorithms. More... | |
virtual bool | isSupportedOutputValue (const QVariant &outputValue, const QgsProcessingDestinationParameter *parameter, QgsProcessingContext &context, QString &error) const |
Returns true if the specified outputValue is of a supported file format for the given destination parameter. More... | |
virtual bool | load () |
Loads the provider. More... | |
virtual QString | longName () const |
Returns the longer version of the provider name, which can include extra details such as version numbers. More... | |
virtual QString | name () const =0 |
Returns the provider name, which is used to describe the provider within the GUI. More... | |
QgsProcessingProvider & | operator= (const QgsProcessingProvider &other)=delete |
Providers cannot be copied. More... | |
void | refreshAlgorithms () |
Refreshes the algorithms available from the provider, causing it to re-populate with all associated algorithms. More... | |
virtual QStringList | supportedOutputRasterLayerExtensions () const |
Returns a list of the raster format file extensions supported by this provider. More... | |
virtual QStringList | supportedOutputTableExtensions () const |
Returns a list of the table (geometry-less vector layers) file extensions supported by this provider. More... | |
virtual QStringList | supportedOutputVectorLayerExtensions () const |
Returns a list of the vector format file extensions supported by this provider. More... | |
virtual bool | supportsNonFileBasedOutput () const |
Returns true if the provider supports non-file based outputs (such as memory layers or direct database outputs). More... | |
virtual QString | svgIconPath () const |
Returns a path to an SVG version of the provider's icon. More... | |
virtual void | unload () |
Unloads the provider. More... | |
virtual QString | versionInfo () const |
Returns a version information string for the provider, or an empty string if this is not applicable (e.g. More... | |
virtual QString | warningMessage () const |
Returns an optional warning message to show users when running algorithms from this provider. More... | |
Protected Member Functions | |
bool | addAlgorithm (QgsProcessingAlgorithm *algorithm) |
Adds an algorithm to the provider. More... | |
virtual void | loadAlgorithms ()=0 |
Loads all algorithms belonging to this provider. More... | |
Abstract base class for processing providers.
An algorithm provider is a set of related algorithms, typically from the same external application or related to a common area of analysis.
Definition at line 35 of file qgsprocessingprovider.h.
Flags indicating how and when an provider operates and should be exposed to users.
Enumerator | |
---|---|
FlagDeemphasiseSearchResults | Algorithms should be de-emphasised in the search results when searching for algorithms. Use for low-priority providers or those with substantial known issues. |
Definition at line 45 of file qgsprocessingprovider.h.
QgsProcessingProvider::QgsProcessingProvider | ( | QObject * | parent = nullptr | ) |
Constructor for QgsProcessingProvider.
Definition at line 24 of file qgsprocessingprovider.cpp.
|
override |
Definition at line 29 of file qgsprocessingprovider.cpp.
|
delete |
Providers cannot be copied.
|
protected |
Adds an algorithm to the provider.
Ownership of the algorithm is transferred to the provider.
Definition at line 90 of file qgsprocessingprovider.cpp.
const QgsProcessingAlgorithm * QgsProcessingProvider::algorithm | ( | const QString & | name | ) | const |
Returns the matching algorithm by name, or nullptr
if no matching algorithm is contained by this provider.
Definition at line 85 of file qgsprocessingprovider.cpp.
QList< const QgsProcessingAlgorithm * > QgsProcessingProvider::algorithms | ( | ) | const |
Returns a list of algorithms supplied by this provider.
Definition at line 80 of file qgsprocessingprovider.cpp.
|
signal |
Emitted when the provider has loaded (or refreshed) its list of available algorithms.
|
inlinevirtual |
Returns true
if the provider can be activated, or false
if it cannot be activated (e.g.
due to missing external dependencies).
Definition at line 134 of file qgsprocessingprovider.h.
|
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.
Definition at line 217 of file qgsprocessingprovider.cpp.
|
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.
Definition at line 194 of file qgsprocessingprovider.cpp.
|
virtual |
Returns the flags indicating how and when the provider operates and should be exposed to users.
Default is no flags.
Definition at line 44 of file qgsprocessingprovider.cpp.
|
virtual |
Returns the provider help id string, used for creating QgsHelp urls for algorithms belong to this provider.
By default, this returns an empty string, meaning that no QgsHelp url should be created for the provider's algorithms.
Reimplemented in QgsNativeAlgorithms.
Definition at line 49 of file qgsprocessingprovider.cpp.
|
virtual |
Returns an icon for the provider.
Reimplemented in QgsNativeAlgorithms.
Definition at line 34 of file qgsprocessingprovider.cpp.
|
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.
Implemented in QgsNativeAlgorithms.
|
inlinevirtual |
Returns true
if the provider is active and able to run algorithms.
Definition at line 151 of file qgsprocessingprovider.h.
|
virtual |
Returns true
if the specified outputValue is of a supported file format for the given destination parameter.
If the output value is not supported, error will be set to a descriptive message explaining why.
Definition at line 120 of file qgsprocessingprovider.cpp.
|
inlinevirtual |
Loads the provider.
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.
true
if provider could be successfully loaded Definition at line 245 of file qgsprocessingprovider.h.
|
protectedpure virtual |
Loads all algorithms belonging to this provider.
Subclasses should implement this, calling addAlgorithm() to register all their associated algorithms.
Implemented in QgsNativeAlgorithms.
|
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().
Definition at line 54 of file qgsprocessingprovider.cpp.
|
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.
Implemented in QgsNativeAlgorithms.
|
delete |
Providers cannot be copied.
void QgsProcessingProvider::refreshAlgorithms | ( | ) |
Refreshes the algorithms available from the provider, causing it to re-populate with all associated algorithms.
Definition at line 69 of file qgsprocessingprovider.cpp.
|
virtual |
Returns a list of the raster format file extensions supported by this provider.
Definition at line 64 of file qgsprocessingprovider.cpp.
|
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.
Definition at line 115 of file qgsprocessingprovider.cpp.
|
virtual |
Returns a list of the vector format file extensions supported by this provider.
Definition at line 110 of file qgsprocessingprovider.cpp.
|
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.
Reimplemented in QgsNativeAlgorithms.
Definition at line 239 of file qgsprocessingprovider.cpp.
|
virtual |
Returns a path to an SVG version of the provider's icon.
Reimplemented in QgsNativeAlgorithms.
Definition at line 39 of file qgsprocessingprovider.cpp.
|
inlinevirtual |
Unloads the provider.
Any tear-down steps required by the provider should be implemented here.
Definition at line 251 of file qgsprocessingprovider.h.
|
virtual |
Returns a version information string for the provider, or an empty string if this is not applicable (e.g.
for inbuilt Processing providers).
For plugin based providers, this should return the plugin's version identifier.
Definition at line 59 of file qgsprocessingprovider.cpp.
|
inlinevirtual |
Returns an optional warning message to show users when running algorithms from this provider.
This can be used to return a translated warning message which should be shown to users of this provider. It's intended for use in cases such as a provider which relies on a 3rd-party backend, where the version of the backend software is not officially supported, or for alerting users to providers in a "beta" or "untrustworthy" state.
Definition at line 146 of file qgsprocessingprovider.h.