QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
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 
34 class CORE_EXPORT QgsProcessingProvider : public QObject
35 {
36  Q_OBJECT
37 
38  public:
39 
43  QgsProcessingProvider( QObject *parent SIP_TRANSFERTHIS = nullptr );
44 
45  ~QgsProcessingProvider() override;
46 
48  QgsProcessingProvider( const QgsProcessingProvider &other ) = delete;
50  QgsProcessingProvider &operator=( const QgsProcessingProvider &other ) = delete;
51 
56  virtual QIcon icon() const;
57 
62  virtual QString svgIconPath() const;
63 
71  virtual QString id() const = 0;
72 
79  virtual QString helpId() const;
80 
87  virtual QString name() const = 0;
88 
99  virtual QString longName() const;
100 
109  virtual QString versionInfo() const;
110 
116  virtual bool canBeActivated() const { return true; }
117 
128  virtual QString warningMessage() const { return QString(); }
129 
133  virtual bool isActive() const { return true; }
134 
139  virtual QStringList supportedOutputRasterLayerExtensions() const;
140 
148  virtual QStringList supportedOutputVectorLayerExtensions() const;
149 
163  virtual QStringList supportedOutputTableExtensions() const;
164 
172  virtual bool isSupportedOutputValue( const QVariant &outputValue, const QgsProcessingDestinationParameter *parameter, QgsProcessingContext &context, QString &error SIP_OUT ) const;
173 
188  virtual QString defaultVectorFileExtension( bool hasGeometry = true ) const;
189 
201  virtual QString defaultRasterFileExtension() const;
202 
216  virtual bool supportsNonFileBasedOutput() const;
217 
227  virtual bool load() { refreshAlgorithms(); return true; }
228 
233  virtual void unload() {}
234 
238  void refreshAlgorithms();
239 
244  QList< const QgsProcessingAlgorithm * > algorithms() const;
245 
251  const QgsProcessingAlgorithm *algorithm( const QString &name ) const;
252 
253  signals:
254 
260  void algorithmsLoaded();
261 
262  protected:
263 
268  virtual void loadAlgorithms() = 0;
269 
273  bool addAlgorithm( QgsProcessingAlgorithm *algorithm SIP_TRANSFER );
274 
275  private:
276 
277  QMap< QString, const QgsProcessingAlgorithm * > mAlgorithms;
278 
279 #ifdef SIP_RUN
281 #endif
282 };
283 
284 #endif // QGSPROCESSINGPROVIDER_H
285 
286 
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
Abstract base class for processing providers.
Base class for all parameter definitions which represent file or layer destinations, e.g.
Abstract base class for processing algorithms.
virtual QString warningMessage() const
Returns an optional warning message to show users when running algorithms from this provider...
virtual bool isActive() const
Returns true if the provider is active and able to run algorithms.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
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
virtual bool load()
Loads the provider.
#define SIP_OUT
Definition: qgis_sip.h:58
virtual bool canBeActivated() const
Returns true if the provider can be activated, or false if it cannot be activated (e...
virtual void unload()
Unloads the provider.
Contains information about the context in which a processing algorithm is executed.