QGIS API Documentation  3.6.0-Noosa (5873452)
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() == QgsProcessingOutputFolder::typeName() )
61  sipType = sipType_QgsProcessingOutputFolder;
62  else if ( sipCpp->type() == QgsProcessingOutputFile::typeName() )
63  sipType = sipType_QgsProcessingOutputFile;
64  else
65  sipType = nullptr;
66  SIP_END
67 #endif
68 
69  public:
70 
74  QgsProcessingOutputDefinition( const QString &name, const QString &description = QString() );
75 
76  virtual ~QgsProcessingOutputDefinition() = default;
77 
81  virtual QString type() const = 0;
82 
88  QString name() const { return mName; }
89 
95  void setName( const QString &name ) { mName = name; }
96 
102  QString description() const { return mDescription; }
103 
109  void setDescription( const QString &description ) { mDescription = description; }
110 
111  protected:
112 
114  QString mName;
115 
117  QString mDescription;
118 
119 };
120 
122 typedef QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions;
123 
135 {
136  public:
137 
141  QgsProcessingOutputMapLayer( const QString &name, const QString &description = QString() );
142 
146  static QString typeName() { return QStringLiteral( "outputLayer" ); }
147 
148  QString type() const override;
149 
150 };
151 
159 {
160  public:
161 
165  QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry );
166 
170  static QString typeName() { return QStringLiteral( "outputVector" ); }
171  QString type() const override { return typeName(); }
172 
177  QgsProcessing::SourceType dataType() const;
178 
183  void setDataType( QgsProcessing::SourceType type );
184 
185  private:
186 
188 };
189 
197 {
198  public:
199 
203  QgsProcessingOutputRasterLayer( const QString &name, const QString &description = QString() );
204 
208  static QString typeName() { return QStringLiteral( "outputRaster" ); }
209  QString type() const override { return typeName(); }
210 
211 
212 };
213 
228 {
229  public:
230 
234  QgsProcessingOutputMultipleLayers( const QString &name, const QString &description = QString() );
235 
239  static QString typeName() { return QStringLiteral( "outputMultilayer" ); }
240  QString type() const override;
241 
242 };
243 
251 {
252  public:
253 
257  QgsProcessingOutputHtml( const QString &name, const QString &description = QString() );
258 
262  static QString typeName() { return QStringLiteral( "outputHtml" ); }
263  QString type() const override { return typeName(); }
264 
265 };
266 
274 {
275  public:
276 
280  QgsProcessingOutputNumber( const QString &name, const QString &description = QString() );
281 
285  static QString typeName() { return QStringLiteral( "outputNumber" ); }
286  QString type() const override { return typeName(); }
287 };
288 
296 {
297  public:
298 
302  QgsProcessingOutputString( const QString &name, const QString &description = QString() );
303 
307  static QString typeName() { return QStringLiteral( "outputString" ); }
308  QString type() const override { return typeName(); }
309 
310 };
311 
319 {
320  public:
321 
326  QgsProcessingOutputFolder( const QString &name, const QString &description = QString() );
327 
331  static QString typeName() { return QStringLiteral( "outputFolder" ); }
332  QString type() const override { return typeName(); }
333 
334 };
335 
343 {
344  public:
345 
349  QgsProcessingOutputFile( const QString &name, const QString &description = QString() );
350 
354  static QString typeName() { return QStringLiteral( "outputFile" ); }
355  QString type() const override { return typeName(); }
356 
357 };
358 
359 
360 #endif // QGSPROCESSINGOUTPUTS_H
361 
362 
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.
static QString typeName()
Returns the type name for the output class.
A numeric 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...