Skip to content
Permalink
Browse files

[processing] add groupId() method to algorithms to get unique ID of the

algorithm group.

Adapt native algorithms
  • Loading branch information
alexbruy committed Dec 11, 2017
1 parent 0f6a5c8 commit 1d482cf953c20db4598b4a71c4e542767094d263
Showing with 316 additions and 4 deletions.
  1. +3 −1 python/core/processing/models/qgsprocessingmodelalgorithm.sip
  2. +10 −0 python/core/processing/qgsprocessingalgorithm.sip
  3. +5 −0 src/analysis/processing/qgsalgorithmaddincrementalfield.cpp
  4. +1 −0 src/analysis/processing/qgsalgorithmaddincrementalfield.h
  5. +5 −0 src/analysis/processing/qgsalgorithmassignprojection.cpp
  6. +1 −0 src/analysis/processing/qgsalgorithmassignprojection.h
  7. +5 −0 src/analysis/processing/qgsalgorithmboundary.cpp
  8. +1 −0 src/analysis/processing/qgsalgorithmboundary.h
  9. +5 −0 src/analysis/processing/qgsalgorithmboundingbox.cpp
  10. +1 −0 src/analysis/processing/qgsalgorithmboundingbox.h
  11. +5 −0 src/analysis/processing/qgsalgorithmbuffer.cpp
  12. +1 −0 src/analysis/processing/qgsalgorithmbuffer.h
  13. +5 −0 src/analysis/processing/qgsalgorithmcentroid.cpp
  14. +1 −0 src/analysis/processing/qgsalgorithmcentroid.h
  15. +5 −0 src/analysis/processing/qgsalgorithmclip.cpp
  16. +1 −0 src/analysis/processing/qgsalgorithmclip.h
  17. +5 −0 src/analysis/processing/qgsalgorithmconvexhull.cpp
  18. +1 −0 src/analysis/processing/qgsalgorithmconvexhull.h
  19. +10 −0 src/analysis/processing/qgsalgorithmdissolve.cpp
  20. +2 −0 src/analysis/processing/qgsalgorithmdissolve.h
  21. +5 −0 src/analysis/processing/qgsalgorithmdropgeometry.cpp
  22. +1 −0 src/analysis/processing/qgsalgorithmdropgeometry.h
  23. +5 −0 src/analysis/processing/qgsalgorithmdropmzvalues.cpp
  24. +1 −0 src/analysis/processing/qgsalgorithmdropmzvalues.h
  25. +1 −0 src/analysis/processing/qgsalgorithmextenttolayer.h
  26. +5 −0 src/analysis/processing/qgsalgorithmextractbyattribute.cpp
  27. +1 −0 src/analysis/processing/qgsalgorithmextractbyattribute.h
  28. +5 −0 src/analysis/processing/qgsalgorithmextractbyexpression.cpp
  29. +1 −0 src/analysis/processing/qgsalgorithmextractbyexpression.h
  30. +5 −0 src/analysis/processing/qgsalgorithmextractbyextent.cpp
  31. +1 −0 src/analysis/processing/qgsalgorithmextractbyextent.h
  32. +10 −0 src/analysis/processing/qgsalgorithmextractbylocation.cpp
  33. +2 −0 src/analysis/processing/qgsalgorithmextractbylocation.h
  34. +5 −0 src/analysis/processing/qgsalgorithmextractnodes.cpp
  35. +1 −0 src/analysis/processing/qgsalgorithmextractnodes.h
  36. +5 −0 src/analysis/processing/qgsalgorithmfiledownloader.cpp
  37. +1 −0 src/analysis/processing/qgsalgorithmfiledownloader.h
  38. +5 −0 src/analysis/processing/qgsalgorithmfixgeometries.cpp
  39. +1 −0 src/analysis/processing/qgsalgorithmfixgeometries.h
  40. +5 −0 src/analysis/processing/qgsalgorithmjoinbyattribute.cpp
  41. +1 −0 src/analysis/processing/qgsalgorithmjoinbyattribute.h
  42. +5 −0 src/analysis/processing/qgsalgorithmjoinwithlines.cpp
  43. +1 −0 src/analysis/processing/qgsalgorithmjoinwithlines.h
  44. +5 −0 src/analysis/processing/qgsalgorithmlineintersection.cpp
  45. +1 −0 src/analysis/processing/qgsalgorithmlineintersection.h
  46. +5 −0 src/analysis/processing/qgsalgorithmloadlayer.cpp
  47. +1 −0 src/analysis/processing/qgsalgorithmloadlayer.h
  48. +5 −0 src/analysis/processing/qgsalgorithmmeancoordinates.cpp
  49. +1 −0 src/analysis/processing/qgsalgorithmmeancoordinates.h
  50. +5 −0 src/analysis/processing/qgsalgorithmmergelines.cpp
  51. +1 −0 src/analysis/processing/qgsalgorithmmergelines.h
  52. +5 −0 src/analysis/processing/qgsalgorithmmergevector.cpp
  53. +1 −0 src/analysis/processing/qgsalgorithmmergevector.h
  54. +5 −0 src/analysis/processing/qgsalgorithmminimumenclosingcircle.cpp
  55. +1 −0 src/analysis/processing/qgsalgorithmminimumenclosingcircle.h
  56. +5 −0 src/analysis/processing/qgsalgorithmmultiparttosinglepart.cpp
  57. +1 −0 src/analysis/processing/qgsalgorithmmultiparttosinglepart.h
  58. +5 −0 src/analysis/processing/qgsalgorithmorderbyexpression.cpp
  59. +1 −0 src/analysis/processing/qgsalgorithmorderbyexpression.h
  60. +5 −0 src/analysis/processing/qgsalgorithmorientedminimumboundingbox.cpp
  61. +1 −0 src/analysis/processing/qgsalgorithmorientedminimumboundingbox.h
  62. +5 −0 src/analysis/processing/qgsalgorithmpackage.cpp
  63. +1 −0 src/analysis/processing/qgsalgorithmpackage.h
  64. +5 −0 src/analysis/processing/qgsalgorithmpromotetomultipart.cpp
  65. +1 −0 src/analysis/processing/qgsalgorithmpromotetomultipart.h
  66. +4 −0 src/analysis/processing/qgsalgorithmrasterlayeruniquevalues.cpp
  67. +1 −0 src/analysis/processing/qgsalgorithmrasterlayeruniquevalues.h
  68. +5 −0 src/analysis/processing/qgsalgorithmremoveduplicatenodes.cpp
  69. +1 −0 src/analysis/processing/qgsalgorithmremoveduplicatenodes.h
  70. +6 −1 src/analysis/processing/qgsalgorithmremovenullgeometry.cpp
  71. +1 −0 src/analysis/processing/qgsalgorithmremovenullgeometry.h
  72. +5 −0 src/analysis/processing/qgsalgorithmrenamelayer.cpp
  73. +1 −0 src/analysis/processing/qgsalgorithmrenamelayer.h
  74. +5 −0 src/analysis/processing/qgsalgorithmsaveselectedfeatures.cpp
  75. +1 −0 src/analysis/processing/qgsalgorithmsaveselectedfeatures.h
  76. +5 −0 src/analysis/processing/qgsalgorithmsimplify.cpp
  77. +1 −0 src/analysis/processing/qgsalgorithmsimplify.h
  78. +5 −0 src/analysis/processing/qgsalgorithmsmooth.cpp
  79. +1 −0 src/analysis/processing/qgsalgorithmsmooth.h
  80. +5 −0 src/analysis/processing/qgsalgorithmsnaptogrid.cpp
  81. +1 −0 src/analysis/processing/qgsalgorithmsnaptogrid.h
  82. +5 −0 src/analysis/processing/qgsalgorithmsplitwithlines.cpp
  83. +1 −0 src/analysis/processing/qgsalgorithmsplitwithlines.h
  84. +5 −0 src/analysis/processing/qgsalgorithmstringconcatenation.cpp
  85. +1 −0 src/analysis/processing/qgsalgorithmstringconcatenation.h
  86. +5 −0 src/analysis/processing/qgsalgorithmsubdivide.cpp
  87. +1 −0 src/analysis/processing/qgsalgorithmsubdivide.h
  88. +5 −0 src/analysis/processing/qgsalgorithmtransect.cpp
  89. +1 −0 src/analysis/processing/qgsalgorithmtransect.h
  90. +5 −0 src/analysis/processing/qgsalgorithmtransform.cpp
  91. +1 −0 src/analysis/processing/qgsalgorithmtransform.h
  92. +5 −0 src/analysis/processing/qgsalgorithmtranslate.cpp
  93. +1 −0 src/analysis/processing/qgsalgorithmtranslate.h
  94. +7 −1 src/core/processing/models/qgsprocessingmodelalgorithm.cpp
  95. +3 −1 src/core/processing/models/qgsprocessingmodelalgorithm.h
  96. +10 −0 src/core/processing/qgsprocessingalgorithm.h
  97. BIN tests/testdata/polys_overlapping_with_id.dbf
@@ -22,7 +22,7 @@ class QgsProcessingModelAlgorithm : QgsProcessingAlgorithm
%End
public:

QgsProcessingModelAlgorithm( const QString &name = QString(), const QString &group = QString() );
QgsProcessingModelAlgorithm( const QString &name = QString(), const QString &group = QString(), const QString &groupId = QString() );
%Docstring
Constructor for QgsProcessingModelAlgorithm.
%End
@@ -36,6 +36,8 @@ class QgsProcessingModelAlgorithm : QgsProcessingAlgorithm

virtual QString group() const;

virtual QString groupId() const;

virtual QIcon icon() const;

virtual QString svgIconPath() const;
@@ -158,10 +158,20 @@ class QgsProcessingAlgorithm
%Docstring
Returns the name of the group this algorithm belongs to. This string
should be localised.
.. seealso:: :py:func:`groupId()`
.. seealso:: :py:func:`tags()`
:rtype: str
%End

virtual QString groupId() const;
%Docstring
Returns the unique ID of the group this algorithm belongs to. This string
should be fixed for the algorithm, and must not be localised. The group id
should be unique within each provider. Group id should contain lowercase
alphanumeric characters only and no spaces or other formatting characters.
.. seealso:: :py:func:`group()`
:rtype: str
%End
virtual Flags flags() const;
%Docstring
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
@@ -49,6 +49,11 @@ QString QgsAddIncrementalFieldAlgorithm::group() const
return QObject::tr( "Vector table" );
}

QString QgsAddIncrementalFieldAlgorithm::groupId() const
{
return QStringLiteral( "vectortable" );
}

QString QgsAddIncrementalFieldAlgorithm::outputName() const
{
return QObject::tr( "Incremented" );
@@ -38,6 +38,7 @@ class QgsAddIncrementalFieldAlgorithm : public QgsProcessingFeatureBasedAlgorith
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QList<int> inputLayerTypes() const override;
QgsAddIncrementalFieldAlgorithm *createInstance() const override SIP_FACTORY;
@@ -39,6 +39,11 @@ QString QgsAssignProjectionAlgorithm::group() const
return QObject::tr( "Vector general" );
}

QString QgsAssignProjectionAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeneral" );
}

QString QgsAssignProjectionAlgorithm::outputName() const
{
return QObject::tr( "Assigned CRS" );
@@ -38,6 +38,7 @@ class QgsAssignProjectionAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsAssignProjectionAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,11 @@ QString QgsBoundaryAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsBoundaryAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QString QgsBoundaryAlgorithm::outputName() const
{
return QObject::tr( "Boundary" );
@@ -38,6 +38,7 @@ class QgsBoundaryAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString displayName() const override;
QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QList<int> inputLayerTypes() const override;
QgsBoundaryAlgorithm *createInstance() const override SIP_FACTORY;
@@ -39,6 +39,11 @@ QString QgsBoundingBoxAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsBoundingBoxAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QString QgsBoundingBoxAlgorithm::outputName() const
{
return QObject::tr( "Bounds" );
@@ -38,6 +38,7 @@ class QgsBoundingBoxAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsBoundingBoxAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,11 @@ QString QgsBufferAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsBufferAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

void QgsBufferAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
@@ -40,6 +40,7 @@ class QgsBufferAlgorithm : public QgsProcessingAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsBufferAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,11 @@ QString QgsCentroidAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsCentroidAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QString QgsCentroidAlgorithm::outputName() const
{
return QObject::tr( "Centroids" );
@@ -39,6 +39,7 @@ class QgsCentroidAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString displayName() const override;
QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsCentroidAlgorithm *createInstance() const override SIP_FACTORY;

@@ -40,6 +40,11 @@ QString QgsClipAlgorithm::group() const
return QObject::tr( "Vector overlay" );
}

QString QgsClipAlgorithm::groupId() const
{
return QStringLiteral( "vectoroverlay" );
}

void QgsClipAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
@@ -39,6 +39,7 @@ class QgsClipAlgorithm : public QgsProcessingAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsClipAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,11 @@ QString QgsConvexHullAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsConvexHullAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QString QgsConvexHullAlgorithm::outputName() const
{
return QObject::tr( "Convex hulls" );
@@ -39,6 +39,7 @@ class QgsConvexHullAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsConvexHullAlgorithm *createInstance() const override SIP_FACTORY;

@@ -181,6 +181,11 @@ QString QgsDissolveAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsDissolveAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}


void QgsDissolveAlgorithm::initAlgorithm( const QVariantMap & )
{
@@ -237,6 +242,11 @@ QString QgsCollectAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsCollectAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QVariantMap QgsCollectAlgorithm::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
return processCollection( parameters, context, feedback, []( const QVector< QgsGeometry > &parts )->QgsGeometry
@@ -50,6 +50,7 @@ class QgsDissolveAlgorithm : public QgsCollectorAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsDissolveAlgorithm *createInstance() const override SIP_FACTORY;

@@ -74,6 +75,7 @@ class QgsCollectAlgorithm : public QgsCollectorAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsCollectAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,11 @@ QString QgsDropGeometryAlgorithm::group() const
return QObject::tr( "Vector general" );
}

QString QgsDropGeometryAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeneral" );
}

QString QgsDropGeometryAlgorithm::outputName() const
{
return QObject::tr( "Dropped geometries" );
@@ -38,6 +38,7 @@ class QgsDropGeometryAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString displayName() const override;
QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsDropGeometryAlgorithm *createInstance() const override SIP_FACTORY;
QgsCoordinateReferenceSystem outputCrs( const QgsCoordinateReferenceSystem &inputCrs ) const override;
@@ -39,6 +39,11 @@ QString QgsDropMZValuesAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsDropMZValuesAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QString QgsDropMZValuesAlgorithm::outputName() const
{
return QObject::tr( "Z/M Dropped" );
@@ -38,6 +38,7 @@ class QgsDropMZValuesAlgorithm : public QgsProcessingFeatureBasedAlgorithm
QString displayName() const override;
QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsDropMZValuesAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,7 @@ class QgsExtentToLayerAlgorithm : public QgsProcessingAlgorithm
QString displayName() const override { return QObject::tr( "Create layer from extent" ); }
virtual QStringList tags() const override { return QObject::tr( "extent,layer,polygon,create,new" ).split( ',' ); }
QString group() const override { return QObject::tr( "Vector geometry" ); }
QString groupId() const override { return QStringLiteral( "vectorgeometry" ); }
QString shortHelpString() const override;
QgsExtentToLayerAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,11 @@ QString QgsExtractByAttributeAlgorithm::group() const
return QObject::tr( "Vector selection" );
}

QString QgsExtractByAttributeAlgorithm::groupId() const
{
return QStringLiteral( "vectorselection" );
}

void QgsExtractByAttributeAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
@@ -54,6 +54,7 @@ class QgsExtractByAttributeAlgorithm : public QgsProcessingAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsExtractByAttributeAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,11 @@ QString QgsExtractByExpressionAlgorithm::group() const
return QObject::tr( "Vector selection" );
}

QString QgsExtractByExpressionAlgorithm::groupId() const
{
return QStringLiteral( "vectorselection" );
}

void QgsExtractByExpressionAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
@@ -39,6 +39,7 @@ class QgsExtractByExpressionAlgorithm : public QgsProcessingAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsExtractByExpressionAlgorithm *createInstance() const override SIP_FACTORY;

@@ -39,6 +39,11 @@ QString QgsExtractByExtentAlgorithm::group() const
return QObject::tr( "Vector overlay" );
}

QString QgsExtractByExtentAlgorithm::groupId() const
{
return QStringLiteral( "vectoroverlay" );
}

void QgsExtractByExtentAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
@@ -39,6 +39,7 @@ class QgsExtractByExtentAlgorithm : public QgsProcessingAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsExtractByExtentAlgorithm *createInstance() const override SIP_FACTORY;

@@ -245,6 +245,11 @@ QString QgsSelectByLocationAlgorithm::group() const
return QObject::tr( "Vector selection" );
}

QString QgsSelectByLocationAlgorithm::groupId() const
{
return QStringLiteral( "vectorselection" );
}

QString QgsSelectByLocationAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm creates a selection in a vector layer. The criteria for selecting "
@@ -313,6 +318,11 @@ QString QgsExtractByLocationAlgorithm::group() const
return QObject::tr( "Vector selection" );
}

QString QgsExtractByLocationAlgorithm::groupId() const
{
return QStringLiteral( "vectorselection" );
}

QString QgsExtractByLocationAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm creates a new vector layer that only contains matching features from an "
@@ -67,6 +67,7 @@ class QgsSelectByLocationAlgorithm : public QgsLocationBasedAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsSelectByLocationAlgorithm *createInstance() const override SIP_FACTORY;

@@ -91,6 +92,7 @@ class QgsExtractByLocationAlgorithm : public QgsLocationBasedAlgorithm
QString displayName() const override;
virtual QStringList tags() const override;
QString group() const override;
QString groupId() const override;
QString shortHelpString() const override;
QgsExtractByLocationAlgorithm *createInstance() const override SIP_FACTORY;

@@ -42,6 +42,11 @@ QString QgsExtractNodesAlgorithm::group() const
return QObject::tr( "Vector geometry" );
}

QString QgsExtractNodesAlgorithm::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QString QgsExtractNodesAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm takes a line or polygon layer and generates a point layer with points representing the nodes in the input lines or polygons. The attributes associated to each point are the same ones associated to the line or polygon that the point belongs to." ) +

0 comments on commit 1d482cf

Please sign in to comment.
You can’t perform that action at this time.