QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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
67  sipType = nullptr;
68  SIP_END
69 #endif
70 
71  public:
72 
76  QgsProcessingOutputDefinition( const QString &name, const QString &description = QString() );
77 
78  virtual ~QgsProcessingOutputDefinition() = default;
79 
83  virtual QString type() const = 0;
84 
90  QString name() const { return mName; }
91 
97  void setName( const QString &name ) { mName = name; }
98 
104  QString description() const { return mDescription; }
105 
111  void setDescription( const QString &description ) { mDescription = description; }
112 
113  protected:
114 
116  QString mName;
117 
119  QString mDescription;
120 
121 };
122 
124 typedef QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions;
125 
137 {
138  public:
139 
143  QgsProcessingOutputMapLayer( const QString &name, const QString &description = QString() );
144 
148  static QString typeName() { return QStringLiteral( "outputLayer" ); }
149 
150  QString type() const override;
151 
152 };
153 
161 {
162  public:
163 
167  QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry );
168 
172  static QString typeName() { return QStringLiteral( "outputVector" ); }
173  QString type() const override { return typeName(); }
174 
179  QgsProcessing::SourceType dataType() const;
180 
185  void setDataType( QgsProcessing::SourceType type );
186 
187  private:
188 
190 };
191 
199 {
200  public:
201 
205  QgsProcessingOutputRasterLayer( const QString &name, const QString &description = QString() );
206 
210  static QString typeName() { return QStringLiteral( "outputRaster" ); }
211  QString type() const override { return typeName(); }
212 
213 
214 };
215 
230 {
231  public:
232 
236  QgsProcessingOutputMultipleLayers( const QString &name, const QString &description = QString() );
237 
241  static QString typeName() { return QStringLiteral( "outputMultilayer" ); }
242  QString type() const override;
243 
244 };
245 
253 {
254  public:
255 
259  QgsProcessingOutputHtml( const QString &name, const QString &description = QString() );
260 
264  static QString typeName() { return QStringLiteral( "outputHtml" ); }
265  QString type() const override { return typeName(); }
266 
267 };
268 
276 {
277  public:
278 
282  QgsProcessingOutputNumber( const QString &name, const QString &description = QString() );
283 
287  static QString typeName() { return QStringLiteral( "outputNumber" ); }
288  QString type() const override { return typeName(); }
289 };
290 
298 {
299  public:
300 
304  QgsProcessingOutputString( const QString &name, const QString &description = QString() );
305 
309  static QString typeName() { return QStringLiteral( "outputString" ); }
310  QString type() const override { return typeName(); }
311 
312 };
313 
321 {
322  public:
323 
327  QgsProcessingOutputBoolean( const QString &name, const QString &description = QString() );
328 
332  static QString typeName() { return QStringLiteral( "outputBoolean" ); }
333  QString type() const override { return typeName(); }
334 };
335 
343 {
344  public:
345 
350  QgsProcessingOutputFolder( const QString &name, const QString &description = QString() );
351 
355  static QString typeName() { return QStringLiteral( "outputFolder" ); }
356  QString type() const override { return typeName(); }
357 
358 };
359 
367 {
368  public:
369 
373  QgsProcessingOutputFile( const QString &name, const QString &description = QString() );
374 
378  static QString typeName() { return QStringLiteral( "outputFile" ); }
379  QString type() const override { return typeName(); }
380 
381 };
382 
383 
384 #endif // QGSPROCESSINGOUTPUTS_H
385 
386 
QString description() const
Returns the description for the output.
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the output class.
QString type() const override
Unique output type name.
QString name() const
Returns the name of the output.
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 numeric output for processing algorithms.
static QString typeName()
Returns the type name for the output class.
A boolean output for processing algorithms.
A vector layer output for processing algorithms.
QString type() const override
Unique output type name.
A string output for processing algorithms.
QString type() const override
Unique output type name.
void setName(const QString &name)
Sets the name of the output.
const QString & typeName
A file output for processing algorithms.
static QString typeName()
Returns the type name for the output class.
virtual QString type() const =0
Unique output type name.
#define SIP_END
Definition: qgis_sip.h:182
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the output class.
QString type() const override
Unique output type name.
A multi-layer output for processing algorithms which create map layers, when the number and nature of...
QString mDescription
Output description.
Base class for the definition of processing outputs.
QList< const QgsProcessingOutputDefinition *> QgsProcessingOutputDefinitions
List of processing parameters.
static QString typeName()
Returns the type name for the output class.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:165
SourceType
Data source types enum.
Definition: qgsprocessing.h:44
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.
QString type() const override
Unique output type name.
void setDescription(const QString &description)
Sets the description for the output.
static QString typeName()
Returns the type name for the output class.
Any vector layer with geometry.
Definition: qgsprocessing.h:47
A raster layer output for processing algorithms.
QString type() const override
Unique output type name.
A map layer output for processing algorithms, where layers may be either vector or raster...