QGIS API Documentation 4.1.0-Master (60fea48833c)
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.h"
22#include "qgis_core.h"
24
25#include <QMap>
26
29
37{
38 public:
40 QString displayName;
41
43 QIcon icon;
44};
45
46
56class CORE_EXPORT QgsProcessingRegistry : public QObject
57{
58 Q_OBJECT
59
60 public:
64 QgsProcessingRegistry( QObject *parent SIP_TRANSFERTHIS = nullptr );
65
66 ~QgsProcessingRegistry() override;
67
70
74 QList<QgsProcessingProvider *> providers() const { return mProviders.values(); }
75
85 bool addProvider( QgsProcessingProvider *provider SIP_TRANSFER );
86
92 bool removeProvider( QgsProcessingProvider *provider );
93
99 bool removeProvider( const QString &providerId );
100
101 // clang-format off
105 QgsProcessingProvider *providerById( const QString &id ) const SIP_HOLDGIL;
106 // clang-format on
107
112 QList< const QgsProcessingAlgorithm *> algorithms() const;
113
122 QgsProcessingAlgorithmInformation algorithmInformation( const QString &id ) const;
123
130 const QgsProcessingAlgorithm *algorithmById( const QString &id ) const;
131
132 /*
133 * IMPORTANT: While it seems like /Factory/ would be the correct annotation here, that's not
134 * the case.
135 * As per Phil Thomson's advice on https://www.riverbankcomputing.com/pipermail/pyqt/2017-July/039450.html:
136 *
137 * "
138 * /Factory/ is used when the instance returned is guaranteed to be new to Python.
139 * In this case it isn't because it has already been seen when being returned by QgsProcessingAlgorithm::createInstance()
140 * (However for a different sub-class implemented in C++ then it would be the first time it was seen
141 * by Python so the /Factory/ on create() would be correct.)
142 *
143 * You might try using /TransferBack/ on create() instead - that might be the best compromise.
144 * "
145 */
146
160 QgsProcessingAlgorithm *createAlgorithmById( const QString &id, const QVariantMap &configuration = QVariantMap() ) const SIP_TRANSFERBACK;
161
173 void addAlgorithmAlias( const QString &aliasId, const QString &actualId );
174
184 bool addParameterType( QgsProcessingParameterType *type SIP_TRANSFER );
185
195 void removeParameterType( QgsProcessingParameterType *type );
196
202 QgsProcessingParameterType *parameterType( const QString &id ) const;
203
209 QList<QgsProcessingParameterType *> parameterTypes() const;
210
211 signals:
212
214 void providerAdded( const QString &id );
215
217 void providerRemoved( const QString &id );
218
225
233
234 private:
235
237 QMap<QString, QgsProcessingProvider *> mProviders;
238
240 QMap<QString, QgsProcessingParameterType *> mParameterTypes;
241
242 QMap< QString, QString > mAlgorithmAliases;
243
244 mutable QMap< QString, QgsProcessingAlgorithmInformation > mCachedInformation;
245
246#ifdef SIP_RUN
248#endif
249
250 friend class TestQgsProcessing;
251};
252
253#endif // QGSPROCESSINGREGISTRY_H
254
255
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.
QgsProcessingRegistry & operator=(const QgsProcessingRegistry &other)=delete
void parameterTypeAdded(QgsProcessingParameterType *type)
Emitted when a new parameter type has been added to the registry.
void parameterTypeRemoved(QgsProcessingParameterType *type)
Emitted when a parameter type has been removed from the registry and is about to be deleted.
QgsProcessingRegistry(QObject *parent=nullptr)
Constructor for QgsProcessingRegistry.
QList< QgsProcessingProvider * > providers() const
Gets list of available providers.
void providerAdded(const QString &id)
Emitted when a provider has been added to the registry.
QgsProcessingRegistry(const QgsProcessingRegistry &other)=delete
void providerRemoved(const QString &id)
Emitted when a provider is removed from the registry.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_TRANSFERBACK
Definition qgis_sip.h:47
#define SIP_HOLDGIL
Definition qgis_sip.h:178