@@ -56,11 +56,11 @@ Allows direct construction of QVariants.
56
56
57
57
58
58
59
- class QgsProcessingFeatureSinkDefinition
59
+ class QgsProcessingOutputLayerDefinition
60
60
{
61
61
%Docstring
62
62
63
- Encapsulates settings relating to a feature sink input to a processing algorithm.
63
+ Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.
64
64
65
65
.. versionadded:: 3.0
66
66
%End
@@ -70,35 +70,35 @@ class QgsProcessingFeatureSinkDefinition
70
70
%End
71
71
public:
72
72
73
- QgsProcessingFeatureSinkDefinition ( const QString &sink = QString(), QgsProject *destinationProject = 0 );
73
+ QgsProcessingOutputLayerDefinition ( const QString &sink = QString(), QgsProject *destinationProject = 0 );
74
74
%Docstring
75
- Constructor for QgsProcessingFeatureSinkDefinition , accepting a static string sink.
75
+ Constructor for QgsProcessingOutputLayerDefinition , accepting a static sink/layer string .
76
76
The ``destinationProject`` parameter can be set to a QgsProject instance in which
77
- to automatically load the resulting sink after completing processing.
77
+ to automatically load the resulting sink/layer after completing processing.
78
78
%End
79
79
80
- QgsProcessingFeatureSinkDefinition ( const QgsProperty &sink, QgsProject *destinationProject = 0 );
80
+ QgsProcessingOutputLayerDefinition ( const QgsProperty &sink, QgsProject *destinationProject = 0 );
81
81
%Docstring
82
- Constructor for QgsProcessingFeatureSinkDefinition , accepting a QgsProperty sink.
82
+ Constructor for QgsProcessingOutputLayerDefinition , accepting a QgsProperty sink/layer .
83
83
The ``destinationProject`` parameter can be set to a QgsProject instance in which
84
- to automatically load the resulting sink after completing processing.
84
+ to automatically load the resulting sink/layer after completing processing.
85
85
%End
86
86
87
87
QgsProperty sink;
88
88
%Docstring
89
- Sink definition. Usually a static property set to the destination file name for the sink's layer.
89
+ Sink/layer definition. Usually a static property set to the destination file name for the sink's layer.
90
90
%End
91
91
92
92
QgsProject *destinationProject;
93
93
%Docstring
94
94
Destination project. Can be set to a QgsProject instance in which
95
- to automatically load the resulting sink after completing processing.
95
+ to automatically load the resulting sink/layer after completing processing.
96
96
The default behavior is not to load the result into any project (None).
97
97
%End
98
98
99
99
QVariantMap createOptions;
100
100
%Docstring
101
- Map of optional sink creation options, which
101
+ Map of optional sink/layer creation options, which
102
102
are passed to the underlying provider when creating new layers. Known options also
103
103
include 'fileEncoding', which is used to specify a file encoding to use for created
104
104
files.
@@ -171,6 +171,10 @@ class QgsProcessingParameterDefinition
171
171
sipType = sipType_QgsProcessingParameterFeatureSource;
172
172
else if ( sipCpp->type() == "sink" )
173
173
sipType = sipType_QgsProcessingParameterFeatureSink;
174
+ else if ( sipCpp->type() == "rasterOut" )
175
+ sipType = sipType_QgsProcessingParameterRasterOutput;
176
+ else if ( sipCpp->type() == "fileOut" )
177
+ sipType = sipType_QgsProcessingParameterFileOutput;
174
178
%End
175
179
public:
176
180
@@ -419,6 +423,18 @@ class QgsProcessingParameters
419
423
:rtype: QgsRasterLayer
420
424
%End
421
425
426
+ static QString parameterAsRasterOutputLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context );
427
+ %Docstring
428
+ Evaluates the parameter with matching ``definition`` to a raster output layer destination.
429
+ :rtype: str
430
+ %End
431
+
432
+ static QString parameterAsFileOutput( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context );
433
+ %Docstring
434
+ Evaluates the parameter with matching ``definition`` to a file based output destination.
435
+ :rtype: str
436
+ %End
437
+
422
438
static QgsVectorLayer *parameterAsVectorLayer( const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context );
423
439
%Docstring
424
440
Evaluates the parameter with matching ``definition`` to a vector layer.
@@ -1206,6 +1222,13 @@ class QgsProcessingParameterFeatureSink : QgsProcessingParameterDefinition
1206
1222
:rtype: QgsProcessingParameterDefinition.LayerType
1207
1223
%End
1208
1224
1225
+ bool hasGeometry() const;
1226
+ %Docstring
1227
+ Returns true if sink is likely to include geometries. In cases were presence of geometry
1228
+ cannot be reliably determined in advance, this method will default to returning true.
1229
+ :rtype: bool
1230
+ %End
1231
+
1209
1232
void setDataType( QgsProcessingParameterDefinition::LayerType type );
1210
1233
%Docstring
1211
1234
Sets the layer ``type`` for the sinks associated with the parameter.
@@ -1214,6 +1237,71 @@ class QgsProcessingParameterFeatureSink : QgsProcessingParameterDefinition
1214
1237
1215
1238
};
1216
1239
1240
+ class QgsProcessingParameterRasterOutput : QgsProcessingParameterDefinition
1241
+ {
1242
+ %Docstring
1243
+ A raster layer output parameter.
1244
+ .. versionadded:: 3.0
1245
+ %End
1246
+
1247
+ %TypeHeaderCode
1248
+ #include "qgsprocessingparameters.h"
1249
+ %End
1250
+ public:
1251
+
1252
+ QgsProcessingParameterRasterOutput( const QString &name, const QString &description = QString(),
1253
+ const QVariant &defaultValue = QVariant(),
1254
+ bool optional = false );
1255
+ %Docstring
1256
+ Constructor for QgsProcessingParameterRasterOutput.
1257
+ %End
1258
+
1259
+ virtual QString type() const;
1260
+ virtual bool isDestination() const;
1261
+ virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
1262
+
1263
+ };
1264
+
1265
+ class QgsProcessingParameterFileOutput : QgsProcessingParameterDefinition
1266
+ {
1267
+ %Docstring
1268
+ A generic file based output parameter.
1269
+ .. versionadded:: 3.0
1270
+ %End
1271
+
1272
+ %TypeHeaderCode
1273
+ #include "qgsprocessingparameters.h"
1274
+ %End
1275
+ public:
1276
+
1277
+ QgsProcessingParameterFileOutput( const QString &name, const QString &description = QString(),
1278
+ const QString &fileFilter = QString(),
1279
+ const QVariant &defaultValue = QVariant(),
1280
+ bool optional = false );
1281
+ %Docstring
1282
+ Constructor for QgsProcessingParameterFileOutput.
1283
+ %End
1284
+
1285
+ virtual QString type() const;
1286
+ virtual bool isDestination() const;
1287
+ virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;
1288
+
1289
+
1290
+ QString fileFilter() const;
1291
+ %Docstring
1292
+ Returns the file filter string for files compatible with this output.
1293
+ .. seealso:: setFileFilter()
1294
+ :rtype: str
1295
+ %End
1296
+
1297
+ void setFileFilter( const QString &filter );
1298
+ %Docstring
1299
+ Sets the file ``filter`` string for files compatible with this output.
1300
+ .. seealso:: fileFilter()
1301
+ %End
1302
+
1303
+ };
1304
+
1217
1305
1218
1306
1219
1307
/************************************************************************
0 commit comments