QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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
34class CORE_EXPORT QgsProcessingModelChildParameterSource
35{
36 public:
37
42 QgsProcessingModelChildParameterSource() = default;
43
44 bool operator==( const QgsProcessingModelChildParameterSource &other ) const;
45 bool operator!=( const QgsProcessingModelChildParameterSource &other ) const
46 {
47 return !operator==( other );
48 }
49
57 static QgsProcessingModelChildParameterSource fromStaticValue( const QVariant &value );
58
66 static QgsProcessingModelChildParameterSource fromModelParameter( const QString &parameterName );
67
75 static QgsProcessingModelChildParameterSource fromChildOutput( const QString &childId, const QString &outputName );
76
88 static QgsProcessingModelChildParameterSource fromExpression( const QString &expression );
89
102 static QgsProcessingModelChildParameterSource fromExpressionText( const QString &text );
103
108
114 void setSource( Qgis::ProcessingModelChildParameterSource source );
115
120 QVariant staticValue() const { return mStaticValue; }
121
126 void setStaticValue( const QVariant &value ) { mStaticValue = value; mSource = Qgis::ProcessingModelChildParameterSource::StaticValue; }
127
132 QString parameterName() const { return mParameterName; }
133
138 void setParameterName( const QString &name ) { mParameterName = name; mSource = Qgis::ProcessingModelChildParameterSource::ModelParameter; }
139
145 QString outputChildId() const { return mChildId; }
146
152 void setOutputChildId( const QString &id ) { mChildId = id; mSource = Qgis::ProcessingModelChildParameterSource::ChildOutput; }
153
159 QString outputName() const { return mOutputName; }
160
166 void setOutputName( const QString &name ) { mOutputName = name; mSource = Qgis::ProcessingModelChildParameterSource::ChildOutput; }
167
172 QString expression() const { return mExpression; }
173
181 void setExpression( const QString &expression ) { mExpression = expression; mSource = Qgis::ProcessingModelChildParameterSource::Expression; }
182
189 QString expressionText() const { return mExpressionText; }
190
200 void setExpressionText( const QString &text ) { mExpressionText = text; mSource = Qgis::ProcessingModelChildParameterSource::ExpressionText; }
201
206 QVariant toVariant() const;
207
212 bool loadVariant( const QVariantMap &map );
213
219 QString asPythonCode( QgsProcessing::PythonOutputType outputType, const QgsProcessingParameterDefinition *definition, const QMap< QString, QString > &friendlyChildNames ) const;
220
226 QString asPythonComment( const QgsProcessingParameterDefinition *definition ) const;
227
232 QString friendlyIdentifier( QgsProcessingModelAlgorithm *model ) const;
233
234 private:
235
237 QVariant mStaticValue;
238 QString mParameterName;
239 QString mChildId;
240 QString mOutputName;
241 QString mExpression;
242 QString mExpressionText;
243
244};
245
246Q_DECLARE_METATYPE( QgsProcessingModelChildParameterSource );
247CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsProcessingModelChildParameterSource &source );
248CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsProcessingModelChildParameterSource &source );
249
250#ifndef SIP_RUN
252typedef QList< QgsProcessingModelChildParameterSource > QgsProcessingModelChildParameterSources;
253#endif
254
256
257#endif // QGSPROCESSINGMODELCHILDPARAMETERSOURCE_H
ProcessingModelChildParameterSource
Processing model child parameter sources.
Definition qgis.h:2601
@ 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)