QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsprocessingprovider.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingprovider.h
3  ------------------------
4  begin : December 2016
5  copyright : (C) 2016 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSPROCESSINGPROVIDER_H
19 #define QGSPROCESSINGPROVIDER_H
20 
21 #include "qgis_core.h"
22 #include "qgis.h"
23 #include "qgsprocessingalgorithm.h"
24 #include <QIcon>
25 
35 class CORE_EXPORT QgsProcessingProvider : public QObject
36 {
37  Q_OBJECT
38 
39  public:
40 
45  enum Flag
46  {
47  FlagDeemphasiseSearchResults = 1 << 1,
48  };
49  Q_DECLARE_FLAGS( Flags, Flag )
50 
51 
54  QgsProcessingProvider( QObject *parent SIP_TRANSFERTHIS = nullptr );
55 
56  ~QgsProcessingProvider() override;
57 
59  QgsProcessingProvider( const QgsProcessingProvider &other ) = delete;
61  QgsProcessingProvider &operator=( const QgsProcessingProvider &other ) = delete;
62 
67  virtual QIcon icon() const;
68 
73  virtual QString svgIconPath() const;
74 
80  virtual Flags flags() const;
81 
89  virtual QString id() const = 0;
90 
97  virtual QString helpId() const;
98 
105  virtual QString name() const = 0;
106 
117  virtual QString longName() const;
118 
127  virtual QString versionInfo() const;
128 
134  virtual bool canBeActivated() const { return true; }
135 
146  virtual QString warningMessage() const { return QString(); }
147 
151  virtual bool isActive() const { return true; }
152 
157  virtual QStringList supportedOutputRasterLayerExtensions() const;
158 
167  virtual QStringList supportedOutputVectorLayerExtensions() const;
168 
179  virtual QStringList supportedOutputPointCloudLayerExtensions() const;
180 
195  virtual QStringList supportedOutputTableExtensions() const;
196 
204  virtual bool isSupportedOutputValue( const QVariant &outputValue, const QgsProcessingDestinationParameter *parameter, QgsProcessingContext &context, QString &error SIP_OUT ) const;
205 
221  virtual QString defaultVectorFileExtension( bool hasGeometry = true ) const;
222 
235  virtual QString defaultRasterFileExtension() const;
236 
251  virtual QString defaultPointCloudFileExtension() const;
252 
266  virtual bool supportsNonFileBasedOutput() const;
267 
277  virtual bool load() { refreshAlgorithms(); return true; }
278 
283  virtual void unload() {}
284 
288  void refreshAlgorithms();
289 
294  QList< const QgsProcessingAlgorithm * > algorithms() const;
295 
301  const QgsProcessingAlgorithm *algorithm( const QString &name ) const;
302 
303  signals:
304 
310  void algorithmsLoaded();
311 
312  protected:
313 
318  virtual void loadAlgorithms() = 0;
319 
323  bool addAlgorithm( QgsProcessingAlgorithm *algorithm SIP_TRANSFER );
324 
325  private:
326 
327  QMap< QString, const QgsProcessingAlgorithm * > mAlgorithms;
328 
329 #ifdef SIP_RUN
331 #endif
332 };
333 
334 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingProvider::Flags )
335 
336 #endif // QGSPROCESSINGPROVIDER_H
337 
338 
QgsProcessingProvider::load
virtual bool load()
Loads the provider.
Definition: qgsprocessingprovider.h:277
algorithm
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
SIP_OUT
#define SIP_OUT
Definition: qgis_sip.h:58
QgsProcessingProvider
Abstract base class for processing providers.
Definition: qgsprocessingprovider.h:35
qgis.h
QgsProcessingDestinationParameter
Base class for all parameter definitions which represent file or layer destinations,...
Definition: qgsprocessingparameters.h:3097
QgsProcessingProvider::unload
virtual void unload()
Unloads the provider.
Definition: qgsprocessingprovider.h:283
QgsProcessingContext
Contains information about the context in which a processing algorithm is executed.
Definition: qgsprocessingcontext.h:46
qgsprocessingalgorithm.h
QgsProcessingProvider::canBeActivated
virtual bool canBeActivated() const
Returns true if the provider can be activated, or false if it cannot be activated (e....
Definition: qgsprocessingprovider.h:134
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Q_DECLARE_OPERATORS_FOR_FLAGS
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
QgsProcessingProvider::warningMessage
virtual QString warningMessage() const
Returns an optional warning message to show users when running algorithms from this provider.
Definition: qgsprocessingprovider.h:146
QgsProcessingProvider::Flag
Flag
Flags indicating how and when an provider operates and should be exposed to users.
Definition: qgsprocessingprovider.h:45
QgsProcessingAlgorithm
Abstract base class for processing algorithms.
Definition: qgsprocessingalgorithm.h:52
QgsProcessingProvider::isActive
virtual bool isActive() const
Returns true if the provider is active and able to run algorithms.
Definition: qgsprocessingprovider.h:151
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53