31 qDeleteAll( mAlgorithms );
61 qDeleteAll( mAlgorithms );
72 return mAlgorithms.values();
77 return mAlgorithms.value( name );
85 if ( mAlgorithms.contains( algorithm->
name() ) )
108 const QString defaultExtension = hasGeometry ? QStringLiteral(
"shp" ) : QStringLiteral(
"dbf" );
109 const QString userDefault = settings.
value( QStringLiteral(
"Processing/DefaultOutputVectorLayerExt" ), defaultExtension,
QgsSettings::Core ).toString();
112 if ( supportedExtensions.contains( userDefault, Qt::CaseInsensitive ) )
117 else if ( !supportedExtensions.empty() )
119 return supportedExtensions.at( 0 );
125 return defaultExtension;
132 const QString defaultExtension = QStringLiteral(
"tif" );
133 const QString userDefault = settings.
value( QStringLiteral(
"Processing/DefaultOutputRasterLayerExt" ), defaultExtension,
QgsSettings::Core ).toString();
136 if ( supportedExtensions.contains( userDefault, Qt::CaseInsensitive ) )
141 else if ( !supportedExtensions.empty() )
143 return supportedExtensions.at( 0 );
148 return defaultExtension;
void setProvider(QgsProcessingProvider *provider)
Associates this algorithm with its provider.
virtual QString name() const =0
Returns the provider name, which is used to describe the provider within the GUI. ...
~QgsProcessingProvider() override
QList< const QgsProcessingAlgorithm *> algorithms() const
Returns a list of algorithms supplied by this provider.
This class is a composition of two QSettings instances:
virtual QString name() const =0
Returns the algorithm name, used for identifying the algorithm.
virtual QString helpId() const
Returns the provider help id string, used for creating QgsHelp urls for algorithms belong to this pro...
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
virtual QStringList supportedOutputRasterLayerExtensions() const
Returns a list of the raster format file extensions supported by this provider.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
virtual bool supportsNonFileBasedOutput() const
Returns true if the provider supports non-file based outputs (such as memory layers or direct databas...
virtual QString svgIconPath() const
Returns a path to an SVG version of the provider's icon.
Abstract base class for processing algorithms.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning)
add a message to the instance (and create it if necessary)
virtual void initAlgorithm(const QVariantMap &configuration=QVariantMap())=0
Initializes the algorithm using the specified configuration.
QgsProcessingProvider(QObject *parent=nullptr)
Constructor for QgsProcessingProvider.
static QStringList supportedFormatExtensions(RasterFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats.
virtual bool isActive() const
Returns true if the provider is active and able to run algorithms.
virtual QString id() const =0
Returns the unique provider id, used for identifying the provider.
virtual QString defaultRasterFileExtension() const
Returns the default file extension to use for raster outputs created by the provider.
virtual void loadAlgorithms()=0
Loads all algorithms belonging to this provider.
static QStringList supportedFormatExtensions(VectorFormatOptions options=SortRecommended)
Returns a list of file extensions for supported formats.
void refreshAlgorithms()
Refreshes the algorithms available from the provider, causing it to re-populate with all associated a...
virtual QString defaultVectorFileExtension(bool hasGeometry=true) const
Returns the default file extension to use for vector outputs created by the provider.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), const Section section=NoSection) const
Returns the value for setting key.
const QgsProcessingAlgorithm * algorithm(const QString &name) const
Returns the matching algorithm by name, or a nullptr if no matching algorithm is contained by this pr...
bool addAlgorithm(QgsProcessingAlgorithm *algorithm)
Adds an algorithm to the provider.
virtual QIcon icon() const
Returns an icon for the provider.
virtual QString longName() const
Returns the a longer version of the provider name, which can include extra details such as version nu...
virtual QStringList supportedOutputVectorLayerExtensions() const
Returns a list of the vector format file extensions supported by this provider.
void algorithmsLoaded()
Emitted when the provider has loaded (or refreshed) its list of available algorithms.