QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsprocessingoutputs.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingoutputs.h
3  -------------------------
4  begin : May 2017
5  copyright : (C) 2017 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 QGSPROCESSINGOUTPUTS_H
19 #define QGSPROCESSINGOUTPUTS_H
20 
21 #include "qgis_core.h"
22 #include "qgis.h"
24 
25 //
26 // Output definitions
27 //
28 
42 {
43 
44 #ifdef SIP_RUN
46  if ( sipCpp->type() == QgsProcessingOutputVectorLayer::typeName() )
47  sipType = sipType_QgsProcessingOutputVectorLayer;
48  else if ( sipCpp->type() == QgsProcessingOutputRasterLayer::typeName() )
49  sipType = sipType_QgsProcessingOutputRasterLayer;
50  else if ( sipCpp->type() == QgsProcessingOutputMapLayer::typeName() )
51  sipType = sipType_QgsProcessingOutputMapLayer;
52  else if ( sipCpp->type() == QgsProcessingOutputMultipleLayers::typeName() )
53  sipType = sipType_QgsProcessingOutputMultipleLayers;
54  else if ( sipCpp->type() == QgsProcessingOutputHtml::typeName() )
55  sipType = sipType_QgsProcessingOutputHtml;
56  else if ( sipCpp->type() == QgsProcessingOutputNumber::typeName() )
57  sipType = sipType_QgsProcessingOutputNumber;
58  else if ( sipCpp->type() == QgsProcessingOutputString::typeName() )
59  sipType = sipType_QgsProcessingOutputString;
60  else if ( sipCpp->type() == QgsProcessingOutputBoolean::typeName() )
61  sipType = sipType_QgsProcessingOutputBoolean;
62  else if ( sipCpp->type() == QgsProcessingOutputFolder::typeName() )
63  sipType = sipType_QgsProcessingOutputFolder;
64  else if ( sipCpp->type() == QgsProcessingOutputFile::typeName() )
65  sipType = sipType_QgsProcessingOutputFile;
66  else if ( sipCpp->type() == QgsProcessingOutputConditionalBranch::typeName() )
67  sipType = sipType_QgsProcessingOutputConditionalBranch;
68  else
69  sipType = nullptr;
70  SIP_END
71 #endif
72 
73  public:
74 
78  QgsProcessingOutputDefinition( const QString &name, const QString &description = QString() );
79 
80  virtual ~QgsProcessingOutputDefinition() = default;
81 
85  virtual QString type() const = 0;
86 
92  QString name() const { return mName; }
93 
99  void setName( const QString &name ) { mName = name; }
100 
106  QString description() const { return mDescription; }
107 
113  void setDescription( const QString &description ) { mDescription = description; }
114 
121  void setAutoCreated( bool autoCreated ) { mAutoCreated = autoCreated; }
122 
128  bool autoCreated() const { return mAutoCreated; }
129 
130  protected:
131 
133  QString mName;
134 
136  QString mDescription;
137 
138  bool mAutoCreated = false;
139 
140 };
141 
143 typedef QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions;
144 
156 {
157  public:
158 
162  QgsProcessingOutputMapLayer( const QString &name, const QString &description = QString() );
163 
167  static QString typeName() { return QStringLiteral( "outputLayer" ); }
168 
169  QString type() const override;
170 
171 };
172 
180 {
181  public:
182 
186  QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry );
187 
191  static QString typeName() { return QStringLiteral( "outputVector" ); }
192  QString type() const override { return typeName(); }
193 
198  QgsProcessing::SourceType dataType() const;
199 
204  void setDataType( QgsProcessing::SourceType type );
205 
206  private:
207 
209 };
210 
218 {
219  public:
220 
224  QgsProcessingOutputRasterLayer( const QString &name, const QString &description = QString() );
225 
229  static QString typeName() { return QStringLiteral( "outputRaster" ); }
230  QString type() const override { return typeName(); }
231 
232 
233 };
234 
249 {
250  public:
251 
255  QgsProcessingOutputMultipleLayers( const QString &name, const QString &description = QString() );
256 
260  static QString typeName() { return QStringLiteral( "outputMultilayer" ); }
261  QString type() const override;
262 
263 };
264 
272 {
273  public:
274 
278  QgsProcessingOutputHtml( const QString &name, const QString &description = QString() );
279 
283  static QString typeName() { return QStringLiteral( "outputHtml" ); }
284  QString type() const override { return typeName(); }
285 
286 };
287 
295 {
296  public:
297 
301  QgsProcessingOutputNumber( const QString &name, const QString &description = QString() );
302 
306  static QString typeName() { return QStringLiteral( "outputNumber" ); }
307  QString type() const override { return typeName(); }
308 };
309 
317 {
318  public:
319 
323  QgsProcessingOutputString( const QString &name, const QString &description = QString() );
324 
328  static QString typeName() { return QStringLiteral( "outputString" ); }
329  QString type() const override { return typeName(); }
330 
331 };
332 
340 {
341  public:
342 
346  QgsProcessingOutputBoolean( const QString &name, const QString &description = QString() );
347 
351  static QString typeName() { return QStringLiteral( "outputBoolean" ); }
352  QString type() const override { return typeName(); }
353 };
354 
362 {
363  public:
364 
369  QgsProcessingOutputFolder( const QString &name, const QString &description = QString() );
370 
374  static QString typeName() { return QStringLiteral( "outputFolder" ); }
375  QString type() const override { return typeName(); }
376 
377 };
378 
386 {
387  public:
388 
392  QgsProcessingOutputFile( const QString &name, const QString &description = QString() );
393 
397  static QString typeName() { return QStringLiteral( "outputFile" ); }
398  QString type() const override { return typeName(); }
399 
400 };
401 
410 {
411  public:
412 
416  QgsProcessingOutputConditionalBranch( const QString &name, const QString &description = QString() );
417 
421  static QString typeName() { return QStringLiteral( "outputBranch" ); }
422  QString type() const override { return typeName(); }
423 
424 };
425 
426 
427 #endif // QGSPROCESSINGOUTPUTS_H
428 
429 
QgsProcessingOutputFolder::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:375
QgsProcessingOutputHtml::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:284
QgsProcessingOutputConditionalBranch::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:421
QgsProcessingOutputVectorLayer::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:192
QgsProcessingOutputFile
Definition: qgsprocessingoutputs.h:385
QgsProcessingOutputVectorLayer
Definition: qgsprocessingoutputs.h:179
QgsProcessingOutputDefinition::mName
QString mName
Output name.
Definition: qgsprocessingoutputs.h:133
qgis.h
QgsProcessingOutputDefinition::type
virtual QString type() const =0
Unique output type name.
QgsProcessingOutputBoolean::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:351
QgsProcessingOutputMultipleLayers::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:260
QgsProcessingOutputBoolean::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:352
QgsProcessingOutputFolder::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:374
QgsProcessingOutputNumber
Definition: qgsprocessingoutputs.h:294
QgsProcessingOutputRasterLayer::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:229
QgsProcessingOutputDefinition
Definition: qgsprocessingoutputs.h:41
QgsProcessingOutputDefinition::mDescription
QString mDescription
Output description.
Definition: qgsprocessingoutputs.h:136
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:172
QgsProcessingOutputDefinition::autoCreated
bool autoCreated() const
Returns true if the output was automatically created when adding a parameter.
Definition: qgsprocessingoutputs.h:128
QgsProcessingOutputDefinition::setAutoCreated
void setAutoCreated(bool autoCreated)
Sets whether an output was automatically created when adding a parameter.
Definition: qgsprocessingoutputs.h:121
QgsProcessingOutputConditionalBranch
Definition: qgsprocessingoutputs.h:409
QgsProcessingOutputNumber::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:307
QgsProcessingOutputMapLayer::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:167
QgsProcessing::TypeVectorAnyGeometry
@ TypeVectorAnyGeometry
Any vector layer with geometry.
Definition: qgsprocessing.h:47
QgsProcessingOutputString::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:329
QgsProcessingOutputString
Definition: qgsprocessingoutputs.h:316
QgsProcessingOutputVectorLayer::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:191
typeName
const QString & typeName
Definition: qgswfsgetfeature.cpp:109
QgsProcessingOutputDefinition::setDescription
void setDescription(const QString &description)
Sets the description for the output.
Definition: qgsprocessingoutputs.h:113
qgsprocessingparameters.h
QgsProcessingOutputString::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:328
QgsProcessingOutputFile::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:398
QgsProcessingOutputDefinition::setName
void setName(const QString &name)
Sets the name of the output.
Definition: qgsprocessingoutputs.h:99
QgsProcessingOutputRasterLayer::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:230
QgsProcessingOutputRasterLayer
Definition: qgsprocessingoutputs.h:217
QgsProcessingOutputMultipleLayers
Definition: qgsprocessingoutputs.h:248
QgsProcessingOutputDefinition::description
QString description() const
Returns the description for the output.
Definition: qgsprocessingoutputs.h:106
QgsProcessingOutputBoolean
Definition: qgsprocessingoutputs.h:339
QgsProcessingOutputMapLayer
Definition: qgsprocessingoutputs.h:155
QgsProcessingOutputNumber::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:306
QgsProcessingOutputHtml
Definition: qgsprocessingoutputs.h:271
QgsProcessingOutputDefinitions
QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions
List of processing parameters.
Definition: qgsprocessingoutputs.h:143
QgsProcessingOutputDefinition::name
QString name() const
Returns the name of the output.
Definition: qgsprocessingoutputs.h:92
QgsProcessingOutputFolder
Definition: qgsprocessingoutputs.h:361
SIP_END
#define SIP_END
Definition: qgis_sip.h:189
QgsProcessing::SourceType
SourceType
Data source types enum.
Definition: qgsprocessing.h:44
QgsProcessingOutputHtml::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:283
QgsProcessingOutputConditionalBranch::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:422
QgsProcessingOutputFile::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:397