QGIS API Documentation 3.39.0-Master (3aed037ce22)
Loading...
Searching...
No Matches
qgsprocessingregistry.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingregistry.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 QGSPROCESSINGREGISTRY_H
19#define QGSPROCESSINGREGISTRY_H
20
21#include "qgis_core.h"
22#include "qgis.h"
24#include <QMap>
25
28
36{
37 public:
38
40 QString displayName;
41
43 QIcon icon;
44};
45
46
56class CORE_EXPORT QgsProcessingRegistry : public QObject
57{
58 Q_OBJECT
59
60 public:
61
65 QgsProcessingRegistry( QObject *parent SIP_TRANSFERTHIS = nullptr );
66
67 ~QgsProcessingRegistry() override;
68
71
75 QList<QgsProcessingProvider *> providers() const { return mProviders.values(); }
76
86 bool addProvider( QgsProcessingProvider *provider SIP_TRANSFER );
87
93 bool removeProvider( QgsProcessingProvider *provider );
94
100 bool removeProvider( const QString &providerId );
101
105 QgsProcessingProvider *providerById( const QString &id ) const SIP_HOLDGIL;
106
111 QList< const QgsProcessingAlgorithm *> algorithms() const;
112
121 QgsProcessingAlgorithmInformation algorithmInformation( const QString &id ) const;
122
129 const QgsProcessingAlgorithm *algorithmById( const QString &id ) const;
130
131 /*
132 * IMPORTANT: While it seems like /Factory/ would be the correct annotation here, that's not
133 * the case.
134 * As per Phil Thomson's advice on https://www.riverbankcomputing.com/pipermail/pyqt/2017-July/039450.html:
135 *
136 * "
137 * /Factory/ is used when the instance returned is guaranteed to be new to Python.
138 * In this case it isn't because it has already been seen when being returned by QgsProcessingAlgorithm::createInstance()
139 * (However for a different sub-class implemented in C++ then it would be the first time it was seen
140 * by Python so the /Factory/ on create() would be correct.)
141 *
142 * You might try using /TransferBack/ on create() instead - that might be the best compromise.
143 * "
144 */
145
159 QgsProcessingAlgorithm *createAlgorithmById( const QString &id, const QVariantMap &configuration = QVariantMap() ) const SIP_TRANSFERBACK;
160
172 void addAlgorithmAlias( const QString &aliasId, const QString &actualId );
173
183 bool addParameterType( QgsProcessingParameterType *type SIP_TRANSFER );
184
194 void removeParameterType( QgsProcessingParameterType *type );
195
201 QgsProcessingParameterType *parameterType( const QString &id ) const;
202
208 QList<QgsProcessingParameterType *> parameterTypes() const;
209
210 signals:
211
213 void providerAdded( const QString &id );
214
216 void providerRemoved( const QString &id );
217
223 void parameterTypeAdded( QgsProcessingParameterType *type );
224
231 void parameterTypeRemoved( QgsProcessingParameterType *type );
232
233 private:
234
236 QMap<QString, QgsProcessingProvider *> mProviders;
237
239 QMap<QString, QgsProcessingParameterType *> mParameterTypes;
240
241 QMap< QString, QString > mAlgorithmAliases;
242
243 mutable QMap< QString, QgsProcessingAlgorithmInformation > mCachedInformation;
244
245#ifdef SIP_RUN
247#endif
248
249 friend class TestQgsProcessing;
250};
251
252#endif // QGSPROCESSINGREGISTRY_H
253
254
Interface base class for factories for algorithm configuration widgets.
Contains basic properties for a Processing algorithm.
QString displayName
Algorithm display name.
Abstract base class for processing algorithms.
Makes metadata of processing parameters available.
Abstract base class for processing providers.
Registry for various processing components, including providers, algorithms and various parameters an...
QgsProcessingRegistry & operator=(const QgsProcessingRegistry &other)=delete
QList< QgsProcessingProvider * > providers() const
Gets list of available providers.
QgsProcessingRegistry(const QgsProcessingRegistry &other)=delete
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_TRANSFERBACK
Definition qgis_sip.h:48
#define SIP_HOLDGIL
Definition qgis_sip.h:171