Skip to content
Permalink
Browse files

Merge pull request #4831 from nyalldawson/processing_alg_config2

Minor refactoring to processing algorithms, future proofing some API
  • Loading branch information
nyalldawson committed Jul 11, 2017
2 parents 1693873 + 2b8e067 commit 726936eee24409d68ab4cab7c4dbc62b1a8c3c13
Showing with 705 additions and 94 deletions.
  1. +1 −0 cmake_templates/Doxyfile.in
  2. +6 −2 python/core/processing/models/qgsprocessingmodelalgorithm.sip
  3. +27 −0 python/core/processing/models/qgsprocessingmodelchildalgorithm.sip
  4. +70 −2 python/core/processing/qgsprocessingalgorithm.sip
  5. +17 −0 python/core/processing/qgsprocessingregistry.sip
  6. +1 −0 python/plugins/processing/algs/qgis/AddTableField.py
  7. +1 −0 python/plugins/processing/algs/qgis/Aspect.py
  8. +1 −0 python/plugins/processing/algs/qgis/AutoincrementalField.py
  9. +1 −0 python/plugins/processing/algs/qgis/BarPlot.py
  10. +1 −0 python/plugins/processing/algs/qgis/BasicStatistics.py
  11. +2 −0 python/plugins/processing/algs/qgis/Boundary.py
  12. +1 −0 python/plugins/processing/algs/qgis/BoundingBox.py
  13. +2 −0 python/plugins/processing/algs/qgis/BoxPlot.py
  14. +2 −0 python/plugins/processing/algs/qgis/CheckValidity.py
  15. +1 −0 python/plugins/processing/algs/qgis/ConcaveHull.py
  16. +2 −0 python/plugins/processing/algs/qgis/ConvexHull.py
  17. +2 −0 python/plugins/processing/algs/qgis/CreateAttributeIndex.py
  18. +2 −0 python/plugins/processing/algs/qgis/CreateConstantRaster.py
  19. +2 −0 python/plugins/processing/algs/qgis/Datasources2Vrt.py
  20. +2 −0 python/plugins/processing/algs/qgis/DefineProjection.py
  21. +1 −0 python/plugins/processing/algs/qgis/Delaunay.py
  22. +1 −0 python/plugins/processing/algs/qgis/DeleteColumn.py
  23. +2 −0 python/plugins/processing/algs/qgis/DeleteDuplicateGeometries.py
  24. +8 −6 python/plugins/processing/algs/qgis/DeleteHoles.py
  25. +1 −0 python/plugins/processing/algs/qgis/DensifyGeometries.py
  26. +1 −0 python/plugins/processing/algs/qgis/DensifyGeometriesInterval.py
  27. +2 −0 python/plugins/processing/algs/qgis/Difference.py
  28. +1 −0 python/plugins/processing/algs/qgis/DropGeometry.py
  29. +2 −0 python/plugins/processing/algs/qgis/EliminateSelection.py
  30. +2 −0 python/plugins/processing/algs/qgis/EquivalentNumField.py
  31. +2 −0 python/plugins/processing/algs/qgis/ExecuteSQL.py
  32. +2 −0 python/plugins/processing/algs/qgis/Explode.py
  33. +2 −0 python/plugins/processing/algs/qgis/ExportGeometryInfo.py
  34. +2 −0 python/plugins/processing/algs/qgis/ExtendLines.py
  35. +1 −0 python/plugins/processing/algs/qgis/ExtentFromLayer.py
  36. +2 −0 python/plugins/processing/algs/qgis/ExtractByLocation.py
  37. +2 −0 python/plugins/processing/algs/qgis/ExtractNodes.py
  38. +2 −0 python/plugins/processing/algs/qgis/ExtractSpecificNodes.py
  39. +2 −0 python/plugins/processing/algs/qgis/FieldPyculator.py
  40. +2 −0 python/plugins/processing/algs/qgis/FieldsCalculator.py
  41. +2 −0 python/plugins/processing/algs/qgis/FieldsMapper.py
  42. +2 −0 python/plugins/processing/algs/qgis/FindProjection.py
  43. +2 −0 python/plugins/processing/algs/qgis/FixGeometry.py
  44. +2 −0 python/plugins/processing/algs/qgis/FixedDistanceBuffer.py
  45. +2 −0 python/plugins/processing/algs/qgis/GeometryByExpression.py
  46. +2 −0 python/plugins/processing/algs/qgis/GeometryConvert.py
  47. +2 −0 python/plugins/processing/algs/qgis/GridLine.py
  48. +2 −0 python/plugins/processing/algs/qgis/GridPolygon.py
  49. +2 −0 python/plugins/processing/algs/qgis/Gridify.py
  50. +2 −0 python/plugins/processing/algs/qgis/Heatmap.py
  51. +2 −0 python/plugins/processing/algs/qgis/Hillshade.py
  52. +2 −0 python/plugins/processing/algs/qgis/HubDistanceLines.py
  53. +2 −0 python/plugins/processing/algs/qgis/HubDistancePoints.py
  54. +2 −0 python/plugins/processing/algs/qgis/HubLines.py
  55. +2 −0 python/plugins/processing/algs/qgis/HypsometricCurves.py
  56. +1 −0 python/plugins/processing/algs/qgis/IdwInterpolation.py
  57. +2 −0 python/plugins/processing/algs/qgis/ImportIntoPostGIS.py
  58. +2 −0 python/plugins/processing/algs/qgis/ImportIntoSpatialite.py
  59. +2 −0 python/plugins/processing/algs/qgis/Intersection.py
  60. +2 −0 python/plugins/processing/algs/qgis/JoinAttributes.py
  61. +2 −0 python/plugins/processing/algs/qgis/LinesIntersection.py
  62. +2 −0 python/plugins/processing/algs/qgis/LinesToPolygons.py
  63. +2 −0 python/plugins/processing/algs/qgis/MeanAndStdDevPlot.py
  64. +2 −0 python/plugins/processing/algs/qgis/MeanCoords.py
  65. +2 −0 python/plugins/processing/algs/qgis/Merge.py
  66. +2 −0 python/plugins/processing/algs/qgis/MergeLines.py
  67. +2 −0 python/plugins/processing/algs/qgis/NearestNeighbourAnalysis.py
  68. +2 −0 python/plugins/processing/algs/qgis/OffsetLine.py
  69. +2 −0 python/plugins/processing/algs/qgis/OrientedMinimumBoundingBox.py
  70. +2 −0 python/plugins/processing/algs/qgis/Orthogonalize.py
  71. +2 −0 python/plugins/processing/algs/qgis/PointDistance.py
  72. +2 −0 python/plugins/processing/algs/qgis/PointOnSurface.py
  73. +2 −0 python/plugins/processing/algs/qgis/PointsAlongGeometry.py
  74. +2 −0 python/plugins/processing/algs/qgis/PointsDisplacement.py
  75. +2 −0 python/plugins/processing/algs/qgis/PointsFromLines.py
  76. +2 −0 python/plugins/processing/algs/qgis/PointsFromPolygons.py
  77. +2 −0 python/plugins/processing/algs/qgis/PointsInPolygon.py
  78. +2 −0 python/plugins/processing/algs/qgis/PointsInPolygonUnique.py
  79. +2 −0 python/plugins/processing/algs/qgis/PointsInPolygonWeighted.py
  80. +1 −0 python/plugins/processing/algs/qgis/PointsLayerFromTable.py
  81. +2 −0 python/plugins/processing/algs/qgis/PointsToPaths.py
  82. +2 −0 python/plugins/processing/algs/qgis/PolarPlot.py
  83. +2 −0 python/plugins/processing/algs/qgis/PoleOfInaccessibility.py
  84. +2 −0 python/plugins/processing/algs/qgis/Polygonize.py
  85. +2 −0 python/plugins/processing/algs/qgis/PolygonsToLines.py
  86. +1 −0 python/plugins/processing/algs/qgis/PostGISExecuteSQL.py
  87. +1 −1 python/plugins/processing/algs/qgis/QgisAlgorithm.py
  88. +2 −0 python/plugins/processing/algs/qgis/RandomExtract.py
  89. +2 −0 python/plugins/processing/algs/qgis/RandomExtractWithinSubsets.py
  90. +2 −0 python/plugins/processing/algs/qgis/RandomPointsAlongLines.py
  91. +2 −0 python/plugins/processing/algs/qgis/RandomPointsExtent.py
  92. +2 −0 python/plugins/processing/algs/qgis/RandomPointsLayer.py
  93. +2 −0 python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py
  94. +2 −0 python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py
  95. +2 −0 python/plugins/processing/algs/qgis/RandomSelection.py
  96. +2 −0 python/plugins/processing/algs/qgis/RandomSelectionWithinSubsets.py
  97. +2 −0 python/plugins/processing/algs/qgis/RasterCalculator.py
  98. +2 −0 python/plugins/processing/algs/qgis/RasterLayerHistogram.py
  99. +2 −0 python/plugins/processing/algs/qgis/RasterLayerStatistics.py
  100. +2 −0 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py
  101. +2 −0 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py
  102. +2 −0 python/plugins/processing/algs/qgis/RegularPoints.py
  103. +1 −0 python/plugins/processing/algs/qgis/Relief.py
  104. +2 −0 python/plugins/processing/algs/qgis/RemoveNullGeometry.py
  105. +2 −0 python/plugins/processing/algs/qgis/ReverseLineDirection.py
  106. +2 −0 python/plugins/processing/algs/qgis/Ruggedness.py
  107. +1 −0 python/plugins/processing/algs/qgis/SaveSelectedFeatures.py
  108. +2 −0 python/plugins/processing/algs/qgis/SelectByAttribute.py
  109. +2 −0 python/plugins/processing/algs/qgis/SelectByAttributeSum.py
  110. +2 −0 python/plugins/processing/algs/qgis/SelectByExpression.py
  111. +2 −0 python/plugins/processing/algs/qgis/SelectByLocation.py
  112. +2 −0 python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
  113. +2 −0 python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py
  114. +2 −0 python/plugins/processing/algs/qgis/SetRasterStyle.py
  115. +2 −0 python/plugins/processing/algs/qgis/SetVectorStyle.py
  116. +2 −0 python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py
  117. +2 −0 python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py
  118. +2 −0 python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py
  119. +2 −0 python/plugins/processing/algs/qgis/SimplifyGeometries.py
  120. +2 −0 python/plugins/processing/algs/qgis/SinglePartsToMultiparts.py
  121. +2 −0 python/plugins/processing/algs/qgis/SingleSidedBuffer.py
  122. +2 −0 python/plugins/processing/algs/qgis/Slope.py
  123. +2 −0 python/plugins/processing/algs/qgis/Smooth.py
  124. +1 −0 python/plugins/processing/algs/qgis/SnapGeometries.py
  125. +2 −0 python/plugins/processing/algs/qgis/SpatialIndex.py
  126. +2 −0 python/plugins/processing/algs/qgis/SpatialJoin.py
  127. +2 −0 python/plugins/processing/algs/qgis/SpatialiteExecuteSQL.py
  128. +2 −0 python/plugins/processing/algs/qgis/SplitWithLines.py
  129. +2 −0 python/plugins/processing/algs/qgis/StatisticsByCategories.py
  130. +2 −0 python/plugins/processing/algs/qgis/SumLines.py
  131. +1 −0 python/plugins/processing/algs/qgis/SymmetricalDifference.py
  132. +2 −0 python/plugins/processing/algs/qgis/TextToFloat.py
  133. +2 −0 python/plugins/processing/algs/qgis/TinInterpolation.py
  134. +2 −0 python/plugins/processing/algs/qgis/TopoColors.py
  135. +2 −0 python/plugins/processing/algs/qgis/Translate.py
  136. +2 −0 python/plugins/processing/algs/qgis/TruncateTable.py
  137. +2 −0 python/plugins/processing/algs/qgis/Union.py
  138. +2 −0 python/plugins/processing/algs/qgis/UniqueValues.py
  139. +2 −0 python/plugins/processing/algs/qgis/VariableDistanceBuffer.py
  140. +2 −0 python/plugins/processing/algs/qgis/VectorLayerHistogram.py
  141. +2 −0 python/plugins/processing/algs/qgis/VectorLayerScatterplot.py
  142. +2 −0 python/plugins/processing/algs/qgis/VectorLayerScatterplot3D.py
  143. +1 −0 python/plugins/processing/algs/qgis/VectorSplit.py
  144. +1 −0 python/plugins/processing/algs/qgis/VoronoiPolygons.py
  145. +2 −0 python/plugins/processing/algs/qgis/ZonalStatistics.py
  146. +1 −1 python/plugins/processing/core/Processing.py
  147. +1 −1 python/plugins/processing/gui/AlgorithmLocatorFilter.py
  148. +11 −7 python/plugins/processing/gui/ProcessingToolbox.py
  149. +1 −1 python/plugins/processing/gui/TestTools.py
  150. +2 −2 python/plugins/processing/modeler/ModelerDialog.py
  151. +1 −1 python/plugins/processing/preconfigured/PreconfiguredAlgorithm.py
  152. +4 −1 python/plugins/processing/script/ScriptAlgorithm.py
  153. +2 −1 python/plugins/processing/tests/AlgorithmsTestBase.py
  154. +4 −1 python/plugins/processing/tests/QgisAlgorithmsTest.py
  155. +3 −3 python/plugins/processing/tools/general.py
  156. +1 −1 python/plugins/processing/tools/help.py
  157. +4 −0 scripts/sipify.pl
  158. +1 −1 scripts/spell_check/spelling.dat
  159. +7 −3 src/core/processing/models/qgsprocessingmodelalgorithm.cpp
  160. +4 −1 src/core/processing/models/qgsprocessingmodelalgorithm.h
  161. +48 −5 src/core/processing/models/qgsprocessingmodelchildalgorithm.cpp
  162. +33 −1 src/core/processing/models/qgsprocessingmodelchildalgorithm.h
  163. +18 −21 src/core/processing/qgsnativealgorithms.cpp
  164. +27 −26 src/core/processing/qgsnativealgorithms.h
  165. +8 −0 src/core/processing/qgsprocessingalgorithm.cpp
  166. +78 −4 src/core/processing/qgsprocessingalgorithm.h
  167. +10 −0 src/core/processing/qgsprocessingregistry.cpp
  168. +16 −0 src/core/processing/qgsprocessingregistry.h
  169. +4 −0 src/core/qgis_sip.h
  170. +32 −1 tests/src/core/testqgsprocessing.cpp
@@ -2073,6 +2073,7 @@ EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
"SIP_TRANSFER" \
"SIP_TRANSFERBACK" \
"SIP_TRANSFERTHIS" \
"SIP_VIRTUAL_CATCHER_CODE" \
"SIP_VIRTUALERRORHANDLER" \
"SIP_WHEN_FEATURE"

@@ -27,6 +27,9 @@ class QgsProcessingModelAlgorithm : QgsProcessingAlgorithm
Constructor for QgsProcessingModelAlgorithm.
%End

virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() ); //#spellok


virtual QString name() const;

virtual QString displayName() const;
@@ -46,8 +49,6 @@ class QgsProcessingModelAlgorithm : QgsProcessingAlgorithm

virtual QString asPythonCommand( const QVariantMap &parameters, QgsProcessingContext &context ) const;

virtual QgsProcessingModelAlgorithm *create() const /Factory/;


void setName( const QString &name );
%Docstring
@@ -364,6 +365,9 @@ Translated description of variable

protected:

virtual QgsProcessingAlgorithm *createInstance() const /Factory/;


virtual QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback );


@@ -29,6 +29,8 @@ class QgsProcessingModelChildAlgorithm : QgsProcessingModelComponent
should be set to a QgsProcessingAlgorithm algorithm ID.
%End

QgsProcessingModelChildAlgorithm( const QgsProcessingModelChildAlgorithm &other );

QString childId() const;
%Docstring
Returns the child algorithm's unique ID string, used the identify
@@ -68,6 +70,31 @@ class QgsProcessingModelChildAlgorithm : QgsProcessingModelComponent
should be set to an existing QgsProcessingAlgorithm algorithm ID.
.. seealso:: algorithm()
.. seealso:: algorithmId()
%End

QVariantMap configuration() const;
%Docstring
Returns the child algorithm's configuration map.

This map specifies configuration settings which are passed
to the algorithm, allowing it to dynamically adjust its initialized parameters
and outputs according to this configuration. This allows child algorithms in the model
to adjust their behavior at run time according to some user configuration.

.. seealso:: setConfiguration()
:rtype: QVariantMap
%End

void setConfiguration( const QVariantMap &configuration );
%Docstring
Sets the child algorithm's ``configuration`` map.

This map specifies configuration settings which are passed
to the algorithm, allowing it to dynamically adjust its initialized parameters
and outputs according to this configuration. This allows child algorithms in the model
to adjust their behavior at run time according to some user configuration.

.. seealso:: configuration()
%End

const QgsProcessingAlgorithm *algorithm() const;
@@ -11,6 +11,11 @@



%ModuleHeaderCode
#include <qgsprocessingmodelalgorithm.h>
%End


class QgsProcessingAlgorithm
{
%Docstring
@@ -20,6 +25,13 @@ class QgsProcessingAlgorithm

%TypeHeaderCode
#include "qgsprocessingalgorithm.h"
%End

%ConvertToSubClassCode
if ( dynamic_cast< QgsProcessingModelAlgorithm * >( sipCpp ) != NULL )
sipType = sipType_QgsProcessingModelAlgorithm;
else
sipType = sipType_QgsProcessingAlgorithm;
%End
public:

@@ -38,15 +50,29 @@ class QgsProcessingAlgorithm
QgsProcessingAlgorithm();
%Docstring
Constructor for QgsProcessingAlgorithm.

initAlgorithm() should be called after creating an algorithm to ensure it can correctly configure
its parameterDefinitions() and outputDefinitions(). Alternatively, calling create() will return
a pre-initialized copy of the algorithm.
%End

virtual ~QgsProcessingAlgorithm();



virtual QgsProcessingAlgorithm *create() const = 0 /Factory/;
QgsProcessingAlgorithm *create( const QVariantMap &configuration = QVariantMap() ) const /Factory/;
%Docstring
Creates a copy of the algorithm, ready for execution.

This method returns a new, preinitialized copy of the algorithm, ready for
executing.

The ``configuration`` argument allows passing of a map of configuration settings
to the algorithm, allowing it to dynamically adjust its initialized parameters
and outputs according to this configuration. This is generally used only for
algorithms in a model, allowing them to adjust their behavior at run time
according to some user configuration.

.. seealso:: initAlgorithm()
:rtype: QgsProcessingAlgorithm
%End

@@ -332,11 +358,49 @@ class QgsProcessingAlgorithm

protected:

virtual QgsProcessingAlgorithm *createInstance() const = 0;
%Docstring
Creates a new instance of the algorithm class.

This method should return a 'pristine' instance of the algorithm class.
:rtype: QgsProcessingAlgorithm
%End
%VirtualCatcherCode
PyObject *resObj = sipCallMethod( 0, sipMethod, "" );
sipIsErr = !resObj || sipParseResult( 0, sipMethod, resObj, "H2", sipType_QgsProcessingAlgorithm, &sipRes ) < 0;
if ( !sipIsErr )
sipTransferTo( resObj, Py_None );
%End

virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) = 0;
%Docstring
Initializes the algorithm using the specified ``configuration``.

This should be called directly after creating algorithms and before retrieving
any parameterDefinitions() or outputDefinitions().

Subclasses should use their implementations to add all required input parameter and output
definitions (which can be dynamically adjusted according to ``configuration``).

Dynamic configuration can be used by algorithms which alter their behavior
when used inside processing models. For instance, a "feature router" type
algorithm which sends input features to one of any number of outputs sinks
based on some preconfigured filter parameters can use the init method to
create these outputs based on the specified ``configuration``.

.. seealso:: addParameter()
.. seealso:: addOutput()
%End

bool addParameter( QgsProcessingParameterDefinition *parameterDefinition /Transfer/ );
%Docstring
Adds a parameter ``definition`` to the algorithm. Ownership of the definition is transferred to the algorithm.
Returns true if parameter could be successfully added, or false if the parameter could not be added (e.g.
as a result of a duplicate name).

This should usually be called from a subclass' initAlgorithm() implementation.

.. seealso:: initAlgorithm()
.. seealso:: addOutput()
:rtype: bool
%End
@@ -352,7 +416,11 @@ class QgsProcessingAlgorithm
Adds an output ``definition`` to the algorithm. Ownership of the definition is transferred to the algorithm.
Returns true if the output could be successfully added, or false if the output could not be added (e.g.
as a result of a duplicate name).

This should usually be called from a subclass' initAlgorithm() implementation.

.. seealso:: addParameter()
.. seealso:: initAlgorithm()
:rtype: bool
%End

@@ -85,6 +85,23 @@ class QgsProcessingRegistry : QObject
Finds an algorithm by its ID. If no matching algorithm is found, a None
is returned.
.. seealso:: algorithms()
.. seealso:: createAlgorithmById()
:rtype: QgsProcessingAlgorithm
%End

QgsProcessingAlgorithm *createAlgorithmById( const QString &id, const QVariantMap &configuration = QVariantMap() ) const /Factory/;
%Docstring
Creates a new instance of an algorithm by its ID. If no matching algorithm is found, a None
is returned. Callers take responsibility for deleting the returned object.

The ``configuration`` argument allows passing of a map of configuration settings
to the algorithm, allowing it to dynamically adjust its initialized parameters
and outputs according to this configuration. This is generally used only for
algorithms in a model, allowing them to adjust their behavior at run time
according to some user configuration.

.. seealso:: algorithms()
.. seealso:: algorithmById()
:rtype: QgsProcessingAlgorithm
%End

@@ -60,6 +60,7 @@ def __init__(self):
self.tr('Float'),
self.tr('String')]

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT_LAYER,
self.tr('Input layer')))
self.addParameter(QgsProcessingParameterString(self.FIELD_NAME,
@@ -60,6 +60,7 @@ def group(self):
def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT,
self.tr('Elevation layer')))
self.addParameter(QgsProcessingParameterNumber(self.Z_FACTOR,
@@ -45,6 +45,7 @@ class AutoincrementalField(QgisAlgorithm):
def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer')))

@@ -53,6 +53,7 @@ def group(self):
def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer')))
self.addParameter(QgsProcessingParameterField(self.NAME_FIELD,
@@ -88,6 +88,7 @@ def group(self):
def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT_LAYER,
self.tr('Input layer')))

@@ -55,6 +55,8 @@ class Boundary(QgisAlgorithm):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT_LAYER, self.tr('Input layer'), [QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorPolygon]))
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT_LAYER, self.tr('Boundary')))
self.addOutput(QgsProcessingOutputVectorLayer(self.OUTPUT_LAYER, self.tr("Boundaries")))
@@ -63,6 +63,7 @@ def group(self):
def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT_LAYER, self.tr('Input layer')))
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT_LAYER, self.tr('Bounds'), QgsProcessing.TypeVectorPolygon))
self.addOutput(QgsProcessingOutputVectorLayer(self.OUTPUT_LAYER, self.tr("Bounds")))
@@ -52,6 +52,8 @@ def group(self):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(ParameterTable(self.INPUT, self.tr('Input table')))
self.addParameter(ParameterTableField(self.NAME_FIELD,
self.tr('Category name field'),
@@ -73,6 +73,8 @@ def group(self):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.methods = [self.tr('The one selected in digitizing settings'),
'QGIS',
'GEOS']
@@ -61,6 +61,7 @@ def group(self):
def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.tr('Input point layer'), [QgsProcessing.TypeVectorPoint]))
self.addParameter(QgsProcessingParameterNumber(self.ALPHA,
self.tr('Threshold (0-1, where 1 is equivalent with Convex Hull)'),
@@ -65,6 +65,8 @@ def group(self):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.methods = [self.tr('Create single minimum convex hull'),
self.tr('Create convex hulls based on field')]

@@ -47,6 +47,8 @@ def group(self):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterVectorLayer(self.INPUT,
self.tr('Input Layer')))
self.addParameter(QgsProcessingParameterField(self.FIELD,
@@ -47,6 +47,8 @@ def group(self):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(ParameterRaster(self.INPUT,
self.tr('Reference layer')))
self.addParameter(ParameterNumber(self.NUMBER,
@@ -53,6 +53,8 @@ def group(self):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(ParameterMultipleInput(self.DATASOURCES,
self.tr('Input datasources'),
dataobjects.TYPE_TABLE))
@@ -52,6 +52,8 @@ def group(self):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input Layer')))
self.addParameter(ParameterCrs(self.CRS, 'Output CRS'))
@@ -68,6 +68,7 @@ def group(self):
def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.tr('Input layer'), [QgsProcessing.TypeVectorPoint]))
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Delaunay triangulation'), type=QgsProcessing.TypeVectorPolygon))
self.addOutput(QgsProcessingOutputVectorLayer(self.OUTPUT, self.tr("Delaunay triangulation"), type=QgsProcessing.TypeVectorPolygon))
@@ -50,6 +50,7 @@ def group(self):
def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.tr('Input layer')))
self.addParameter(QgsProcessingParameterField(self.COLUMNS,
self.tr('Fields to drop'),
@@ -44,6 +44,8 @@ def group(self):

def __init__(self):
super().__init__()

def initAlgorithm(self, config=None):
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Cleaned')))

0 comments on commit 726936e

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