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