Skip to content
Permalink
Browse files
Merge pull request #4311 from nyalldawson/proc_c4
Simple c++ base class for processing algorithms
  • Loading branch information
nyalldawson committed Apr 4, 2017
2 parents 85e83e1 + d2a242a commit 51517fd77eb51da7ffc1e277b8be2c22aacde90b
Showing with 3,413 additions and 1,056 deletions.
  1. +1 −0 python/core/core.sip
  2. +99 −0 python/core/processing/qgsprocessingalgorithm.sip
  3. +29 −0 python/core/processing/qgsprocessingprovider.sip
  4. +11 −6 python/plugins/processing/algs/exampleprovider/ExampleAlgorithm.py
  5. +10 −4 python/plugins/processing/algs/gdal/AssignProjection.py
  6. +10 −4 python/plugins/processing/algs/gdal/ClipByExtent.py
  7. +10 −4 python/plugins/processing/algs/gdal/ClipByMask.py
  8. +8 −5 python/plugins/processing/algs/gdal/ColorRelief.py
  9. +5 −5 python/plugins/processing/algs/gdal/GdalAlgorithm.py
  10. +1 −1 python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py
  11. +10 −3 python/plugins/processing/algs/gdal/GridAverage.py
  12. +10 −3 python/plugins/processing/algs/gdal/GridDataMetrics.py
  13. +9 −5 python/plugins/processing/algs/gdal/GridInvDist.py
  14. +9 −5 python/plugins/processing/algs/gdal/GridNearest.py
  15. +9 −2 python/plugins/processing/algs/gdal/aspect.py
  16. +10 −3 python/plugins/processing/algs/gdal/buildvrt.py
  17. +10 −3 python/plugins/processing/algs/gdal/contour.py
  18. +10 −3 python/plugins/processing/algs/gdal/extractprojection.py
  19. +9 −2 python/plugins/processing/algs/gdal/fillnodata.py
  20. +8 −5 python/plugins/processing/algs/gdal/gdal2tiles.py
  21. +9 −2 python/plugins/processing/algs/gdal/gdal2xyz.py
  22. +9 −5 python/plugins/processing/algs/gdal/gdaladdo.py
  23. +9 −2 python/plugins/processing/algs/gdal/gdalcalc.py
  24. +10 −3 python/plugins/processing/algs/gdal/gdaltindex.py
  25. +9 −2 python/plugins/processing/algs/gdal/hillshade.py
  26. +9 −5 python/plugins/processing/algs/gdal/information.py
  27. +10 −3 python/plugins/processing/algs/gdal/merge.py
  28. +10 −3 python/plugins/processing/algs/gdal/nearblack.py
  29. +9 −3 python/plugins/processing/algs/gdal/offsetcurve.py
  30. +9 −3 python/plugins/processing/algs/gdal/ogr2ogr.py
  31. +9 −3 python/plugins/processing/algs/gdal/ogr2ogrbuffer.py
  32. +9 −3 python/plugins/processing/algs/gdal/ogr2ogrclip.py
  33. +9 −3 python/plugins/processing/algs/gdal/ogr2ogrclipextent.py
  34. +9 −3 python/plugins/processing/algs/gdal/ogr2ogrdissolve.py
  35. +9 −3 python/plugins/processing/algs/gdal/ogr2ogrpointsonlines.py
  36. +9 −2 python/plugins/processing/algs/gdal/ogr2ogrtabletopostgislist.py
  37. +9 −2 python/plugins/processing/algs/gdal/ogr2ogrtopostgis.py
  38. +9 −2 python/plugins/processing/algs/gdal/ogr2ogrtopostgislist.py
  39. +8 −5 python/plugins/processing/algs/gdal/ogrinfo.py
  40. +9 −3 python/plugins/processing/algs/gdal/ogrsql.py
  41. +9 −3 python/plugins/processing/algs/gdal/onesidebuffer.py
  42. +10 −3 python/plugins/processing/algs/gdal/pct2rgb.py
  43. +9 −5 python/plugins/processing/algs/gdal/polygonize.py
  44. +9 −5 python/plugins/processing/algs/gdal/proximity.py
  45. +9 −6 python/plugins/processing/algs/gdal/rasterize.py
  46. +9 −5 python/plugins/processing/algs/gdal/rasterize_over.py
  47. +9 −6 python/plugins/processing/algs/gdal/retile.py
  48. +10 −3 python/plugins/processing/algs/gdal/rgb2pct.py
  49. +9 −2 python/plugins/processing/algs/gdal/roughness.py
  50. +10 −3 python/plugins/processing/algs/gdal/sieve.py
  51. +9 −2 python/plugins/processing/algs/gdal/slope.py
  52. +9 −2 python/plugins/processing/algs/gdal/tpi.py
  53. +9 −6 python/plugins/processing/algs/gdal/translate.py
  54. +9 −2 python/plugins/processing/algs/gdal/tri.py
  55. +13 −5 python/plugins/processing/algs/gdal/warp.py
  56. +27 −13 python/plugins/processing/algs/grass7/Grass7Algorithm.py
  57. +2 −5 python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py
  58. +1 −1 python/plugins/processing/algs/grass7/ext/r_texture.py
  59. +15 −8 python/plugins/processing/algs/grass7/nviz7.py
  60. +18 −3 python/plugins/processing/algs/qgis/AddTableField.py
  61. +10 −4 python/plugins/processing/algs/qgis/Aspect.py
  62. +18 −3 python/plugins/processing/algs/qgis/AutoincrementalField.py
  63. +16 −3 python/plugins/processing/algs/qgis/BarPlot.py
  64. +14 −7 python/plugins/processing/algs/qgis/BasicStatistics.py
  65. +17 −10 python/plugins/processing/algs/qgis/BasicStatisticsNumbers.py
  66. +17 −9 python/plugins/processing/algs/qgis/BasicStatisticsStrings.py
  67. +10 −4 python/plugins/processing/algs/qgis/Boundary.py
  68. +10 −4 python/plugins/processing/algs/qgis/BoundingBox.py
  69. +10 −4 python/plugins/processing/algs/qgis/Centroids.py
  70. +10 −4 python/plugins/processing/algs/qgis/CheckValidity.py
  71. +10 −3 python/plugins/processing/algs/qgis/Clip.py
  72. +22 −4 python/plugins/processing/algs/qgis/ConcaveHull.py
  73. +10 −4 python/plugins/processing/algs/qgis/ConvexHull.py
  74. +18 −4 python/plugins/processing/algs/qgis/CreateAttributeIndex.py
  75. +16 −3 python/plugins/processing/algs/qgis/CreateConstantRaster.py
  76. +17 −4 python/plugins/processing/algs/qgis/Datasources2Vrt.py
  77. +17 −4 python/plugins/processing/algs/qgis/DefineProjection.py
  78. +10 −4 python/plugins/processing/algs/qgis/Delaunay.py
  79. +19 −4 python/plugins/processing/algs/qgis/DeleteColumn.py
  80. +17 −4 python/plugins/processing/algs/qgis/DeleteDuplicateGeometries.py
  81. +19 −4 python/plugins/processing/algs/qgis/DeleteHoles.py
  82. +22 −5 python/plugins/processing/algs/qgis/DensifyGeometries.py
  83. +19 −4 python/plugins/processing/algs/qgis/DensifyGeometriesInterval.py
  84. +10 −3 python/plugins/processing/algs/qgis/Difference.py
  85. +10 −3 python/plugins/processing/algs/qgis/Dissolve.py
  86. +22 −5 python/plugins/processing/algs/qgis/DropGeometry.py
  87. +11 −5 python/plugins/processing/algs/qgis/EliminateSelection.py
  88. +18 −3 python/plugins/processing/algs/qgis/EquivalentNumField.py
  89. +20 −5 python/plugins/processing/algs/qgis/ExecuteSQL.py
  90. +19 −3 python/plugins/processing/algs/qgis/Explode.py
  91. +13 −5 python/plugins/processing/algs/qgis/ExportGeometryInfo.py
  92. +16 −4 python/plugins/processing/algs/qgis/ExtendLines.py
  93. +13 −5 python/plugins/processing/algs/qgis/ExtentFromLayer.py
  94. +21 −5 python/plugins/processing/algs/qgis/ExtractByAttribute.py
  95. +21 −5 python/plugins/processing/algs/qgis/ExtractByExpression.py
  96. +20 −5 python/plugins/processing/algs/qgis/ExtractByLocation.py
  97. +10 −4 python/plugins/processing/algs/qgis/ExtractNodes.py
  98. +20 −4 python/plugins/processing/algs/qgis/ExtractSpecificNodes.py
  99. +18 −4 python/plugins/processing/algs/qgis/FieldPyculator.py
  100. +24 −4 python/plugins/processing/algs/qgis/FieldsCalculator.py
  101. +22 −4 python/plugins/processing/algs/qgis/FieldsMapper.py
  102. +20 −6 python/plugins/processing/algs/qgis/FindProjection.py
  103. +21 −5 python/plugins/processing/algs/qgis/FixGeometry.py
  104. +10 −4 python/plugins/processing/algs/qgis/FixedDistanceBuffer.py
  105. +21 −4 python/plugins/processing/algs/qgis/GeometryByExpression.py
  106. +19 −4 python/plugins/processing/algs/qgis/GeometryConvert.py
  107. +13 −5 python/plugins/processing/algs/qgis/GridLine.py
  108. +13 −5 python/plugins/processing/algs/qgis/GridPolygon.py
  109. +20 −4 python/plugins/processing/algs/qgis/Gridify.py
  110. +13 −5 python/plugins/processing/algs/qgis/Heatmap.py
  111. +10 −4 python/plugins/processing/algs/qgis/Hillshade.py
  112. +22 −4 python/plugins/processing/algs/qgis/HubDistanceLines.py
  113. +22 −4 python/plugins/processing/algs/qgis/HubDistancePoints.py
  114. +20 −4 python/plugins/processing/algs/qgis/HubLines.py
  115. +18 −5 python/plugins/processing/algs/qgis/HypsometricCurves.py
  116. +10 −4 python/plugins/processing/algs/qgis/IdwInterpolation.py
  117. +18 −3 python/plugins/processing/algs/qgis/ImportIntoPostGIS.py
  118. +18 −3 python/plugins/processing/algs/qgis/ImportIntoSpatialite.py
  119. +10 −3 python/plugins/processing/algs/qgis/Intersection.py
  120. +17 −3 python/plugins/processing/algs/qgis/JoinAttributes.py
  121. +10 −4 python/plugins/processing/algs/qgis/LinesIntersection.py
  122. +13 −5 python/plugins/processing/algs/qgis/LinesToPolygons.py
  123. +16 −3 python/plugins/processing/algs/qgis/MeanAndStdDevPlot.py
  124. +10 −4 python/plugins/processing/algs/qgis/MeanCoords.py
  125. +10 −4 python/plugins/processing/algs/qgis/Merge.py
  126. +13 −5 python/plugins/processing/algs/qgis/MergeLines.py
  127. +10 −4 python/plugins/processing/algs/qgis/MultipartToSingleparts.py
  128. +10 −4 python/plugins/processing/algs/qgis/NearestNeighbourAnalysis.py
  129. +17 −4 python/plugins/processing/algs/qgis/OffsetLine.py
  130. +22 −4 python/plugins/processing/algs/qgis/OrientedMinimumBoundingBox.py
  131. +19 −5 python/plugins/processing/algs/qgis/Orthogonalize.py
  132. +10 −4 python/plugins/processing/algs/qgis/PointDistance.py
  133. +10 −4 python/plugins/processing/algs/qgis/PointOnSurface.py
  134. +13 −5 python/plugins/processing/algs/qgis/PointsAlongGeometry.py
  135. +20 −4 python/plugins/processing/algs/qgis/PointsDisplacement.py
  136. +22 −4 python/plugins/processing/algs/qgis/PointsFromLines.py
  137. +22 −4 python/plugins/processing/algs/qgis/PointsFromPolygons.py
  138. +10 −4 python/plugins/processing/algs/qgis/PointsInPolygon.py
  139. +20 −3 python/plugins/processing/algs/qgis/PointsInPolygonUnique.py
  140. +20 −4 python/plugins/processing/algs/qgis/PointsInPolygonWeighted.py
  141. +23 −4 python/plugins/processing/algs/qgis/PointsLayerFromTable.py
  142. +22 −3 python/plugins/processing/algs/qgis/PointsToPaths.py
  143. +16 −3 python/plugins/processing/algs/qgis/PolarPlot.py
  144. +13 −5 python/plugins/processing/algs/qgis/PoleOfInaccessibility.py
  145. +16 −8 python/plugins/processing/algs/qgis/PolygonCentroids.py
  146. +20 −4 python/plugins/processing/algs/qgis/Polygonize.py
  147. +13 −5 python/plugins/processing/algs/qgis/PolygonsToLines.py
  148. +16 −2 python/plugins/processing/algs/qgis/PostGISExecuteSQL.py
  149. +0 −3 python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py
  150. +16 −3 python/plugins/processing/algs/qgis/RandomExtract.py
  151. +16 −3 python/plugins/processing/algs/qgis/RandomExtractWithinSubsets.py
  152. +24 −5 python/plugins/processing/algs/qgis/RandomPointsAlongLines.py
  153. +10 −3 python/plugins/processing/algs/qgis/RandomPointsExtent.py
  154. +10 −4 python/plugins/processing/algs/qgis/RandomPointsLayer.py
  155. +10 −4 python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py
  156. +10 −4 python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py
  157. +10 −4 python/plugins/processing/algs/qgis/RandomSelection.py
  158. +10 −4 python/plugins/processing/algs/qgis/RandomSelectionWithinSubsets.py
  159. +21 −9 python/plugins/processing/algs/qgis/RasterCalculator.py
  160. +16 −3 python/plugins/processing/algs/qgis/RasterLayerHistogram.py
  161. +16 −3 python/plugins/processing/algs/qgis/RasterLayerStatistics.py
  162. +20 −4 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py
  163. +20 −4 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py
  164. +10 −4 python/plugins/processing/algs/qgis/RegularPoints.py
  165. +10 −4 python/plugins/processing/algs/qgis/Relief.py
  166. +19 −4 python/plugins/processing/algs/qgis/RemoveNullGeometry.py
  167. +13 −5 python/plugins/processing/algs/qgis/ReprojectLayer.py
  168. +18 −4 python/plugins/processing/algs/qgis/ReverseLineDirection.py
  169. +10 −4 python/plugins/processing/algs/qgis/Ruggedness.py
  170. +16 −3 python/plugins/processing/algs/qgis/SaveSelectedFeatures.py
  171. +19 −4 python/plugins/processing/algs/qgis/SelectByAttribute.py
  172. +18 −4 python/plugins/processing/algs/qgis/SelectByAttributeSum.py
  173. +18 −4 python/plugins/processing/algs/qgis/SelectByExpression.py
  174. +10 −4 python/plugins/processing/algs/qgis/SelectByLocation.py
  175. +10 −4 python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
  176. +10 −4 python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py
  177. +16 −2 python/plugins/processing/algs/qgis/SetRasterStyle.py
  178. +16 −2 python/plugins/processing/algs/qgis/SetVectorStyle.py
  179. +10 −4 python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py
  180. +10 −4 python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py
  181. +10 −4 python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py
  182. +10 −4 python/plugins/processing/algs/qgis/SimplifyGeometries.py
  183. +10 −4 python/plugins/processing/algs/qgis/SinglePartsToMultiparts.py
  184. +18 −4 python/plugins/processing/algs/qgis/SingleSidedBuffer.py
  185. +10 −4 python/plugins/processing/algs/qgis/Slope.py
  186. +16 −3 python/plugins/processing/algs/qgis/Smooth.py
  187. +17 −4 python/plugins/processing/algs/qgis/SnapGeometries.py
  188. +16 −6 python/plugins/processing/algs/qgis/SpatialIndex.py
  189. +10 −4 python/plugins/processing/algs/qgis/SpatialJoin.py
  190. +17 −3 python/plugins/processing/algs/qgis/SpatialiteExecuteSQL.py
  191. +23 −7 python/plugins/processing/algs/qgis/SplitLinesWithLines.py
  192. +21 −4 python/plugins/processing/algs/qgis/SplitWithLines.py
  193. +17 −4 python/plugins/processing/algs/qgis/StatisticsByCategories.py
  194. +10 −4 python/plugins/processing/algs/qgis/SumLines.py
  195. +10 −3 python/plugins/processing/algs/qgis/SymmetricalDifference.py
  196. +17 −4 python/plugins/processing/algs/qgis/TextToFloat.py
  197. +10 −4 python/plugins/processing/algs/qgis/TinInterpolation.py
  198. +20 −5 python/plugins/processing/algs/qgis/TopoColors.py
  199. +16 −3 python/plugins/processing/algs/qgis/Translate.py
  200. +19 −4 python/plugins/processing/algs/qgis/TruncateTable.py
  201. +10 −3 python/plugins/processing/algs/qgis/Union.py
  202. +10 −3 python/plugins/processing/algs/qgis/UniqueValues.py
  203. +10 −4 python/plugins/processing/algs/qgis/VariableDistanceBuffer.py
  204. +20 −8 python/plugins/processing/algs/qgis/VectorGridLines.py
  205. +20 −8 python/plugins/processing/algs/qgis/VectorGridPolygons.py
  206. +16 −3 python/plugins/processing/algs/qgis/VectorLayerHistogram.py
  207. +16 −3 python/plugins/processing/algs/qgis/VectorLayerScatterplot.py
  208. +10 −4 python/plugins/processing/algs/qgis/VectorSplit.py
  209. +10 −4 python/plugins/processing/algs/qgis/VoronoiPolygons.py
  210. +19 −4 python/plugins/processing/algs/qgis/ZonalStatistics.py
  211. +10 −4 python/plugins/processing/algs/qgis/ZonalStatisticsQgis.py
  212. +27 −10 python/plugins/processing/algs/r/RAlgorithm.py
  213. +1 −1 python/plugins/processing/algs/r/RAlgorithmProvider.py
  214. +29 −12 python/plugins/processing/algs/saga/SagaAlgorithm.py
  215. +3 −3 python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
  216. +10 −3 python/plugins/processing/algs/saga/SplitRGBBands.py
  217. +0 −12 python/plugins/processing/core/AlgorithmProvider.py
  218. +8 −38 python/plugins/processing/core/GeoAlgorithm.py
  219. +3 −3 python/plugins/processing/core/Processing.py
  220. +6 −6 python/plugins/processing/core/outputs.py
  221. +2 −2 python/plugins/processing/core/parameters.py
  222. +2 −2 python/plugins/processing/gui/AlgorithmDialog.py
  223. +3 −3 python/plugins/processing/gui/BatchAlgorithmDialog.py
  224. +1 −1 python/plugins/processing/gui/ConfigDialog.py
  225. +1 −1 python/plugins/processing/gui/EditRenderingStylesDialog.py
  226. +2 −2 python/plugins/processing/gui/NumberInputPanel.py
  227. +1 −1 python/plugins/processing/gui/Postprocessing.py
  228. +13 −11 python/plugins/processing/gui/ProcessingToolbox.py
  229. +2 −2 python/plugins/processing/gui/menus.py
  230. +54 −28 python/plugins/processing/modeler/ModelerAlgorithm.py
  231. +1 −1 python/plugins/processing/modeler/ModelerAlgorithmProvider.py
  232. +18 −16 python/plugins/processing/modeler/ModelerDialog.py
  233. +7 −7 python/plugins/processing/modeler/ModelerGraphicItem.py
  234. +6 −6 python/plugins/processing/modeler/ModelerParametersDialog.py
  235. +11 −10 python/plugins/processing/modeler/ModelerScene.py
  236. +18 −8 python/plugins/processing/preconfigured/PreconfiguredAlgorithm.py
  237. +30 −10 python/plugins/processing/script/ScriptAlgorithm.py
  238. +1 −1 python/plugins/processing/script/ScriptSelector.py
  239. +1 −1 python/plugins/processing/script/ScriptUtils.py
  240. +0 −5 python/plugins/processing/tools/dataobjects.py
  241. +5 −5 python/plugins/processing/tools/general.py
  242. +3 −3 python/plugins/processing/tools/help.py
  243. +3 −3 python/plugins/processing/tools/translation.py
  244. +2 −0 src/core/CMakeLists.txt
  245. +34 −0 src/core/processing/qgsprocessingalgorithm.cpp
  246. +106 −0 src/core/processing/qgsprocessingalgorithm.h
  247. +6 −0 src/core/processing/qgsprocessingprovider.cpp
  248. +29 −0 src/core/processing/qgsprocessingprovider.h
  249. +2 −0 src/core/processing/qgsprocessingregistry.cpp
@@ -273,6 +273,7 @@
%Include layertree/qgslayertreeregistrybridge.sip
%Include layertree/qgslayertreeutils.sip

%Include processing/qgsprocessingalgorithm.sip
%Include processing/qgsprocessingfeedback.sip
%Include processing/qgsprocessingprovider.sip
%Include processing/qgsprocessingregistry.sip
@@ -0,0 +1,99 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingalgorithm.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsProcessingAlgorithm
{
%Docstring
Abstract base class for processing algorithms.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprocessingalgorithm.h"
%End
public:

enum Flag
{
FlagHideFromToolbox,
FlagHideFromModeler,
FlagSupportsBatch,
FlagDeprecated
};
typedef QFlags<QgsProcessingAlgorithm::Flag> Flags;

QgsProcessingAlgorithm();
%Docstring
Constructor for QgsProcessingAlgorithm.
%End

virtual ~QgsProcessingAlgorithm();

virtual QString name() const = 0;
%Docstring
Returns the algorithm name, used for identifying the algorithm. This string
should be fixed for the algorithm, and must not be localised. The name should
be unique within each provider. Names should contain lowercase alphanumeric characters
only and no spaces or other formatting characters.
\see displayName()
\see group()
\see tags()
%End

virtual QString displayName() const = 0;
%Docstring
Returns the translated algorithm name, which should be used for any user-visible display
of the algorithm name.
\see name()
%End

virtual QStringList tags() const;
%Docstring
Returns a list of tags which relate to the algorithm, and are used to assist users in searching
for suitable algorithms. These tags should be localised.
%End

virtual QIcon icon() const;
%Docstring
Returns an icon for the algorithm.
\see svgIconPath()
%End

virtual QString svgIconPath() const;
%Docstring
Returns a path to an SVG version of the algorithm's icon.
\see icon()
%End

virtual QString group() const;
%Docstring
Returns the name of the group this algorithm belongs to. This string
should be localised.
\see tags()
%End

virtual Flags flags() const;
%Docstring
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
%End

};
QFlags<QgsProcessingAlgorithm::Flag> operator|(QgsProcessingAlgorithm::Flag f1, QFlags<QgsProcessingAlgorithm::Flag> f2);



/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingalgorithm.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -66,6 +66,35 @@ class QgsProcessingProvider
missing external dependencies).
%End

virtual QStringList supportedOutputRasterLayerExtensions() const;
%Docstring
Returns a list of the raster format file extensions supported by this provider.
\see supportedOutputVectorLayerExtensions()
\see supportedOutputTableExtensions()
%End

virtual QStringList supportedOutputVectorLayerExtensions() const;
%Docstring
Returns a list of the vector format file extensions supported by this provider.
\see supportedOutputRasterLayerExtensions()
\see supportedOutputTableExtensions()
\see supportsNonFileBasedOutput()
%End

virtual QStringList supportedOutputTableExtensions() const;
%Docstring
Returns a list of the table format file extensions supported by this provider.
\see supportedOutputRasterLayerExtensions()
\see supportedOutputVectorLayerExtensions()
%End

virtual bool supportsNonFileBasedOutput() const;
%Docstring
Returns true if the provider supports non-file based outputs (such as memory layers
or direct database outputs).
\see supportedOutputVectorLayerExtensions()
%End

private:
QgsProcessingProvider( const QgsProcessingProvider &other );
};
@@ -54,17 +54,22 @@ class ExampleAlgorithm(GeoAlgorithm):
OUTPUT_LAYER = 'OUTPUT_LAYER'
INPUT_LAYER = 'INPUT_LAYER'

def name(self):
# Unique (non-user visible) name of algorithm
return 'create_copy_of_layer'

def displayName(self):
# The name that the user will see in the toolbox
return self.tr('Create copy of layer')

def group(self):
return self.tr('Algorithms for vector layers')

def defineCharacteristics(self):
"""Here we define the inputs and output of the algorithm, along
with some other properties.
"""

# The name that the user will see in the toolbox
self.name, self.i18n_name = self.trAlgorithm('Create copy of layer')

# The branch of the toolbox under which the algorithm will appear
self.group, self.i18n_group = self.trAlgorithm('Algorithms for vector layers')

# We add the input vector layer. It can have any kind of geometry
# It is a mandatory (not optional) one, hence the False argument
self.addParameter(ParameterVector(self.INPUT_LAYER,
@@ -46,13 +46,19 @@ class AssignProjection(GdalAlgorithm):
CRS = 'CRS'
OUTPUT = 'OUTPUT'

def getIcon(self):
def name(self):
return 'assignprojection'

def displayName(self):
return self.tr('Assign projection')

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'projection-add.png'))

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Assign projection')
self.group, self.i18n_group = self.trAlgorithm('Raster projections')
def group(self):
return self.tr('Raster projections')

def defineCharacteristics(self):
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterCrs(self.CRS,
self.tr('Desired CRS'), ''))
@@ -53,13 +53,19 @@ class ClipByExtent(GdalAlgorithm):
RTYPE = 'RTYPE'
TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']

def getIcon(self):
def name(self):
return 'cliprasterbyextent'

def displayName(self):
return self.tr('Clip raster by extent')

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'raster-clip.png'))

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Clip raster by extent')
self.group, self.i18n_group = self.trAlgorithm('Raster extraction')
def group(self):
return self.tr('Raster extraction')

def defineCharacteristics(self):
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer')))
self.addParameter(ParameterString(self.NO_DATA,
self.tr("Nodata value, leave blank to take the nodata value from input"),
@@ -62,13 +62,19 @@ class ClipByMask(GdalAlgorithm):
RTYPE = 'RTYPE'
TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']

def getIcon(self):
def name(self):
return 'cliprasterbymasklayer'

def displayName(self):
return self.tr('Clip raster by mask layer')

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'raster-clip.png'))

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Clip raster by mask layer')
self.group, self.i18n_group = self.trAlgorithm('Raster extraction')
def group(self):
return self.tr('Raster extraction')

def defineCharacteristics(self):
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterVector(self.MASK, self.tr('Mask layer'),
[dataobjects.TYPE_VECTOR_POLYGON]))
@@ -47,13 +47,16 @@ class ColorRelief(GdalAlgorithm):

MATCHING_MODES = ['"0,0,0,0" RGBA', 'Exact color', 'Nearest color']

#def getIcon(self):
# filepath = os.path.dirname(__file__) + '/icons/dem.png'
# return QIcon(filepath)
def name(self):
return 'colorrelief'

def displayName(self):
return self.tr('Color relief')

def group(self):
return self.tr('Raster analysis')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Color relief')
self.group, self.i18n_group = self.trAlgorithm('Raster analysis')
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer')))
self.addParameter(ParameterNumber(
self.BAND, self.tr('Band number'), 1, 99, 1))
@@ -46,12 +46,12 @@ class GdalAlgorithm(GeoAlgorithm):

def __init__(self):
GeoAlgorithm.__init__(self)
self._icon = None

def getIcon(self):
if self._icon is None:
self._icon = QgsApplication.getThemeIcon("/providerGdal.svg")
return self._icon
def icon(self):
return QgsApplication.getThemeIcon("/providerGdal.svg")

def svgIconPath(self):
return QgsApplication.iconPath("providerGdal.svg")

def getCustomParametersDialog(self):
return GdalAlgorithmDialog(self)
@@ -147,5 +147,5 @@ def createAlgsList(self):
OffsetCurve(), Ogr2OgrTableToPostGisList(), OgrSql(),
]

def getSupportedOutputRasterLayerExtensions(self):
def supportedOutputRasterLayerExtensions(self):
return GdalUtils.getSupportedRasterExtensions()
@@ -56,15 +56,22 @@ class GridAverage(GdalAlgorithm):

TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']

def getIcon(self):
def name(self):
return 'gridmovingaverage'

def displayName(self):
return self.tr('Grid (Moving average)')

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandLineName(self):
return "gdal:gridaverage"

def group(self):
return self.tr('Raster analysis')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Moving average)')
self.group, self.i18n_group = self.trAlgorithm('Raster analysis')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD,
@@ -61,15 +61,22 @@ class GridDataMetrics(GdalAlgorithm):
DATA_METRICS = ['Minimum', 'Maximum', 'Range', 'Count', 'Average distance',
'Average distance between points']

def getIcon(self):
def name(self):
return 'griddatametrics'

def displayName(self):
return self.tr('Grid (Data metrics)')

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandLineName(self):
return "gdal:griddatametrics"

def group(self):
return self.tr('Raster analysis')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Data metrics)')
self.group, self.i18n_group = self.trAlgorithm('Raster analysis')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD,
@@ -60,15 +60,19 @@ class GridInvDist(GdalAlgorithm):

TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']

def getIcon(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandLineName(self):
return "gdal:gridinvdist"
def name(self):
return 'gridinvdist'

def displayName(self):
return self.tr('Grid (Inverse distance to a power)')

def group(self):
return self.tr('Raster analysis')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Inverse distance to a power)')
self.group, self.i18n_group = self.trAlgorithm('Raster analysis')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD,
@@ -56,15 +56,19 @@ class GridNearest(GdalAlgorithm):

TYPE = ['Byte', 'Int16', 'UInt16', 'UInt32', 'Int32', 'Float32', 'Float64']

def getIcon(self):
def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'grid.png'))

def commandLineName(self):
return "gdal:gridnearestneighbor"
def name(self):
return 'gridnearestneighbor'

def displayName(self):
return self.tr('Grid (Nearest neighbor)')

def group(self):
return self.tr('Raster analysis')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Nearest neighbor)')
self.group, self.i18n_group = self.trAlgorithm('Raster analysis')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD,
Loading

0 comments on commit 51517fd

Please sign in to comment.