@@ -1420,7 +1420,42 @@ class QgsProcessingParameterExpression : QgsProcessingParameterDefinition
1420
1420
1421
1421
};
1422
1422
1423
- class QgsProcessingParameterVectorLayer : QgsProcessingParameterDefinition
1423
+
1424
+ class QgsProcessingParameterLimitedDataTypes
1425
+ {
1426
+ %Docstring
1427
+ Can be inherited by parameters which require limits to their acceptable data types.
1428
+ .. versionadded:: 3.0
1429
+ %End
1430
+
1431
+ %TypeHeaderCode
1432
+ #include "qgsprocessingparameters.h"
1433
+ %End
1434
+ public:
1435
+
1436
+ QgsProcessingParameterLimitedDataTypes( const QList< int > &types = QList< int >() );
1437
+ %Docstring
1438
+ Constructor for QgsProcessingParameterLimitedDataTypes, with a list of acceptable data ``types``.
1439
+ %End
1440
+
1441
+ QList< int > dataTypes() const;
1442
+ %Docstring
1443
+ Returns the geometry types for sources acceptable by the parameter.
1444
+ .. seealso:: setDataTypes()
1445
+ :rtype: list of int
1446
+ %End
1447
+
1448
+ void setDataTypes( const QList< int > &types );
1449
+ %Docstring
1450
+ Sets the geometry ``types`` for sources acceptable by the parameter.
1451
+ .. seealso:: dataTypes()
1452
+ %End
1453
+
1454
+ protected:
1455
+
1456
+ };
1457
+
1458
+ class QgsProcessingParameterVectorLayer : QgsProcessingParameterDefinition, QgsProcessingParameterLimitedDataTypes
1424
1459
{
1425
1460
%Docstring
1426
1461
A vector layer (with or without geometry) parameter for processing algorithms. Consider using
@@ -1455,19 +1490,6 @@ class QgsProcessingParameterVectorLayer : QgsProcessingParameterDefinition
1455
1490
virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;
1456
1491
1457
1492
1458
- QList< int > dataTypes() const;
1459
- %Docstring
1460
- Returns the geometry types for sources acceptable by the parameter.
1461
- .. seealso:: setDataTypes()
1462
- :rtype: list of int
1463
- %End
1464
-
1465
- void setDataTypes( const QList< int > &types );
1466
- %Docstring
1467
- Sets the geometry ``types`` for sources acceptable by the parameter.
1468
- .. seealso:: dataTypes()
1469
- %End
1470
-
1471
1493
virtual QVariantMap toVariantMap() const;
1472
1494
1473
1495
virtual bool fromVariantMap( const QVariantMap &map );
@@ -1579,7 +1601,8 @@ class QgsProcessingParameterField : QgsProcessingParameterDefinition
1579
1601
1580
1602
};
1581
1603
1582
- class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition
1604
+
1605
+ class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition, QgsProcessingParameterLimitedDataTypes
1583
1606
{
1584
1607
%Docstring
1585
1608
An input feature source (such as vector layers) parameter for processing algorithms.
@@ -1613,19 +1636,6 @@ class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition
1613
1636
virtual QString asScriptCode() const;
1614
1637
1615
1638
1616
- QList< int > dataTypes() const;
1617
- %Docstring
1618
- Returns the geometry types for sources acceptable by the parameter.
1619
- .. seealso:: setDataTypes()
1620
- :rtype: list of int
1621
- %End
1622
-
1623
- void setDataTypes( const QList< int > &types );
1624
- %Docstring
1625
- Sets the geometry ``types`` for sources acceptable by the parameter.
1626
- .. seealso:: dataTypes()
1627
- %End
1628
-
1629
1639
virtual QVariantMap toVariantMap() const;
1630
1640
1631
1641
virtual bool fromVariantMap( const QVariantMap &map );
0 commit comments