QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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() == QgsProcessingOutputPointCloudLayer::typeName() )
51  sipType = sipType_QgsProcessingOutputPointCloudLayer;
52  else if ( sipCpp->type() == QgsProcessingOutputMapLayer::typeName() )
53  sipType = sipType_QgsProcessingOutputMapLayer;
54  else if ( sipCpp->type() == QgsProcessingOutputMultipleLayers::typeName() )
55  sipType = sipType_QgsProcessingOutputMultipleLayers;
56  else if ( sipCpp->type() == QgsProcessingOutputHtml::typeName() )
57  sipType = sipType_QgsProcessingOutputHtml;
58  else if ( sipCpp->type() == QgsProcessingOutputNumber::typeName() )
59  sipType = sipType_QgsProcessingOutputNumber;
60  else if ( sipCpp->type() == QgsProcessingOutputString::typeName() )
61  sipType = sipType_QgsProcessingOutputString;
62  else if ( sipCpp->type() == QgsProcessingOutputBoolean::typeName() )
63  sipType = sipType_QgsProcessingOutputBoolean;
64  else if ( sipCpp->type() == QgsProcessingOutputFolder::typeName() )
65  sipType = sipType_QgsProcessingOutputFolder;
66  else if ( sipCpp->type() == QgsProcessingOutputFile::typeName() )
67  sipType = sipType_QgsProcessingOutputFile;
68  else if ( sipCpp->type() == QgsProcessingOutputConditionalBranch::typeName() )
69  sipType = sipType_QgsProcessingOutputConditionalBranch;
70  else
71  sipType = nullptr;
72  SIP_END
73 #endif
74 
75  public:
76 
80  QgsProcessingOutputDefinition( const QString &name, const QString &description = QString() );
81 
82  virtual ~QgsProcessingOutputDefinition() = default;
83 
87  virtual QString type() const = 0;
88 
94  QString name() const { return mName; }
95 
101  void setName( const QString &name ) { mName = name; }
102 
108  QString description() const { return mDescription; }
109 
115  void setDescription( const QString &description ) { mDescription = description; }
116 
123  void setAutoCreated( bool autoCreated ) { mAutoCreated = autoCreated; }
124 
130  bool autoCreated() const { return mAutoCreated; }
131 
132  protected:
133 
135  QString mName;
136 
138  QString mDescription;
139 
140  bool mAutoCreated = false;
141 };
142 
144 typedef QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions;
145 
157 {
158  public:
159 
163  QgsProcessingOutputMapLayer( const QString &name, const QString &description = QString() );
164 
168  static QString typeName() { return QStringLiteral( "outputLayer" ); }
169 
170  QString type() const override;
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 
240 {
241  public:
242 
246  QgsProcessingOutputPointCloudLayer( const QString &name, const QString &description = QString() );
247 
251  static QString typeName() { return QStringLiteral( "outputPointCloud" ); }
252  QString type() const override { return typeName(); }
253 };
254 
269 {
270  public:
271 
275  QgsProcessingOutputMultipleLayers( const QString &name, const QString &description = QString() );
276 
280  static QString typeName() { return QStringLiteral( "outputMultilayer" ); }
281  QString type() const override;
282 };
283 
291 {
292  public:
293 
297  QgsProcessingOutputHtml( const QString &name, const QString &description = QString() );
298 
302  static QString typeName() { return QStringLiteral( "outputHtml" ); }
303  QString type() const override { return typeName(); }
304 };
305 
313 {
314  public:
315 
319  QgsProcessingOutputNumber( const QString &name, const QString &description = QString() );
320 
324  static QString typeName() { return QStringLiteral( "outputNumber" ); }
325  QString type() const override { return typeName(); }
326 };
327 
335 {
336  public:
337 
341  QgsProcessingOutputString( const QString &name, const QString &description = QString() );
342 
346  static QString typeName() { return QStringLiteral( "outputString" ); }
347  QString type() const override { return typeName(); }
348 };
349 
357 {
358  public:
359 
363  QgsProcessingOutputBoolean( const QString &name, const QString &description = QString() );
364 
368  static QString typeName() { return QStringLiteral( "outputBoolean" ); }
369  QString type() const override { return typeName(); }
370 };
371 
379 {
380  public:
381 
386  QgsProcessingOutputFolder( const QString &name, const QString &description = QString() );
387 
391  static QString typeName() { return QStringLiteral( "outputFolder" ); }
392  QString type() const override { return typeName(); }
393 };
394 
402 {
403  public:
404 
408  QgsProcessingOutputFile( const QString &name, const QString &description = QString() );
409 
413  static QString typeName() { return QStringLiteral( "outputFile" ); }
414  QString type() const override { return typeName(); }
415 };
416 
425 {
426  public:
427 
431  QgsProcessingOutputConditionalBranch( const QString &name, const QString &description = QString() );
432 
436  static QString typeName() { return QStringLiteral( "outputBranch" ); }
437  QString type() const override { return typeName(); }
438 };
439 
440 #endif // QGSPROCESSINGOUTPUTS_H
QgsProcessingOutputFolder::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:392
QgsProcessingOutputHtml::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:303
QgsProcessingOutputConditionalBranch::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:436
QgsProcessingOutputPointCloudLayer::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:252
QgsProcessingOutputVectorLayer::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:192
QgsProcessingOutputFile
A file output for processing algorithms.
Definition: qgsprocessingoutputs.h:401
QgsProcessingOutputVectorLayer
A vector layer output for processing algorithms.
Definition: qgsprocessingoutputs.h:179
QgsProcessingOutputDefinition::mName
QString mName
Output name.
Definition: qgsprocessingoutputs.h:135
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:368
QgsProcessingOutputMultipleLayers::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:280
QgsProcessingOutputBoolean::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:369
QgsProcessingOutputFolder::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:391
QgsProcessingOutputNumber
A numeric output for processing algorithms.
Definition: qgsprocessingoutputs.h:312
QgsProcessingOutputRasterLayer::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:229
QgsProcessingOutputDefinition
Base class for the definition of processing outputs.
Definition: qgsprocessingoutputs.h:41
QgsProcessingOutputDefinition::mDescription
QString mDescription
Output description.
Definition: qgsprocessingoutputs.h:138
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:186
QgsProcessingOutputDefinition::autoCreated
bool autoCreated() const
Returns true if the output was automatically created when adding a parameter.
Definition: qgsprocessingoutputs.h:130
QgsProcessingOutputDefinition::setAutoCreated
void setAutoCreated(bool autoCreated)
Sets whether an output was automatically created when adding a parameter.
Definition: qgsprocessingoutputs.h:123
QgsProcessingOutputConditionalBranch
A conditional branch output for processing algorithms, which represents a possible model logic flow w...
Definition: qgsprocessingoutputs.h:424
QgsProcessingOutputNumber::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:325
QgsProcessingOutputMapLayer::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:168
QgsProcessing::TypeVectorAnyGeometry
@ TypeVectorAnyGeometry
Any vector layer with geometry.
Definition: qgsprocessing.h:48
QgsProcessingOutputString::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:347
QgsProcessingOutputString
A string output for processing algorithms.
Definition: qgsprocessingoutputs.h:334
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:115
qgsprocessingparameters.h
QgsProcessingOutputString::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:346
QgsProcessingOutputFile::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:414
QgsProcessingOutputDefinition::setName
void setName(const QString &name)
Sets the name of the output.
Definition: qgsprocessingoutputs.h:101
QgsProcessingOutputRasterLayer::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:230
QgsProcessingOutputRasterLayer
A raster layer output for processing algorithms.
Definition: qgsprocessingoutputs.h:217
QgsProcessingOutputPointCloudLayer::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:251
QgsProcessingOutputMultipleLayers
A multi-layer output for processing algorithms which create map layers, when the number and nature of...
Definition: qgsprocessingoutputs.h:268
QgsProcessingOutputDefinition::description
QString description() const
Returns the description for the output.
Definition: qgsprocessingoutputs.h:108
QgsProcessingOutputBoolean
A boolean output for processing algorithms.
Definition: qgsprocessingoutputs.h:356
QgsProcessingOutputMapLayer
A map layer output for processing algorithms, where layers may be either vector or raster.
Definition: qgsprocessingoutputs.h:156
QgsProcessingOutputNumber::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:324
QgsProcessingOutputHtml
A HTML file output for processing algorithms.
Definition: qgsprocessingoutputs.h:290
QgsProcessingOutputDefinitions
QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions
List of processing parameters.
Definition: qgsprocessingoutputs.h:144
QgsProcessingOutputDefinition::name
QString name() const
Returns the name of the output.
Definition: qgsprocessingoutputs.h:94
QgsProcessingOutputFolder
A folder output for processing algorithms.
Definition: qgsprocessingoutputs.h:378
SIP_END
#define SIP_END
Definition: qgis_sip.h:203
QgsProcessing::SourceType
SourceType
Data source types enum.
Definition: qgsprocessing.h:45
QgsProcessingOutputHtml::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:302
QgsProcessingOutputPointCloudLayer
A pointcloud layer output for processing algorithms.
Definition: qgsprocessingoutputs.h:239
QgsProcessingOutputConditionalBranch::type
QString type() const override
Unique output type name.
Definition: qgsprocessingoutputs.h:437
QgsProcessingOutputFile::typeName
static QString typeName()
Returns the type name for the output class.
Definition: qgsprocessingoutputs.h:413