QGIS API Documentation 3.39.0-Master (be2050b798e)
Loading...
Searching...
No Matches
qgsprocessingmodelchildparametersource.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingmodelchildparametersource.h
3 ----------------------------------------
4 begin : June 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 QGSPROCESSINGMODELCHILDPARAMETERSOURCE_H
19#define QGSPROCESSINGMODELCHILDPARAMETERSOURCE_H
20
21#include "qgis_core.h"
22#include "qgis.h"
23#include "qgsprocessing.h"
25class QgsProcessingModelAlgorithm;
26
28
33class CORE_EXPORT QgsProcessingModelChildParameterSource
34{
35 public:
36
41 QgsProcessingModelChildParameterSource() = default;
42
43 bool operator==( const QgsProcessingModelChildParameterSource &other ) const;
44 bool operator!=( const QgsProcessingModelChildParameterSource &other ) const
45 {
46 return !operator==( other );
47 }
48
56 static QgsProcessingModelChildParameterSource fromStaticValue( const QVariant &value );
57
65 static QgsProcessingModelChildParameterSource fromModelParameter( const QString &parameterName );
66
74 static QgsProcessingModelChildParameterSource fromChildOutput( const QString &childId, const QString &outputName );
75
87 static QgsProcessingModelChildParameterSource fromExpression( const QString &expression );
88
101 static QgsProcessingModelChildParameterSource fromExpressionText( const QString &text );
102
107
113 void setSource( Qgis::ProcessingModelChildParameterSource source );
114
119 QVariant staticValue() const { return mStaticValue; }
120
125 void setStaticValue( const QVariant &value ) { mStaticValue = value; mSource = Qgis::ProcessingModelChildParameterSource::StaticValue; }
126
131 QString parameterName() const { return mParameterName; }
132
137 void setParameterName( const QString &name ) { mParameterName = name; mSource = Qgis::ProcessingModelChildParameterSource::ModelParameter; }
138
144 QString outputChildId() const { return mChildId; }
145
151 void setOutputChildId( const QString &id ) { mChildId = id; mSource = Qgis::ProcessingModelChildParameterSource::ChildOutput; }
152
158 QString outputName() const { return mOutputName; }
159
165 void setOutputName( const QString &name ) { mOutputName = name; mSource = Qgis::ProcessingModelChildParameterSource::ChildOutput; }
166
171 QString expression() const { return mExpression; }
172
180 void setExpression( const QString &expression ) { mExpression = expression; mSource = Qgis::ProcessingModelChildParameterSource::Expression; }
181
188 QString expressionText() const { return mExpressionText; }
189
199 void setExpressionText( const QString &text ) { mExpressionText = text; mSource = Qgis::ProcessingModelChildParameterSource::ExpressionText; }
200
205 QVariant toVariant() const;
206
211 bool loadVariant( const QVariantMap &map );
212
218 QString asPythonCode( QgsProcessing::PythonOutputType outputType, const QgsProcessingParameterDefinition *definition, const QMap< QString, QString > &friendlyChildNames ) const;
219
225 QString asPythonComment( const QgsProcessingParameterDefinition *definition ) const;
226
231 QString friendlyIdentifier( QgsProcessingModelAlgorithm *model ) const;
232
233 private:
234
236 QVariant mStaticValue;
237 QString mParameterName;
238 QString mChildId;
239 QString mOutputName;
240 QString mExpression;
241 QString mExpressionText;
242
243};
244
245Q_DECLARE_METATYPE( QgsProcessingModelChildParameterSource );
246CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsProcessingModelChildParameterSource &source );
247CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsProcessingModelChildParameterSource &source );
248
249#ifndef SIP_RUN
251typedef QList< QgsProcessingModelChildParameterSource > QgsProcessingModelChildParameterSources;
252#endif
253
255
256#endif // QGSPROCESSINGMODELCHILDPARAMETERSOURCE_H
ProcessingModelChildParameterSource
Processing model child parameter sources.
Definition qgis.h:3378
@ ExpressionText
Parameter value is taken from a text with expressions, evaluated just before the algorithm runs.
@ ChildOutput
Parameter value is taken from an output generated by a child algorithm.
@ ModelParameter
Parameter value is taken from a parent model parameter.
@ StaticValue
Parameter value is a static value.
@ Expression
Parameter value is taken from an expression, evaluated just before the algorithm runs.
Base class for the definition of processing parameters.
PythonOutputType
Available Python output types.
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QDataStream & operator<<(QDataStream &out, const QgsFeature &feature)
Writes the feature to stream out. QGIS version compatibility is not guaranteed.
QDataStream & operator>>(QDataStream &in, QgsFeature &feature)
Reads a feature from stream in into feature. QGIS version compatibility is not guaranteed.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)