QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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;
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
139
140 bool mAutoCreated = false;
141};
142
144typedef 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
A boolean output for processing algorithms.
QString type() const override
Unique output type name.
static QString typeName()
Returns the type name for the output class.
A conditional branch output for processing algorithms, which represents a possible model logic flow w...
static QString typeName()
Returns the type name for the output class.
QString type() const override
Unique output type name.
Base class for the definition of processing outputs.
void setDescription(const QString &description)
Sets the description for the output.
QString name() const
Returns the name of the output.
void setName(const QString &name)
Sets the name of the output.
void setAutoCreated(bool autoCreated)
Sets whether an output was automatically created when adding a parameter.
virtual ~QgsProcessingOutputDefinition()=default
virtual QString type() const =0
Unique output type name.
bool autoCreated() const
Returns true if the output was automatically created when adding a parameter.
QString mDescription
Output description.
QString description() const
Returns the description for the output.
A file output for processing algorithms.
QString type() const override
Unique output type name.
static QString typeName()
Returns the type name for the output class.
A folder output for processing algorithms.
QString type() const override
Unique output type name.
static QString typeName()
Returns the type name for the output class.
A HTML file output for processing algorithms.
QString type() const override
Unique output type name.
static QString typeName()
Returns the type name for the output class.
A map layer output for processing algorithms, where layers may be either vector or raster.
static QString typeName()
Returns the type name for the output class.
A multi-layer output for processing algorithms which create map layers, when the number and nature of...
static QString typeName()
Returns the type name for the output class.
A numeric output for processing algorithms.
QString type() const override
Unique output type name.
static QString typeName()
Returns the type name for the output class.
A pointcloud layer output for processing algorithms.
QString type() const override
Unique output type name.
static QString typeName()
Returns the type name for the output class.
A raster layer output for processing algorithms.
static QString typeName()
Returns the type name for the output class.
QString type() const override
Unique output type name.
A string output for processing algorithms.
QString type() const override
Unique output type name.
static QString typeName()
Returns the type name for the output class.
A vector layer output for processing algorithms.
QString type() const override
Unique output type name.
static QString typeName()
Returns the type name for the output class.
SourceType
Data source types enum.
Definition: qgsprocessing.h:46
@ TypeVectorAnyGeometry
Any vector layer with geometry.
Definition: qgsprocessing.h:48
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:186
#define SIP_END
Definition: qgis_sip.h:203
QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions
List of processing parameters.
const QString & typeName