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