QGIS API Documentation 4.1.0-Master (60fea48833c)
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.h"
22#include "qgis_core.h"
23#include "qgsprocessing.h"
24
26class QgsProcessingModelAlgorithm;
27
29
34class CORE_EXPORT QgsProcessingModelChildParameterSource
35{
36 public:
41 QgsProcessingModelChildParameterSource() = default;
42
43 bool operator==( const QgsProcessingModelChildParameterSource &other ) const;
44 bool operator!=( const QgsProcessingModelChildParameterSource &other ) const { return !operator==( other ); }
45
53 static QgsProcessingModelChildParameterSource fromStaticValue( const QVariant &value );
54
62 static QgsProcessingModelChildParameterSource fromModelParameter( const QString &parameterName );
63
71 static QgsProcessingModelChildParameterSource fromChildOutput( const QString &childId, const QString &outputName );
72
84 static QgsProcessingModelChildParameterSource fromExpression( const QString &expression );
85
98 static QgsProcessingModelChildParameterSource fromExpressionText( const QString &text );
99
104
110 void setSource( Qgis::ProcessingModelChildParameterSource source );
111
116 QVariant staticValue() const { return mStaticValue; }
117
122 void setStaticValue( const QVariant &value )
123 {
124 mStaticValue = value;
126 }
127
132 QString parameterName() const { return mParameterName; }
133
138 void setParameterName( const QString &name )
139 {
140 mParameterName = name;
142 }
143
149 QString outputChildId() const { return mChildId; }
150
156 void setOutputChildId( const QString &id )
157 {
158 mChildId = id;
160 }
161
167 QString outputName() const { return mOutputName; }
168
174 void setOutputName( const QString &name )
175 {
176 mOutputName = name;
178 }
179
184 QString expression() const { return mExpression; }
185
193 void setExpression( const QString &expression )
194 {
195 mExpression = expression;
197 }
198
205 QString expressionText() const { return mExpressionText; }
206
216 void setExpressionText( const QString &text )
217 {
218 mExpressionText = text;
220 }
221
226 QVariant toVariant() const;
227
232 bool loadVariant( const QVariantMap &map );
233
239 QString asPythonCode( QgsProcessing::PythonOutputType outputType, const QgsProcessingParameterDefinition *definition, const QMap< QString, QString > &friendlyChildNames ) const;
240
246 QString asPythonComment( const QgsProcessingParameterDefinition *definition ) const;
247
252 QString friendlyIdentifier( QgsProcessingModelAlgorithm *model ) const;
253
254 private:
256 QVariant mStaticValue;
257 QString mParameterName;
258 QString mChildId;
259 QString mOutputName;
260 QString mExpression;
261 QString mExpressionText;
262};
263
264Q_DECLARE_METATYPE( QgsProcessingModelChildParameterSource );
265CORE_EXPORT QDataStream &operator<<( QDataStream &out, const QgsProcessingModelChildParameterSource &source );
266CORE_EXPORT QDataStream &operator>>( QDataStream &in, QgsProcessingModelChildParameterSource &source );
267
268#ifndef SIP_RUN
270typedef QList< QgsProcessingModelChildParameterSource > QgsProcessingModelChildParameterSources;
271#endif
272
274
275#endif // QGSPROCESSINGMODELCHILDPARAMETERSOURCE_H
ProcessingModelChildParameterSource
Processing model child parameter sources.
Definition qgis.h:3964
@ ExpressionText
Parameter value is taken from a text with expressions, evaluated just before the algorithm runs.
Definition qgis.h:3969
@ ChildOutput
Parameter value is taken from an output generated by a child algorithm.
Definition qgis.h:3966
@ ModelParameter
Parameter value is taken from a parent model parameter.
Definition qgis.h:3965
@ StaticValue
Parameter value is a static value.
Definition qgis.h:3967
@ Expression
Parameter value is taken from an expression, evaluated just before the algorithm runs.
Definition qgis.h:3968
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)