QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | List of all members
QgsProcessingProvider Class Referenceabstract

Abstract base class for processing providers. More...

#include <qgsprocessingprovider.h>

Inheritance diagram for QgsProcessingProvider:
Inheritance graph
[legend]

Signals

void algorithmsLoaded ()
 Emitted when the provider has loaded (or refreshed) its list of available algorithms.
 

Public Member Functions

 QgsProcessingProvider (const QgsProcessingProvider &other)=delete
 
 QgsProcessingProvider (QObject *parent=nullptr)
 Constructor for QgsProcessingProvider.
 
 ~QgsProcessingProvider () override
 
const QgsProcessingAlgorithmalgorithm (const QString &name) const
 Returns the matching algorithm by name, or nullptr if no matching algorithm is contained by this provider.
 
QList< const QgsProcessingAlgorithm * > algorithms () const
 Returns a list of algorithms supplied by this provider.
 
virtual bool canBeActivated () const
 Returns true if the provider can be activated, or false if it cannot be activated (e.g.
 
virtual QString defaultPointCloudFileExtension () const
 Returns the default file extension to use for point cloud outputs created by the provider.
 
virtual QString defaultRasterFileExtension () const
 Returns the default file extension to use for raster outputs created by the provider.
 
virtual QString defaultVectorFileExtension (bool hasGeometry=true) const
 Returns the default file extension to use for vector outputs created by the provider.
 
virtual QString defaultVectorTileFileExtension () const
 Returns the default file extension to use for vector tile outputs created by the provider.
 
virtual Qgis::ProcessingProviderFlags flags () const
 Returns the flags indicating how and when the provider operates and should be exposed to users.
 
virtual QString helpId () const
 Returns the provider help id string, used for creating QgsHelp urls for algorithms belong to this provider.
 
virtual QIcon icon () const
 Returns an icon for the provider.
 
virtual QString id () const =0
 Returns the unique provider id, used for identifying the provider.
 
virtual bool isActive () const
 Returns true if the provider is active and able to run algorithms.
 
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.
 
virtual bool load ()
 Loads the provider.
 
virtual QString longName () const
 Returns the longer version of the provider name, which can include extra details such as version numbers.
 
virtual QString name () const =0
 Returns the provider name, which is used to describe the provider within the GUI.
 
QgsProcessingProvideroperator= (const QgsProcessingProvider &other)=delete
 
void refreshAlgorithms ()
 Refreshes the algorithms available from the provider, causing it to re-populate with all associated algorithms.
 
virtual QStringList supportedOutputPointCloudLayerExtensions () const
 Returns a list of the point cloud format file extensions supported by this provider.
 
virtual QStringList supportedOutputRasterLayerExtensions () const
 Returns a list of the raster format file extensions supported by this provider.
 
virtual QStringList supportedOutputTableExtensions () const
 Returns a list of the table (geometry-less vector layers) file extensions supported by this provider.
 
virtual QStringList supportedOutputVectorLayerExtensions () const
 Returns a list of the vector format file extensions supported by this provider.
 
virtual QStringList supportedOutputVectorTileLayerExtensions () const
 Returns a list of the vector tile format file extensions supported by this provider.
 
virtual bool supportsNonFileBasedOutput () const
 Returns true if the provider supports non-file based outputs (such as memory layers or direct database outputs).
 
virtual QString svgIconPath () const
 Returns a path to an SVG version of the provider's icon.
 
virtual void unload ()
 Unloads the provider.
 
virtual QString versionInfo () const
 Returns a version information string for the provider, or an empty string if this is not applicable (e.g.
 
virtual QString warningMessage () const
 Returns an optional warning message to show users when running algorithms from this provider.
 

Protected Member Functions

bool addAlgorithm (QgsProcessingAlgorithm *algorithm)
 Adds an algorithm to the provider.
 
virtual void loadAlgorithms ()=0
 Loads all algorithms belonging to this provider.
 

Detailed Description

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 34 of file qgsprocessingprovider.h.

Constructor & Destructor Documentation

◆ QgsProcessingProvider() [1/2]

QgsProcessingProvider::QgsProcessingProvider ( QObject *  parent = nullptr)

Constructor for QgsProcessingProvider.

Definition at line 25 of file qgsprocessingprovider.cpp.

◆ ~QgsProcessingProvider()

QgsProcessingProvider::~QgsProcessingProvider ( )
override

Definition at line 30 of file qgsprocessingprovider.cpp.

◆ QgsProcessingProvider() [2/2]

QgsProcessingProvider::QgsProcessingProvider ( const QgsProcessingProvider other)
delete

Member Function Documentation

◆ addAlgorithm()

bool QgsProcessingProvider::addAlgorithm ( QgsProcessingAlgorithm algorithm)
protected

Adds an algorithm to the provider.

Ownership of the algorithm is transferred to the provider.

Definition at line 101 of file qgsprocessingprovider.cpp.

◆ algorithm()

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.

See also
algorithms()

Definition at line 96 of file qgsprocessingprovider.cpp.

◆ algorithms()

QList< const QgsProcessingAlgorithm * > QgsProcessingProvider::algorithms ( ) const

Returns a list of algorithms supplied by this provider.

See also
algorithm()

Definition at line 91 of file qgsprocessingprovider.cpp.

◆ algorithmsLoaded

void QgsProcessingProvider::algorithmsLoaded ( )
signal

Emitted when the provider has loaded (or refreshed) its list of available algorithms.

See also
refreshAlgorithms()

◆ canBeActivated()

virtual bool QgsProcessingProvider::canBeActivated ( ) const
inlinevirtual

Returns true if the provider can be activated, or false if it cannot be activated (e.g.

due to missing external dependencies).

See also
isActive()

Definition at line 121 of file qgsprocessingprovider.h.

◆ defaultPointCloudFileExtension()

QString QgsProcessingProvider::defaultPointCloudFileExtension ( ) const
virtual

Returns the default file extension to use for point cloud outputs created by the provider.

The default implementation returns the user's default Processing point cloud output format setting, if it's supported by the provider (see supportedOutputPointCloudLayerExtensions()). Otherwise the first reported supported point cloud format will be used.

See also
supportedOutputPointCloudLayerExtensions()
defaultVectorFileExtension()
defaultRasterFileExtension()
defaultVectorTileFileExtension()
Since
QGIS 3.24

Definition at line 270 of file qgsprocessingprovider.cpp.

◆ defaultRasterFileExtension()

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.

See also
supportedOutputRasterLayerExtensions()
defaultVectorFileExtension()
defaultPointCloudFileExtension()
defaultVectorTileFileExtension()

Definition at line 249 of file qgsprocessingprovider.cpp.

◆ defaultVectorFileExtension()

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.

See also
supportedOutputVectorLayerExtensions()
defaultRasterFileExtension()
defaultPointCloudFileExtension()
defaultVectorTileFileExtension()

Definition at line 227 of file qgsprocessingprovider.cpp.

◆ defaultVectorTileFileExtension()

QString QgsProcessingProvider::defaultVectorTileFileExtension ( ) const
virtual

Returns the default file extension to use for vector tile outputs created by the provider.

The default implementation returns the user's default Processing vector tile output format setting, if it's supported by the provider (see supportedOutputVectorTileLayerExtensions()). Otherwise the first reported supported vector tile format will be used.

See also
supportedOutputPointCloudLayerExtensions()
defaultVectorFileExtension()
defaultRasterFileExtension()
Since
QGIS 3.32

Definition at line 291 of file qgsprocessingprovider.cpp.

◆ flags()

Qgis::ProcessingProviderFlags QgsProcessingProvider::flags ( ) const
virtual

Returns the flags indicating how and when the provider operates and should be exposed to users.

Default is no flags.

Since
QGIS 3.14

Reimplemented in QgsNativeAlgorithms.

Definition at line 45 of file qgsprocessingprovider.cpp.

◆ helpId()

QString QgsProcessingProvider::helpId ( ) const
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.

See also
id()

Reimplemented in Qgs3DAlgorithms, and QgsNativeAlgorithms.

Definition at line 50 of file qgsprocessingprovider.cpp.

◆ icon()

QIcon QgsProcessingProvider::icon ( ) const
virtual

Returns an icon for the provider.

See also
svgIconPath()

Reimplemented in Qgs3DAlgorithms, and QgsNativeAlgorithms.

Definition at line 35 of file qgsprocessingprovider.cpp.

◆ id()

virtual 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.

See also
name()
helpId()

Implemented in Qgs3DAlgorithms, and QgsNativeAlgorithms.

◆ isActive()

virtual bool QgsProcessingProvider::isActive ( ) const
inlinevirtual

Returns true if the provider is active and able to run algorithms.

Definition at line 138 of file qgsprocessingprovider.h.

◆ isSupportedOutputValue()

bool QgsProcessingProvider::isSupportedOutputValue ( const QVariant &  outputValue,
const QgsProcessingDestinationParameter parameter,
QgsProcessingContext context,
QString &  error 
) const
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.

Since
QGIS 3.6

Definition at line 131 of file qgsprocessingprovider.cpp.

◆ load()

virtual bool QgsProcessingProvider::load ( )
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.

Returns
true if provider could be successfully loaded
See also
unload()

Definition at line 302 of file qgsprocessingprovider.h.

◆ loadAlgorithms()

virtual void QgsProcessingProvider::loadAlgorithms ( )
protectedpure virtual

Loads all algorithms belonging to this provider.

Subclasses should implement this, calling addAlgorithm() to register all their associated algorithms.

Implemented in Qgs3DAlgorithms, and QgsNativeAlgorithms.

◆ longName()

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().

See also
name()
id()

Definition at line 55 of file qgsprocessingprovider.cpp.

◆ name()

virtual 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.

See also
longName()
id()

Implemented in Qgs3DAlgorithms, and QgsNativeAlgorithms.

◆ operator=()

QgsProcessingProvider & QgsProcessingProvider::operator= ( const QgsProcessingProvider other)
delete

◆ refreshAlgorithms()

void QgsProcessingProvider::refreshAlgorithms ( )

Refreshes the algorithms available from the provider, causing it to re-populate with all associated algorithms.

Definition at line 80 of file qgsprocessingprovider.cpp.

◆ supportedOutputPointCloudLayerExtensions()

QStringList QgsProcessingProvider::supportedOutputPointCloudLayerExtensions ( ) const
virtual

◆ supportedOutputRasterLayerExtensions()

QStringList QgsProcessingProvider::supportedOutputRasterLayerExtensions ( ) const
virtual

Returns a list of the raster format file extensions supported by this provider.

See also
supportedOutputVectorLayerExtensions()
supportedOutputPointCloudLayerExtensions()
supportedOutputVectorTileLayerExtensions()

Definition at line 65 of file qgsprocessingprovider.cpp.

◆ supportedOutputTableExtensions()

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.

See also
supportedOutputVectorLayerExtensions()
defaultVectorFileExtension()
supportedOutputRasterLayerExtensions()
supportsNonFileBasedOutput()
supportedOutputPointCloudLayerExtensions()
Since
QGIS 3.4.3

Definition at line 126 of file qgsprocessingprovider.cpp.

◆ supportedOutputVectorLayerExtensions()

QStringList QgsProcessingProvider::supportedOutputVectorLayerExtensions ( ) const
virtual

◆ supportedOutputVectorTileLayerExtensions()

QStringList QgsProcessingProvider::supportedOutputVectorTileLayerExtensions ( ) const
virtual

Returns a list of the vector tile format file extensions supported by this provider.

By default returns a list containing only "mbtiles" extension.

See also
supportedOutputVectorLayerExtensions()
supportedOutputRasterLayerExtensions()
supportedOutputTableExtensions()
defaultVectorFileExtension()
supportsNonFileBasedOutput()
Since
QGIS 3.32

Definition at line 75 of file qgsprocessingprovider.cpp.

◆ supportsNonFileBasedOutput()

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.

See also
supportedOutputVectorLayerExtensions()

Reimplemented in Qgs3DAlgorithms, and QgsNativeAlgorithms.

Definition at line 312 of file qgsprocessingprovider.cpp.

◆ svgIconPath()

QString QgsProcessingProvider::svgIconPath ( ) const
virtual

Returns a path to an SVG version of the provider's icon.

See also
icon()

Reimplemented in Qgs3DAlgorithms, and QgsNativeAlgorithms.

Definition at line 40 of file qgsprocessingprovider.cpp.

◆ unload()

virtual void QgsProcessingProvider::unload ( )
inlinevirtual

Unloads the provider.

Any tear-down steps required by the provider should be implemented here.

See also
load()

Definition at line 308 of file qgsprocessingprovider.h.

◆ versionInfo()

QString QgsProcessingProvider::versionInfo ( ) const
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.

Since
QGIS 3.8

Definition at line 60 of file qgsprocessingprovider.cpp.

◆ warningMessage()

virtual QString QgsProcessingProvider::warningMessage ( ) const
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.

Since
QGIS 3.10.1

Definition at line 133 of file qgsprocessingprovider.h.


The documentation for this class was generated from the following files: