QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
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"
24#include <QIcon>
25
34class 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
51
56 virtual QIcon icon() const SIP_HOLDGIL;
57
62 virtual QString svgIconPath() const SIP_HOLDGIL;
63
69 virtual Qgis::ProcessingProviderFlags flags() const SIP_HOLDGIL;
70
78 virtual QString id() const = 0 SIP_HOLDGIL;
79
86 virtual QString helpId() const SIP_HOLDGIL;
87
94 virtual QString name() const = 0 SIP_HOLDGIL;
95
106 virtual QString longName() const SIP_HOLDGIL;
107
116 virtual QString versionInfo() const SIP_HOLDGIL;
117
123 virtual bool canBeActivated() const { return true; }
124
135 virtual QString warningMessage() const { return QString(); }
136
140 virtual bool isActive() const { return true; }
141
148 virtual QStringList supportedOutputRasterLayerExtensions() const;
149
159 virtual QStringList supportedOutputVectorLayerExtensions() const;
160
172 virtual QStringList supportedOutputPointCloudLayerExtensions() const;
173
187 virtual QStringList supportedOutputVectorTileLayerExtensions() const;
188
203 virtual QStringList supportedOutputTableExtensions() const;
204
212 virtual bool isSupportedOutputValue( const QVariant &outputValue, const QgsProcessingDestinationParameter *parameter, QgsProcessingContext &context, QString &error SIP_OUT ) const;
213
230 virtual QString defaultVectorFileExtension( bool hasGeometry = true ) const;
231
245 virtual QString defaultRasterFileExtension() const;
246
262 virtual QString defaultPointCloudFileExtension() const;
263
278 virtual QString defaultVectorTileFileExtension() const;
279
293 virtual bool supportsNonFileBasedOutput() const;
294
304 virtual bool load() { refreshAlgorithms(); return true; }
305
310 virtual void unload() {}
311
315 void refreshAlgorithms();
316
321 QList< const QgsProcessingAlgorithm * > algorithms() const;
322
328 const QgsProcessingAlgorithm *algorithm( const QString &name ) const;
329
330 signals:
331
338
339 protected:
340
345 virtual void loadAlgorithms() = 0;
346
350 bool addAlgorithm( QgsProcessingAlgorithm *algorithm SIP_TRANSFER );
351
352 private:
353
354 QMap< QString, const QgsProcessingAlgorithm * > mAlgorithms;
355
356#ifdef SIP_RUN
358#endif
359};
360
361#endif // QGSPROCESSINGPROVIDER_H
362
363
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
Base class for all parameter definitions which represent file or layer destinations,...
Abstract base class for processing providers.
QgsProcessingProvider(const QgsProcessingProvider &other)=delete
Providers cannot be copied.
virtual bool isActive() const
Returns true if the provider is active and able to run algorithms.
void algorithmsLoaded()
Emitted when the provider has loaded (or refreshed) its list of available algorithms.
virtual void unload()
Unloads the provider.
virtual bool load()
Loads the provider.
virtual void loadAlgorithms()=0
Loads all algorithms belonging to this provider.
virtual QString warningMessage() const
Returns an optional warning message to show users when running algorithms from this provider.
QgsProcessingProvider & operator=(const QgsProcessingProvider &other)=delete
Providers cannot be copied.
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
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_HOLDGIL
Definition qgis_sip.h:171