QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qgsnativealgorithms.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsnativealgorithms.cpp
3  ---------------------
4  begin : April 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsnativealgorithms.h"
19 #include "qgsruntimeprofiler.h"
24 #include "qgsalgorithmaggregate.h"
28 #include "qgsalgorithmaspect.h"
31 #include "qgsalgorithmboundary.h"
33 #include "qgsalgorithmbuffer.h"
37 #include "qgsalgorithmcentroid.h"
38 #include "qgsalgorithmclip.h"
42 #include "qgsalgorithmconvexhull.h"
49 #include "qgsalgorithmdifference.h"
50 #include "qgsalgorithmdissolve.h"
51 #include "qgsalgorithmdrape.h"
52 #include "qgsalgorithmdropfields.h"
55 #include "qgsalgorithmdxfexport.h"
59 #include "qgsalgorithmexportmesh.h"
61 #include "qgsalgorithmexplode.h"
78 #include "qgsalgorithmfillnodata.h"
79 #include "qgsalgorithmfilter.h"
84 #include "qgsalgorithmforcerhr.h"
87 #include "qgsalgorithmgrid.h"
88 #include "qgsalgorithmhillshade.h"
97 #ifndef QT_NO_PRINTER
101 #include "qgsalgorithmlayouttopdf.h"
102 #endif
103 #include "qgsalgorithmlinedensity.h"
106 #include "qgsalgorithmloadlayer.h"
108 #include "qgsalgorithmmergelines.h"
109 #include "qgsalgorithmmergevector.h"
114 #include "qgsalgorithmoffsetlines.h"
118 #include "qgsalgorithmpackage.h"
128 #include "qgsalgorithmpolygonize.h"
140 #include "qgsalgorithmrasterize.h"
151 #include "qgsalgorithmremoveholes.h"
153 #include "qgsalgorithmrenamelayer.h"
158 #include "qgsalgorithmrotate.h"
160 #include "qgsalgorithmruggedness.h"
162 #include "qgsalgorithmsavelog.h"
164 #include "qgsalgorithmsegmentize.h"
168 #include "qgsalgorithmsetmvalue.h"
169 #include "qgsalgorithmsetvariable.h"
170 #include "qgsalgorithmsetzvalue.h"
175 #include "qgsalgorithmsimplify.h"
177 #include "qgsalgorithmslope.h"
178 #include "qgsalgorithmsmooth.h"
180 #include "qgsalgorithmsnaptogrid.h"
188 #include "qgsalgorithmsubdivide.h"
190 #include "qgsalgorithmswapxy.h"
194 #include "qgsalgorithmtransect.h"
195 #include "qgsalgorithmtransform.h"
196 #include "qgsalgorithmtranslate.h"
198 #include "qgsalgorithmunion.h"
200 #include "qgsalgorithmvectorize.h"
207 #include "qgsbookmarkalgorithms.h"
209 #include "qgsstylealgorithms.h"
210 
212 
214  : QgsProcessingProvider( parent )
215 {}
216 
217 QIcon QgsNativeAlgorithms::icon() const
218 {
219  return QgsApplication::getThemeIcon( QStringLiteral( "/providerQgis.svg" ) );
220 }
221 
222 QString QgsNativeAlgorithms::svgIconPath() const
223 {
224  return QgsApplication::iconPath( QStringLiteral( "providerQgis.svg" ) );
225 }
226 
227 QString QgsNativeAlgorithms::id() const
228 {
229  return QStringLiteral( "native" );
230 }
231 
232 QString QgsNativeAlgorithms::helpId() const
233 {
234  return QStringLiteral( "qgis" );
235 }
236 
237 QString QgsNativeAlgorithms::name() const
238 {
239  return tr( "QGIS (native c++)" );
240 }
241 
243 {
244  return true;
245 }
246 
248 {
249  QgsScopedRuntimeProfile profile( QObject::tr( "QGIS native provider" ) );
250  addAlgorithm( new QgsAddIncrementalFieldAlgorithm() );
251  addAlgorithm( new QgsAddTableFieldAlgorithm() );
252  addAlgorithm( new QgsAddXYFieldsAlgorithm() );
253  addAlgorithm( new QgsAddUniqueValueIndexAlgorithm() );
254  addAlgorithm( new QgsAffineTransformationAlgorithm() );
255  addAlgorithm( new QgsAggregateAlgorithm() );
256  addAlgorithm( new QgsAngleToNearestAlgorithm() );
257  addAlgorithm( new QgsApplyLayerStyleAlgorithm() );
258  addAlgorithm( new QgsArrayTranslatedFeaturesAlgorithm() );
259  addAlgorithm( new QgsAspectAlgorithm() );
260  addAlgorithm( new QgsAssignProjectionAlgorithm() );
261  addAlgorithm( new QgsAttributeIndexAlgorithm() );
262  addAlgorithm( new QgsBookmarksToLayerAlgorithm() );
263  addAlgorithm( new QgsBoundaryAlgorithm() );
264  addAlgorithm( new QgsBoundingBoxAlgorithm() );
265  addAlgorithm( new QgsBufferAlgorithm() );
266  addAlgorithm( new QgsCalculateVectorOverlapsAlgorithm() );
267  addAlgorithm( new QgsCategorizeUsingStyleAlgorithm() );
268  addAlgorithm( new QgsCellStatisticsAlgorithm() );
269  addAlgorithm( new QgsCellStatisticsPercentileAlgorithm() );
270  addAlgorithm( new QgsCellStatisticsPercentRankFromRasterAlgorithm() );
271  addAlgorithm( new QgsCellStatisticsPercentRankFromValueAlgorithm() );
272  addAlgorithm( new QgsCentroidAlgorithm() );
273  addAlgorithm( new QgsClipAlgorithm() );
274  addAlgorithm( new QgsCollectAlgorithm() );
275  addAlgorithm( new QgsCombineStylesAlgorithm() );
276  addAlgorithm( new QgsConditionalBranchAlgorithm() );
277  addAlgorithm( new QgsConstantRasterAlgorithm() );
278  addAlgorithm( new QgsConvertToCurvesAlgorithm() );
279  addAlgorithm( new QgsConvexHullAlgorithm() );
280  addAlgorithm( new QgsCreateDirectoryAlgorithm() );
281  addAlgorithm( new QgsDbscanClusteringAlgorithm() );
282  addAlgorithm( new QgsDeleteDuplicateGeometriesAlgorithm() );
283  addAlgorithm( new QgsDetectVectorChangesAlgorithm() );
284  addAlgorithm( new QgsDifferenceAlgorithm() );
285  addAlgorithm( new QgsDissolveAlgorithm() );
286  addAlgorithm( new QgsDrapeToMAlgorithm() );
287  addAlgorithm( new QgsDrapeToZAlgorithm() );
288  addAlgorithm( new QgsDropTableFieldsAlgorithm() );
289  addAlgorithm( new QgsDropGeometryAlgorithm() );
290  addAlgorithm( new QgsDropMZValuesAlgorithm() );
291  addAlgorithm( new QgsDxfExportAlgorithm() );
292  addAlgorithm( new QgsExecutePostgisQueryAlgorithm() );
293  addAlgorithm( new QgsExecuteRegisteredSpatialiteQueryAlgorithm() );
294  addAlgorithm( new QgsExecuteSpatialiteQueryAlgorithm() );
295  addAlgorithm( new QgsExplodeAlgorithm() );
296  addAlgorithm( new QgsExplodeHstoreAlgorithm() );
297  addAlgorithm( new QgsExportLayersInformationAlgorithm() );
298  addAlgorithm( new QgsExportMeshVerticesAlgorithm );
299  addAlgorithm( new QgsExportMeshFacesAlgorithm );
300  addAlgorithm( new QgsExportMeshEdgesAlgorithm );
301  addAlgorithm( new QgsExportMeshOnGridAlgorithm );
302  addAlgorithm( new QgsExportToSpreadsheetAlgorithm() );
303  addAlgorithm( new QgsExtendLinesAlgorithm() );
304  addAlgorithm( new QgsExtentFromLayerAlgorithm() );
305  addAlgorithm( new QgsExtentToLayerAlgorithm() );
306  addAlgorithm( new QgsExtractBinaryFieldAlgorithm() );
307  addAlgorithm( new QgsExtractByAttributeAlgorithm() );
308  addAlgorithm( new QgsExtractByExpressionAlgorithm() );
309  addAlgorithm( new QgsExtractByExtentAlgorithm() );
310  addAlgorithm( new QgsExtractByLocationAlgorithm() );
311  addAlgorithm( new QgsExtractMValuesAlgorithm() );
312  addAlgorithm( new QgsExtractVerticesAlgorithm() );
313  addAlgorithm( new QgsExtractSpecificVerticesAlgorithm() );
314  addAlgorithm( new QgsExtractZValuesAlgorithm() );
315  addAlgorithm( new QgsFieldCalculatorAlgorithm() );
316  addAlgorithm( new QgsFileDownloaderAlgorithm() );
317  addAlgorithm( new QgsFillNoDataAlgorithm() );
318  addAlgorithm( new QgsFilterAlgorithm() );
319  addAlgorithm( new QgsFilterByGeometryAlgorithm() );
320  addAlgorithm( new QgsFilterByLayerTypeAlgorithm() );
321  addAlgorithm( new QgsFilterVerticesByM() );
322  addAlgorithm( new QgsFilterVerticesByZ() );
323  addAlgorithm( new QgsFixGeometriesAlgorithm() );
324  addAlgorithm( new QgsFlattenRelationshipsAlgorithm() );
325  addAlgorithm( new QgsForceRHRAlgorithm() );
326  addAlgorithm( new QgsFuzzifyRasterLinearMembershipAlgorithm() );
327  addAlgorithm( new QgsFuzzifyRasterPowerMembershipAlgorithm() );
328  addAlgorithm( new QgsFuzzifyRasterLargeMembershipAlgorithm() );
329  addAlgorithm( new QgsFuzzifyRasterSmallMembershipAlgorithm() );
330  addAlgorithm( new QgsFuzzifyRasterGaussianMembershipAlgorithm() );
331  addAlgorithm( new QgsFuzzifyRasterNearMembershipAlgorithm() );
332  addAlgorithm( new QgsGeometryByExpressionAlgorithm() );
333  addAlgorithm( new QgsGridAlgorithm() );
334  addAlgorithm( new QgsHillshadeAlgorithm() );
335  addAlgorithm( new QgsImportPhotosAlgorithm() );
336  addAlgorithm( new QgsInterpolatePointAlgorithm() );
337  addAlgorithm( new QgsIntersectionAlgorithm() );
338  addAlgorithm( new QgsJoinByAttributeAlgorithm() );
339  addAlgorithm( new QgsJoinByLocationAlgorithm() );
340  addAlgorithm( new QgsJoinByNearestAlgorithm() );
341  addAlgorithm( new QgsJoinWithLinesAlgorithm() );
342  addAlgorithm( new QgsKMeansClusteringAlgorithm() );
343  addAlgorithm( new QgsLayerToBookmarksAlgorithm() );
344  addAlgorithm( new QgsLayoutMapExtentToLayerAlgorithm() );
345 #ifndef QT_NO_PRINTER
346  addAlgorithm( new QgsLayoutAtlasToImageAlgorithm() );
347  addAlgorithm( new QgsLayoutAtlasToPdfAlgorithm() );
348  addAlgorithm( new QgsLayoutToImageAlgorithm() );
349  addAlgorithm( new QgsLayoutToPdfAlgorithm() );
350 #endif
351  addAlgorithm( new QgsLineDensityAlgorithm() );
352  addAlgorithm( new QgsLineIntersectionAlgorithm() );
353  addAlgorithm( new QgsLineSubstringAlgorithm() );
354  addAlgorithm( new QgsLoadLayerAlgorithm() );
355  addAlgorithm( new QgsMeanCoordinatesAlgorithm() );
356  addAlgorithm( new QgsMergeLinesAlgorithm() );
357  addAlgorithm( new QgsMergeVectorAlgorithm() );
358  addAlgorithm( new QgsMeshRasterizeAlgorithm );
359  addAlgorithm( new QgsMeshContoursAlgorithm );
360  addAlgorithm( new QgsMeshExportCrossSection );
361  addAlgorithm( new QgsMeshExportTimeSeries );
362  addAlgorithm( new QgsMinimumEnclosingCircleAlgorithm() );
363  addAlgorithm( new QgsMultipartToSinglepartAlgorithm() );
364  addAlgorithm( new QgsMultiRingConstantBufferAlgorithm() );
365  addAlgorithm( new QgsNearestNeighbourAnalysisAlgorithm() );
366  addAlgorithm( new QgsOffsetLinesAlgorithm() );
367  addAlgorithm( new QgsOrderByExpressionAlgorithm() );
368  addAlgorithm( new QgsOrientedMinimumBoundingBoxAlgorithm() );
369  addAlgorithm( new QgsOrthogonalizeAlgorithm() );
370  addAlgorithm( new QgsPackageAlgorithm() );
371  addAlgorithm( new QgsPixelCentroidsFromPolygonsAlgorithm() );
372  addAlgorithm( new QgsCreateArrayOffsetLinesAlgorithm() );
373  addAlgorithm( new QgsPointsInPolygonAlgorithm() );
374  addAlgorithm( new QgsPointOnSurfaceAlgorithm() );
375  addAlgorithm( new QgsPointToLayerAlgorithm() );
376  addAlgorithm( new QgsPointsAlongGeometryAlgorithm() );
377  addAlgorithm( new QgsPointsLayerFromTableAlgorithm() );
378  addAlgorithm( new QgsPointsToPathsAlgorithm() );
379  addAlgorithm( new QgsPoleOfInaccessibilityAlgorithm() );
380  addAlgorithm( new QgsPolygonizeAlgorithm() );
381  addAlgorithm( new QgsProjectPointCartesianAlgorithm() );
382  addAlgorithm( new QgsPromoteToMultipartAlgorithm() );
383  addAlgorithm( new QgsRaiseExceptionAlgorithm() );
384  addAlgorithm( new QgsRaiseWarningAlgorithm() );
385  addAlgorithm( new QgsRandomBinomialRasterAlgorithm() );
386  addAlgorithm( new QgsRandomExponentialRasterAlgorithm() );
387  addAlgorithm( new QgsRandomExtractAlgorithm() );
388  addAlgorithm( new QgsRandomGammaRasterAlgorithm() );
389  addAlgorithm( new QgsRandomGeometricRasterAlgorithm() );
390  addAlgorithm( new QgsRandomNegativeBinomialRasterAlgorithm() );
391  addAlgorithm( new QgsRandomNormalRasterAlgorithm() );
392  addAlgorithm( new QgsRandomPointsExtentAlgorithm() );
393  addAlgorithm( new QgsRandomPointsInPolygonsAlgorithm() );
394  addAlgorithm( new QgsRandomPointsOnLinesAlgorithm() );
395  addAlgorithm( new QgsRandomPoissonRasterAlgorithm() );
396  addAlgorithm( new QgsRandomUniformRasterAlgorithm() );
397  addAlgorithm( new QgsRasterFrequencyByEqualOperatorAlgorithm() );
398  addAlgorithm( new QgsRasterFrequencyByGreaterThanOperatorAlgorithm() );
399  addAlgorithm( new QgsRasterFrequencyByLessThanOperatorAlgorithm() );
400  addAlgorithm( new QgsRasterLayerUniqueValuesReportAlgorithm() );
401  addAlgorithm( new QgsRasterLayerZonalStatsAlgorithm() );
402  addAlgorithm( new QgsRasterLogicalAndAlgorithm() );
403  addAlgorithm( new QgsRasterLogicalOrAlgorithm() );
404  addAlgorithm( new QgsRasterizeAlgorithm() );
405  addAlgorithm( new QgsRasterPixelsToPointsAlgorithm() );
406  addAlgorithm( new QgsRasterPixelsToPolygonsAlgorithm() );
407  addAlgorithm( new QgsRasterSamplingAlgorithm() );
408  addAlgorithm( new QgsRasterStackHighestPositionAlgorithm() );
409  addAlgorithm( new QgsRasterStackLowestPositionAlgorithm() );
410  addAlgorithm( new QgsRasterStatisticsAlgorithm() );
411  addAlgorithm( new QgsRasterSurfaceVolumeAlgorithm() );
412  addAlgorithm( new QgsAlgorithmRemoveDuplicateVertices() );
413  addAlgorithm( new QgsReclassifyByLayerAlgorithm() );
414  addAlgorithm( new QgsReclassifyByTableAlgorithm() );
415  addAlgorithm( new QgsRectanglesOvalsDiamondsAlgorithm() );
416  addAlgorithm( new QgsRefactorFieldsAlgorithm() );
417  addAlgorithm( new QgsRemoveDuplicatesByAttributeAlgorithm() );
418  addAlgorithm( new QgsRemoveHolesAlgorithm() );
419  addAlgorithm( new QgsRemoveNullGeometryAlgorithm() );
420  addAlgorithm( new QgsRenameLayerAlgorithm() );
421  addAlgorithm( new QgsRenameTableFieldAlgorithm() );
422  addAlgorithm( new QgsRepairShapefileAlgorithm() );
423  addAlgorithm( new QgsRescaleRasterAlgorithm() );
424  addAlgorithm( new QgsRetainTableFieldsAlgorithm() );
425  addAlgorithm( new QgsReverseLineDirectionAlgorithm() );
426  addAlgorithm( new QgsRotateFeaturesAlgorithm() );
427  addAlgorithm( new QgsRoundRasterValuesAlgorithm() );
428  addAlgorithm( new QgsRuggednessAlgorithm() );
429  addAlgorithm( new QgsSaveFeaturesAlgorithm() );
430  addAlgorithm( new QgsSaveLogToFileAlgorithm() );
431  addAlgorithm( new QgsSaveSelectedFeatures() );
432  addAlgorithm( new QgsSegmentizeByMaximumAngleAlgorithm() );
433  addAlgorithm( new QgsSegmentizeByMaximumDistanceAlgorithm() );
434  addAlgorithm( new QgsSelectByLocationAlgorithm() );
435  addAlgorithm( new QgsServiceAreaFromLayerAlgorithm() );
436  addAlgorithm( new QgsServiceAreaFromPointAlgorithm() );
437  addAlgorithm( new QgsSetLayerEncodingAlgorithm() );
438  addAlgorithm( new QgsSetMValueAlgorithm() );
439  addAlgorithm( new QgsSetProjectVariableAlgorithm() );
440  addAlgorithm( new QgsSetZValueAlgorithm() );
441  addAlgorithm( new QgsShapefileEncodingInfoAlgorithm() );
442  addAlgorithm( new QgsShortestPathLayerToPointAlgorithm() );
443  addAlgorithm( new QgsShortestPathPointToLayerAlgorithm() );
444  addAlgorithm( new QgsShortestPathPointToPointAlgorithm() );
445  addAlgorithm( new QgsSimplifyAlgorithm() );
446  addAlgorithm( new QgsSingleSidedBufferAlgorithm() );
447  addAlgorithm( new QgsSlopeAlgorithm() );
448  addAlgorithm( new QgsSmoothAlgorithm() );
449  addAlgorithm( new QgsSnapGeometriesAlgorithm() );
450  addAlgorithm( new QgsSnapToGridAlgorithm() );
451  addAlgorithm( new QgsSpatialIndexAlgorithm() );
452  addAlgorithm( new QgsSplitFeaturesByAttributeCharacterAlgorithm() );
453  addAlgorithm( new QgsSplitGeometryAtAntimeridianAlgorithm() );
454  addAlgorithm( new QgsSplitLinesByLengthAlgorithm() );
455  addAlgorithm( new QgsSplitVectorLayerAlgorithm() );
456  addAlgorithm( new QgsSplitWithLinesAlgorithm() );
457  addAlgorithm( new QgsStringConcatenationAlgorithm() );
458  addAlgorithm( new QgsStyleFromProjectAlgorithm() );
459  addAlgorithm( new QgsSubdivideAlgorithm() );
460  addAlgorithm( new QgsSumLineLengthAlgorithm() );
461  addAlgorithm( new QgsSwapXYAlgorithm() );
462  addAlgorithm( new QgsSymmetricalDifferenceAlgorithm() );
463  addAlgorithm( new QgsTaperedBufferAlgorithm() );
464  addAlgorithm( new QgsTinMeshCreationAlgorithm() );
465  addAlgorithm( new QgsTransectAlgorithm() );
466  addAlgorithm( new QgsTransformAlgorithm() );
467  addAlgorithm( new QgsTranslateAlgorithm() );
468  addAlgorithm( new QgsTruncateTableAlgorithm() );
469  addAlgorithm( new QgsUnionAlgorithm() );
470  addAlgorithm( new QgsVariableWidthBufferByMAlgorithm() );
471  addAlgorithm( new QgsWedgeBuffersAlgorithm() );
472  addAlgorithm( new QgsWriteVectorTilesXyzAlgorithm() );
473  addAlgorithm( new QgsWriteVectorTilesMbtilesAlgorithm() );
474  addAlgorithm( new QgsZonalHistogramAlgorithm() );
475  addAlgorithm( new QgsZonalStatisticsAlgorithm() );
476  addAlgorithm( new QgsZonalStatisticsFeatureBasedAlgorithm() );
477  addAlgorithm( new QgsPolygonsToLinesAlgorithm() );
478  addAlgorithm( new QgsDensifyGeometriesByIntervalAlgorithm() );
479  addAlgorithm( new QgsDensifyGeometriesByCountAlgorithm() );
480 }
481 
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
void loadAlgorithms() override
Loads all algorithms belonging to this provider.
QString helpId() const override
Returns the provider help id string, used for creating QgsHelp urls for algorithms belong to this pro...
QString id() const override
Returns the unique provider id, used for identifying the provider.
bool supportsNonFileBasedOutput() const override
Returns true if the provider supports non-file based outputs (such as memory layers or direct databas...
QString svgIconPath() const override
Returns a path to an SVG version of the provider's icon.
QString name() const override
Returns the provider name, which is used to describe the provider within the GUI.
QIcon icon() const override
Returns an icon for the provider.
QgsNativeAlgorithms(QObject *parent=nullptr)
Constructor for QgsNativeAlgorithms.
Abstract base class for processing providers.
bool addAlgorithm(QgsProcessingAlgorithm *algorithm)
Adds an algorithm to the provider.
Scoped object for logging of the runtime for a single operation or group of operations.