@@ -163,14 +163,16 @@ class QgsProcessingParameterDefinition
163
163
sipType = sipType_QgsProcessingParameterString;
164
164
else if ( sipCpp->type() == "expression" )
165
165
sipType = sipType_QgsProcessingParameterExpression;
166
- else if ( sipCpp->type() == "table " )
167
- sipType = sipType_QgsProcessingParameterTable ;
166
+ else if ( sipCpp->type() == "vector " )
167
+ sipType = sipType_QgsProcessingParameterVectorLayer ;
168
168
else if ( sipCpp->type() == "field" )
169
- sipType = sipType_QgsProcessingParameterTableField ;
169
+ sipType = sipType_QgsProcessingParameterField ;
170
170
else if ( sipCpp->type() == "source" )
171
171
sipType = sipType_QgsProcessingParameterFeatureSource;
172
172
else if ( sipCpp->type() == "sink" )
173
173
sipType = sipType_QgsProcessingParameterFeatureSink;
174
+ else if ( sipCpp->type() == "vectorOut" )
175
+ sipType = sipType_QgsProcessingParameterVectorOutput;
174
176
else if ( sipCpp->type() == "rasterOut" )
175
177
sipType = sipType_QgsProcessingParameterRasterOutput;
176
178
else if ( sipCpp->type() == "fileOut" )
@@ -1153,10 +1155,11 @@ class QgsProcessingParameterExpression : QgsProcessingParameterDefinition
1153
1155
1154
1156
};
1155
1157
1156
- class QgsProcessingParameterTable : QgsProcessingParameterDefinition
1158
+ class QgsProcessingParameterVectorLayer : QgsProcessingParameterDefinition
1157
1159
{
1158
1160
%Docstring
1159
- A table (i.e. vector layers with or without geometry) parameter for processing algorithms.
1161
+ A vector layer (with or without geometry) parameter for processing algorithms. Consider using
1162
+ the more versatile QgsProcessingParameterFeatureSource wherever possible.
1160
1163
.. versionadded:: 3.0
1161
1164
%End
1162
1165
@@ -1165,20 +1168,24 @@ class QgsProcessingParameterTable : QgsProcessingParameterDefinition
1165
1168
%End
1166
1169
public:
1167
1170
1168
- QgsProcessingParameterTable ( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1169
- bool optional = false );
1171
+ QgsProcessingParameterVectorLayer ( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1172
+ bool optional = false );
1170
1173
%Docstring
1171
- Constructor for QgsProcessingParameterTable .
1174
+ Constructor for QgsProcessingParameterVectorLayer .
1172
1175
%End
1173
1176
1174
1177
virtual QString type() const;
1178
+ virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
1179
+
1180
+ virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
1181
+
1175
1182
1176
1183
};
1177
1184
1178
- class QgsProcessingParameterTableField : QgsProcessingParameterDefinition
1185
+ class QgsProcessingParameterField : QgsProcessingParameterDefinition
1179
1186
{
1180
1187
%Docstring
1181
- A table field parameter for processing algorithms.
1188
+ A vector layer or feature source field parameter for processing algorithms.
1182
1189
.. versionadded:: 3.0
1183
1190
%End
1184
1191
@@ -1195,13 +1202,13 @@ class QgsProcessingParameterTableField : QgsProcessingParameterDefinition
1195
1202
DateTime
1196
1203
};
1197
1204
1198
- QgsProcessingParameterTableField ( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1199
- const QString &parentLayerParameterName = QString(),
1200
- DataType type = Any,
1201
- bool allowMultiple = false,
1202
- bool optional = false );
1205
+ QgsProcessingParameterField ( const QString &name, const QString &description = QString(), const QVariant &defaultValue = QVariant(),
1206
+ const QString &parentLayerParameterName = QString(),
1207
+ DataType type = Any,
1208
+ bool allowMultiple = false,
1209
+ bool optional = false );
1203
1210
%Docstring
1204
- Constructor for QgsProcessingParameterTableField .
1211
+ Constructor for QgsProcessingParameterField .
1205
1212
%End
1206
1213
1207
1214
virtual QString type() const;
@@ -1354,6 +1361,60 @@ class QgsProcessingParameterFeatureSink : QgsProcessingParameterDefinition
1354
1361
virtual bool fromVariantMap( const QVariantMap &map );
1355
1362
1356
1363
1364
+ };
1365
+
1366
+
1367
+ class QgsProcessingParameterVectorOutput : QgsProcessingParameterDefinition
1368
+ {
1369
+ %Docstring
1370
+ A vector layer output parameter. Consider using the more flexible QgsProcessingParameterFeatureSink wherever
1371
+ possible.
1372
+ .. versionadded:: 3.0
1373
+ %End
1374
+
1375
+ %TypeHeaderCode
1376
+ #include "qgsprocessingparameters.h"
1377
+ %End
1378
+ public:
1379
+
1380
+ QgsProcessingParameterVectorOutput( const QString &name, const QString &description = QString(), QgsProcessingParameterDefinition::LayerType type = QgsProcessingParameterDefinition::TypeVectorAny, const QVariant &defaultValue = QVariant(),
1381
+ bool optional = false );
1382
+ %Docstring
1383
+ Constructor for QgsProcessingParameterVectorOutput.
1384
+ %End
1385
+
1386
+ virtual QString type() const;
1387
+ virtual bool isDestination() const;
1388
+ virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
1389
+
1390
+ virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
1391
+
1392
+
1393
+ QgsProcessingParameterDefinition::LayerType dataType() const;
1394
+ %Docstring
1395
+ Returns the layer type for layers associated with the parameter.
1396
+ .. seealso:: setDataType()
1397
+ :rtype: QgsProcessingParameterDefinition.LayerType
1398
+ %End
1399
+
1400
+ bool hasGeometry() const;
1401
+ %Docstring
1402
+ Returns true if the layer is likely to include geometries. In cases were presence of geometry
1403
+ cannot be reliably determined in advance, this method will default to returning true.
1404
+ :rtype: bool
1405
+ %End
1406
+
1407
+ void setDataType( QgsProcessingParameterDefinition::LayerType type );
1408
+ %Docstring
1409
+ Sets the layer ``type`` for the layers associated with the parameter.
1410
+ .. seealso:: dataType()
1411
+ %End
1412
+
1413
+ virtual QVariantMap toVariantMap() const;
1414
+
1415
+ virtual bool fromVariantMap( const QVariantMap &map );
1416
+
1417
+
1357
1418
};
1358
1419
1359
1420
class QgsProcessingParameterRasterOutput : QgsProcessingParameterDefinition
0 commit comments