QGIS API Documentation  3.21.0-Master (56b4176581)
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"
29 #include "qgsalgorithmaspect.h"
33 #include "qgsalgorithmboundary.h"
35 #include "qgsalgorithmbuffer.h"
39 #include "qgsalgorithmcentroid.h"
40 #include "qgsalgorithmclip.h"
44 #include "qgsalgorithmconvexhull.h"
51 #include "qgsalgorithmdifference.h"
52 #include "qgsalgorithmdissolve.h"
54 #include "qgsalgorithmdrape.h"
55 #include "qgsalgorithmdropfields.h"
58 #include "qgsalgorithmdxfexport.h"
62 #include "qgsalgorithmexportmesh.h"
64 #include "qgsalgorithmexplode.h"
81 #include "qgsalgorithmfillnodata.h"
82 #include "qgsalgorithmfilter.h"
87 #include "qgsalgorithmforcerhr.h"
91 #include "qgsalgorithmgrid.h"
92 #include "qgsalgorithmhillshade.h"
101 #ifndef QT_NO_PRINTER
105 #include "qgsalgorithmlayouttopdf.h"
106 #endif
107 #include "qgsalgorithmlinedensity.h"
110 #include "qgsalgorithmloadlayer.h"
112 #include "qgsalgorithmmergelines.h"
113 #include "qgsalgorithmmergevector.h"
118 #include "qgsalgorithmoffsetlines.h"
122 #include "qgsalgorithmpackage.h"
132 #include "qgsalgorithmpolygonize.h"
145 #include "qgsalgorithmrasterize.h"
156 #include "qgsalgorithmremoveholes.h"
158 #include "qgsalgorithmrenamelayer.h"
163 #include "qgsalgorithmrotate.h"
165 #include "qgsalgorithmruggedness.h"
167 #include "qgsalgorithmsavelog.h"
169 #include "qgsalgorithmsegmentize.h"
173 #include "qgsalgorithmsetmvalue.h"
174 #include "qgsalgorithmsetvariable.h"
175 #include "qgsalgorithmsetzvalue.h"
180 #include "qgsalgorithmsimplify.h"
182 #include "qgsalgorithmslope.h"
183 #include "qgsalgorithmsmooth.h"
185 #include "qgsalgorithmsnaptogrid.h"
194 #include "qgsalgorithmsubdivide.h"
196 #include "qgsalgorithmswapxy.h"
200 #include "qgsalgorithmtransect.h"
201 #include "qgsalgorithmtransform.h"
202 #include "qgsalgorithmtranslate.h"
204 #include "qgsalgorithmunion.h"
206 #include "qgsalgorithmvectorize.h"
213 #include "qgsbookmarkalgorithms.h"
215 #include "qgsstylealgorithms.h"
216 
218 
220  : QgsProcessingProvider( parent )
221 {}
222 
223 QIcon QgsNativeAlgorithms::icon() const
224 {
225  return QgsApplication::getThemeIcon( QStringLiteral( "/providerQgis.svg" ) );
226 }
227 
228 QString QgsNativeAlgorithms::svgIconPath() const
229 {
230  return QgsApplication::iconPath( QStringLiteral( "providerQgis.svg" ) );
231 }
232 
233 QString QgsNativeAlgorithms::id() const
234 {
235  return QStringLiteral( "native" );
236 }
237 
238 QString QgsNativeAlgorithms::helpId() const
239 {
240  return QStringLiteral( "qgis" );
241 }
242 
243 QString QgsNativeAlgorithms::name() const
244 {
245  return tr( "QGIS (native c++)" );
246 }
247 
249 {
250  return true;
251 }
252 
254 {
255  const QgsScopedRuntimeProfile profile( QObject::tr( "QGIS native provider" ) );
256  addAlgorithm( new QgsAddIncrementalFieldAlgorithm() );
257  addAlgorithm( new QgsAddTableFieldAlgorithm() );
258  addAlgorithm( new QgsAddXYFieldsAlgorithm() );
259  addAlgorithm( new QgsAddUniqueValueIndexAlgorithm() );
260  addAlgorithm( new QgsAffineTransformationAlgorithm() );
261  addAlgorithm( new QgsAggregateAlgorithm() );
262  addAlgorithm( new QgsAngleToNearestAlgorithm() );
263  addAlgorithm( new QgsApplyLayerStyleAlgorithm() );
264  addAlgorithm( new QgsArrayTranslatedFeaturesAlgorithm() );
265  addAlgorithm( new QgsAspectAlgorithm() );
266  addAlgorithm( new QgsAssignProjectionAlgorithm() );
267  addAlgorithm( new QgsAttributeIndexAlgorithm() );
268  addAlgorithm( new QgsBatchNominatimGeocodeAlgorithm() );
269  addAlgorithm( new QgsBookmarksToLayerAlgorithm() );
270  addAlgorithm( new QgsBoundaryAlgorithm() );
271  addAlgorithm( new QgsBoundingBoxAlgorithm() );
272  addAlgorithm( new QgsBufferAlgorithm() );
273  addAlgorithm( new QgsCalculateVectorOverlapsAlgorithm() );
274  addAlgorithm( new QgsCategorizeUsingStyleAlgorithm() );
275  addAlgorithm( new QgsCellStatisticsAlgorithm() );
276  addAlgorithm( new QgsCellStatisticsPercentileAlgorithm() );
277  addAlgorithm( new QgsCellStatisticsPercentRankFromRasterAlgorithm() );
278  addAlgorithm( new QgsCellStatisticsPercentRankFromValueAlgorithm() );
279  addAlgorithm( new QgsCentroidAlgorithm() );
280  addAlgorithm( new QgsClipAlgorithm() );
281  addAlgorithm( new QgsCollectAlgorithm() );
282  addAlgorithm( new QgsCombineStylesAlgorithm() );
283  addAlgorithm( new QgsConditionalBranchAlgorithm() );
284  addAlgorithm( new QgsConstantRasterAlgorithm() );
285  addAlgorithm( new QgsConvertToCurvesAlgorithm() );
286  addAlgorithm( new QgsConvexHullAlgorithm() );
287  addAlgorithm( new QgsCreateDirectoryAlgorithm() );
288  addAlgorithm( new QgsDbscanClusteringAlgorithm() );
289  addAlgorithm( new QgsDeleteDuplicateGeometriesAlgorithm() );
290  addAlgorithm( new QgsDetectVectorChangesAlgorithm() );
291  addAlgorithm( new QgsDifferenceAlgorithm() );
292  addAlgorithm( new QgsDissolveAlgorithm() );
293  addAlgorithm( new QgsDrapeToMAlgorithm() );
294  addAlgorithm( new QgsDrapeToZAlgorithm() );
295  addAlgorithm( new QgsDropTableFieldsAlgorithm() );
296  addAlgorithm( new QgsDropGeometryAlgorithm() );
297  addAlgorithm( new QgsDropMZValuesAlgorithm() );
298  addAlgorithm( new QgsDxfExportAlgorithm() );
299  addAlgorithm( new QgsExecutePostgisQueryAlgorithm() );
300  addAlgorithm( new QgsExecuteRegisteredSpatialiteQueryAlgorithm() );
301  addAlgorithm( new QgsExecuteSpatialiteQueryAlgorithm() );
302  addAlgorithm( new QgsExplodeAlgorithm() );
303  addAlgorithm( new QgsExplodeHstoreAlgorithm() );
304  addAlgorithm( new QgsExportLayersInformationAlgorithm() );
305  addAlgorithm( new QgsExportMeshVerticesAlgorithm );
306  addAlgorithm( new QgsExportMeshFacesAlgorithm );
307  addAlgorithm( new QgsExportMeshEdgesAlgorithm );
308  addAlgorithm( new QgsExportMeshOnGridAlgorithm );
309  addAlgorithm( new QgsExportToSpreadsheetAlgorithm() );
310  addAlgorithm( new QgsExtendLinesAlgorithm() );
311  addAlgorithm( new QgsExtentFromLayerAlgorithm() );
312  addAlgorithm( new QgsExtentToLayerAlgorithm() );
313  addAlgorithm( new QgsExtractBinaryFieldAlgorithm() );
314  addAlgorithm( new QgsExtractByAttributeAlgorithm() );
315  addAlgorithm( new QgsExtractByExpressionAlgorithm() );
316  addAlgorithm( new QgsExtractByExtentAlgorithm() );
317  addAlgorithm( new QgsExtractByLocationAlgorithm() );
318  addAlgorithm( new QgsExtractMValuesAlgorithm() );
319  addAlgorithm( new QgsExtractVerticesAlgorithm() );
320  addAlgorithm( new QgsExtractSpecificVerticesAlgorithm() );
321  addAlgorithm( new QgsExtractWithinDistanceAlgorithm() );
322  addAlgorithm( new QgsExtractZValuesAlgorithm() );
323  addAlgorithm( new QgsFieldCalculatorAlgorithm() );
324  addAlgorithm( new QgsFileDownloaderAlgorithm() );
325  addAlgorithm( new QgsFillNoDataAlgorithm() );
326  addAlgorithm( new QgsFilterAlgorithm() );
327  addAlgorithm( new QgsFilterByGeometryAlgorithm() );
328  addAlgorithm( new QgsFilterByLayerTypeAlgorithm() );
329  addAlgorithm( new QgsFilterVerticesByM() );
330  addAlgorithm( new QgsFilterVerticesByZ() );
331  addAlgorithm( new QgsFixGeometriesAlgorithm() );
332  addAlgorithm( new QgsFlattenRelationshipsAlgorithm() );
333  addAlgorithm( new QgsForceRHRAlgorithm() );
334  addAlgorithm( new QgsFuzzifyRasterLinearMembershipAlgorithm() );
335  addAlgorithm( new QgsFuzzifyRasterPowerMembershipAlgorithm() );
336  addAlgorithm( new QgsFuzzifyRasterLargeMembershipAlgorithm() );
337  addAlgorithm( new QgsFuzzifyRasterSmallMembershipAlgorithm() );
338  addAlgorithm( new QgsFuzzifyRasterGaussianMembershipAlgorithm() );
339  addAlgorithm( new QgsFuzzifyRasterNearMembershipAlgorithm() );
340  addAlgorithm( new QgsGeometryByExpressionAlgorithm() );
341  addAlgorithm( new QgsConvertGpxFeatureTypeAlgorithm() );
342  addAlgorithm( new QgsConvertGpsDataAlgorithm() );
343  addAlgorithm( new QgsDownloadGpsDataAlgorithm() );
344  addAlgorithm( new QgsUploadGpsDataAlgorithm() );
345  addAlgorithm( new QgsGridAlgorithm() );
346  addAlgorithm( new QgsHillshadeAlgorithm() );
347  addAlgorithm( new QgsImportPhotosAlgorithm() );
348  addAlgorithm( new QgsInterpolatePointAlgorithm() );
349  addAlgorithm( new QgsIntersectionAlgorithm() );
350  addAlgorithm( new QgsJoinByAttributeAlgorithm() );
351  addAlgorithm( new QgsJoinByLocationAlgorithm() );
352  addAlgorithm( new QgsJoinByNearestAlgorithm() );
353  addAlgorithm( new QgsJoinWithLinesAlgorithm() );
354  addAlgorithm( new QgsKMeansClusteringAlgorithm() );
355  addAlgorithm( new QgsLayerToBookmarksAlgorithm() );
356  addAlgorithm( new QgsLayoutMapExtentToLayerAlgorithm() );
357 #ifndef QT_NO_PRINTER
358  addAlgorithm( new QgsLayoutAtlasToImageAlgorithm() );
359  addAlgorithm( new QgsLayoutAtlasToPdfAlgorithm() );
360  addAlgorithm( new QgsLayoutToImageAlgorithm() );
361  addAlgorithm( new QgsLayoutToPdfAlgorithm() );
362 #endif
363  addAlgorithm( new QgsLineDensityAlgorithm() );
364  addAlgorithm( new QgsLineIntersectionAlgorithm() );
365  addAlgorithm( new QgsLineSubstringAlgorithm() );
366  addAlgorithm( new QgsLoadLayerAlgorithm() );
367  addAlgorithm( new QgsMeanCoordinatesAlgorithm() );
368  addAlgorithm( new QgsMergeLinesAlgorithm() );
369  addAlgorithm( new QgsMergeVectorAlgorithm() );
370  addAlgorithm( new QgsMeshRasterizeAlgorithm );
371  addAlgorithm( new QgsMeshContoursAlgorithm );
372  addAlgorithm( new QgsMeshExportCrossSection );
373  addAlgorithm( new QgsMeshExportTimeSeries );
374  addAlgorithm( new QgsMinimumEnclosingCircleAlgorithm() );
375  addAlgorithm( new QgsMultipartToSinglepartAlgorithm() );
376  addAlgorithm( new QgsMultiRingConstantBufferAlgorithm() );
377  addAlgorithm( new QgsNearestNeighbourAnalysisAlgorithm() );
378  addAlgorithm( new QgsOffsetLinesAlgorithm() );
379  addAlgorithm( new QgsOrderByExpressionAlgorithm() );
380  addAlgorithm( new QgsOrientedMinimumBoundingBoxAlgorithm() );
381  addAlgorithm( new QgsOrthogonalizeAlgorithm() );
382  addAlgorithm( new QgsPackageAlgorithm() );
383  addAlgorithm( new QgsPixelCentroidsFromPolygonsAlgorithm() );
384  addAlgorithm( new QgsCreateArrayOffsetLinesAlgorithm() );
385  addAlgorithm( new QgsPointsInPolygonAlgorithm() );
386  addAlgorithm( new QgsPointOnSurfaceAlgorithm() );
387  addAlgorithm( new QgsPointToLayerAlgorithm() );
388  addAlgorithm( new QgsPointsAlongGeometryAlgorithm() );
389  addAlgorithm( new QgsPointsLayerFromTableAlgorithm() );
390  addAlgorithm( new QgsPointsToPathsAlgorithm() );
391  addAlgorithm( new QgsPoleOfInaccessibilityAlgorithm() );
392  addAlgorithm( new QgsPolygonizeAlgorithm() );
393  addAlgorithm( new QgsProjectPointCartesianAlgorithm() );
394  addAlgorithm( new QgsPromoteToMultipartAlgorithm() );
395  addAlgorithm( new QgsRaiseExceptionAlgorithm() );
396  addAlgorithm( new QgsRaiseWarningAlgorithm() );
397  addAlgorithm( new QgsRandomBinomialRasterAlgorithm() );
398  addAlgorithm( new QgsRandomExponentialRasterAlgorithm() );
399  addAlgorithm( new QgsRandomExtractAlgorithm() );
400  addAlgorithm( new QgsRandomGammaRasterAlgorithm() );
401  addAlgorithm( new QgsRandomGeometricRasterAlgorithm() );
402  addAlgorithm( new QgsRandomNegativeBinomialRasterAlgorithm() );
403  addAlgorithm( new QgsRandomNormalRasterAlgorithm() );
404  addAlgorithm( new QgsRandomPointsExtentAlgorithm() );
405  addAlgorithm( new QgsRandomPointsInPolygonsAlgorithm() );
406  addAlgorithm( new QgsRandomPointsOnLinesAlgorithm() );
407  addAlgorithm( new QgsRandomPoissonRasterAlgorithm() );
408  addAlgorithm( new QgsRandomUniformRasterAlgorithm() );
409  addAlgorithm( new QgsRasterFrequencyByEqualOperatorAlgorithm() );
410  addAlgorithm( new QgsRasterFrequencyByGreaterThanOperatorAlgorithm() );
411  addAlgorithm( new QgsRasterFrequencyByLessThanOperatorAlgorithm() );
412  addAlgorithm( new QgsRasterLayerPropertiesAlgorithm() );
413  addAlgorithm( new QgsRasterLayerUniqueValuesReportAlgorithm() );
414  addAlgorithm( new QgsRasterLayerZonalStatsAlgorithm() );
415  addAlgorithm( new QgsRasterLogicalAndAlgorithm() );
416  addAlgorithm( new QgsRasterLogicalOrAlgorithm() );
417  addAlgorithm( new QgsRasterizeAlgorithm() );
418  addAlgorithm( new QgsRasterPixelsToPointsAlgorithm() );
419  addAlgorithm( new QgsRasterPixelsToPolygonsAlgorithm() );
420  addAlgorithm( new QgsRasterSamplingAlgorithm() );
421  addAlgorithm( new QgsRasterStackHighestPositionAlgorithm() );
422  addAlgorithm( new QgsRasterStackLowestPositionAlgorithm() );
423  addAlgorithm( new QgsRasterStatisticsAlgorithm() );
424  addAlgorithm( new QgsRasterSurfaceVolumeAlgorithm() );
425  addAlgorithm( new QgsAlgorithmRemoveDuplicateVertices() );
426  addAlgorithm( new QgsReclassifyByLayerAlgorithm() );
427  addAlgorithm( new QgsReclassifyByTableAlgorithm() );
428  addAlgorithm( new QgsRectanglesOvalsDiamondsAlgorithm() );
429  addAlgorithm( new QgsRefactorFieldsAlgorithm() );
430  addAlgorithm( new QgsRemoveDuplicatesByAttributeAlgorithm() );
431  addAlgorithm( new QgsRemoveHolesAlgorithm() );
432  addAlgorithm( new QgsRemoveNullGeometryAlgorithm() );
433  addAlgorithm( new QgsRenameLayerAlgorithm() );
434  addAlgorithm( new QgsRenameTableFieldAlgorithm() );
435  addAlgorithm( new QgsRepairShapefileAlgorithm() );
436  addAlgorithm( new QgsRescaleRasterAlgorithm() );
437  addAlgorithm( new QgsRetainTableFieldsAlgorithm() );
438  addAlgorithm( new QgsReverseLineDirectionAlgorithm() );
439  addAlgorithm( new QgsRotateFeaturesAlgorithm() );
440  addAlgorithm( new QgsRoundRasterValuesAlgorithm() );
441  addAlgorithm( new QgsRuggednessAlgorithm() );
442  addAlgorithm( new QgsSaveFeaturesAlgorithm() );
443  addAlgorithm( new QgsSaveLogToFileAlgorithm() );
444  addAlgorithm( new QgsSaveSelectedFeatures() );
445  addAlgorithm( new QgsSegmentizeByMaximumAngleAlgorithm() );
446  addAlgorithm( new QgsSegmentizeByMaximumDistanceAlgorithm() );
447  addAlgorithm( new QgsSelectByLocationAlgorithm() );
448  addAlgorithm( new QgsSelectWithinDistanceAlgorithm() );
449  addAlgorithm( new QgsServiceAreaFromLayerAlgorithm() );
450  addAlgorithm( new QgsServiceAreaFromPointAlgorithm() );
451  addAlgorithm( new QgsSetLayerEncodingAlgorithm() );
452  addAlgorithm( new QgsSetMValueAlgorithm() );
453  addAlgorithm( new QgsSetProjectVariableAlgorithm() );
454  addAlgorithm( new QgsSetZValueAlgorithm() );
455  addAlgorithm( new QgsShapefileEncodingInfoAlgorithm() );
456  addAlgorithm( new QgsShortestPathLayerToPointAlgorithm() );
457  addAlgorithm( new QgsShortestPathPointToLayerAlgorithm() );
458  addAlgorithm( new QgsShortestPathPointToPointAlgorithm() );
459  addAlgorithm( new QgsSimplifyAlgorithm() );
460  addAlgorithm( new QgsSingleSidedBufferAlgorithm() );
461  addAlgorithm( new QgsSlopeAlgorithm() );
462  addAlgorithm( new QgsSmoothAlgorithm() );
463  addAlgorithm( new QgsSnapGeometriesAlgorithm() );
464  addAlgorithm( new QgsSnapToGridAlgorithm() );
465  addAlgorithm( new QgsSpatialIndexAlgorithm() );
466  addAlgorithm( new QgsSplitFeaturesByAttributeCharacterAlgorithm() );
467  addAlgorithm( new QgsSplitGeometryAtAntimeridianAlgorithm() );
468  addAlgorithm( new QgsSplitLinesByLengthAlgorithm() );
469  addAlgorithm( new QgsSplitVectorLayerAlgorithm() );
470  addAlgorithm( new QgsSplitWithLinesAlgorithm() );
471  addAlgorithm( new QgsStDbscanClusteringAlgorithm() );
472  addAlgorithm( new QgsStringConcatenationAlgorithm() );
473  addAlgorithm( new QgsStyleFromProjectAlgorithm() );
474  addAlgorithm( new QgsSubdivideAlgorithm() );
475  addAlgorithm( new QgsSumLineLengthAlgorithm() );
476  addAlgorithm( new QgsSwapXYAlgorithm() );
477  addAlgorithm( new QgsSymmetricalDifferenceAlgorithm() );
478  addAlgorithm( new QgsTaperedBufferAlgorithm() );
479  addAlgorithm( new QgsTinMeshCreationAlgorithm() );
480  addAlgorithm( new QgsTransectAlgorithm() );
481  addAlgorithm( new QgsTransferAnnotationsFromMainAlgorithm() );
482  addAlgorithm( new QgsTransformAlgorithm() );
483  addAlgorithm( new QgsTranslateAlgorithm() );
484  addAlgorithm( new QgsTruncateTableAlgorithm() );
485  addAlgorithm( new QgsUnionAlgorithm() );
486  addAlgorithm( new QgsVariableWidthBufferByMAlgorithm() );
487  addAlgorithm( new QgsWedgeBuffersAlgorithm() );
488  addAlgorithm( new QgsWriteVectorTilesXyzAlgorithm() );
489  addAlgorithm( new QgsWriteVectorTilesMbtilesAlgorithm() );
490  addAlgorithm( new QgsZonalHistogramAlgorithm() );
491  addAlgorithm( new QgsZonalStatisticsAlgorithm() );
492  addAlgorithm( new QgsZonalStatisticsFeatureBasedAlgorithm() );
493  addAlgorithm( new QgsPolygonsToLinesAlgorithm() );
494  addAlgorithm( new QgsDensifyGeometriesByIntervalAlgorithm() );
495  addAlgorithm( new QgsDensifyGeometriesByCountAlgorithm() );
496 }
497 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
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.