QGIS API Documentation  3.17.0-Master (ca637cfeb2)
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"
54 #include "qgsalgorithmdxfexport.h"
58 #include "qgsalgorithmexportmesh.h"
59 #include "qgsalgorithmexplode.h"
75 #include "qgsalgorithmfillnodata.h"
76 #include "qgsalgorithmfilter.h"
81 #include "qgsalgorithmforcerhr.h"
84 #include "qgsalgorithmgrid.h"
85 #include "qgsalgorithmhillshade.h"
94 #ifndef QT_NO_PRINTER
99 #endif
100 #include "qgsalgorithmlinedensity.h"
103 #include "qgsalgorithmloadlayer.h"
105 #include "qgsalgorithmmergelines.h"
106 #include "qgsalgorithmmergevector.h"
111 #include "qgsalgorithmoffsetlines.h"
115 #include "qgsalgorithmpackage.h"
124 #include "qgsalgorithmpolygonize.h"
136 #include "qgsalgorithmrasterize.h"
147 #include "qgsalgorithmremoveholes.h"
149 #include "qgsalgorithmrenamelayer.h"
154 #include "qgsalgorithmrotate.h"
156 #include "qgsalgorithmruggedness.h"
158 #include "qgsalgorithmsavelog.h"
160 #include "qgsalgorithmsegmentize.h"
164 #include "qgsalgorithmsetmvalue.h"
165 #include "qgsalgorithmsetvariable.h"
166 #include "qgsalgorithmsetzvalue.h"
171 #include "qgsalgorithmsimplify.h"
173 #include "qgsalgorithmslope.h"
174 #include "qgsalgorithmsmooth.h"
176 #include "qgsalgorithmsnaptogrid.h"
184 #include "qgsalgorithmsubdivide.h"
186 #include "qgsalgorithmswapxy.h"
190 #include "qgsalgorithmtransect.h"
191 #include "qgsalgorithmtransform.h"
192 #include "qgsalgorithmtranslate.h"
194 #include "qgsalgorithmunion.h"
196 #include "qgsalgorithmvectorize.h"
203 #include "qgsbookmarkalgorithms.h"
205 #include "qgsstylealgorithms.h"
206 
208 
210  : QgsProcessingProvider( parent )
211 {}
212 
213 QIcon QgsNativeAlgorithms::icon() const
214 {
215  return QgsApplication::getThemeIcon( QStringLiteral( "/providerQgis.svg" ) );
216 }
217 
218 QString QgsNativeAlgorithms::svgIconPath() const
219 {
220  return QgsApplication::iconPath( QStringLiteral( "providerQgis.svg" ) );
221 }
222 
223 QString QgsNativeAlgorithms::id() const
224 {
225  return QStringLiteral( "native" );
226 }
227 
228 QString QgsNativeAlgorithms::helpId() const
229 {
230  return QStringLiteral( "qgis" );
231 }
232 
233 QString QgsNativeAlgorithms::name() const
234 {
235  return tr( "QGIS (native c++)" );
236 }
237 
239 {
240  return true;
241 }
242 
244 {
245  QgsScopedRuntimeProfile profile( QObject::tr( "QGIS native provider" ) );
246  addAlgorithm( new QgsAddIncrementalFieldAlgorithm() );
247  addAlgorithm( new QgsAddTableFieldAlgorithm() );
248  addAlgorithm( new QgsAddXYFieldsAlgorithm() );
249  addAlgorithm( new QgsAddUniqueValueIndexAlgorithm() );
250  addAlgorithm( new QgsAffineTransformationAlgorithm() );
251  addAlgorithm( new QgsAggregateAlgorithm() );
252  addAlgorithm( new QgsAngleToNearestAlgorithm() );
253  addAlgorithm( new QgsApplyLayerStyleAlgorithm() );
254  addAlgorithm( new QgsArrayTranslatedFeaturesAlgorithm() );
255  addAlgorithm( new QgsAspectAlgorithm() );
256  addAlgorithm( new QgsAssignProjectionAlgorithm() );
257  addAlgorithm( new QgsAttributeIndexAlgorithm() );
258  addAlgorithm( new QgsBookmarksToLayerAlgorithm() );
259  addAlgorithm( new QgsBoundaryAlgorithm() );
260  addAlgorithm( new QgsBoundingBoxAlgorithm() );
261  addAlgorithm( new QgsBufferAlgorithm() );
262  addAlgorithm( new QgsCalculateVectorOverlapsAlgorithm() );
263  addAlgorithm( new QgsCategorizeUsingStyleAlgorithm() );
264  addAlgorithm( new QgsCellStatisticsAlgorithm() );
265  addAlgorithm( new QgsCentroidAlgorithm() );
266  addAlgorithm( new QgsClipAlgorithm() );
267  addAlgorithm( new QgsCollectAlgorithm() );
268  addAlgorithm( new QgsCombineStylesAlgorithm() );
269  addAlgorithm( new QgsConditionalBranchAlgorithm() );
270  addAlgorithm( new QgsConstantRasterAlgorithm() );
271  addAlgorithm( new QgsConvertToCurvesAlgorithm() );
272  addAlgorithm( new QgsConvexHullAlgorithm() );
273  addAlgorithm( new QgsCreateDirectoryAlgorithm() );
274  addAlgorithm( new QgsDbscanClusteringAlgorithm() );
275  addAlgorithm( new QgsDeleteDuplicateGeometriesAlgorithm() );
276  addAlgorithm( new QgsDetectVectorChangesAlgorithm() );
277  addAlgorithm( new QgsDifferenceAlgorithm() );
278  addAlgorithm( new QgsDissolveAlgorithm() );
279  addAlgorithm( new QgsDrapeToMAlgorithm() );
280  addAlgorithm( new QgsDrapeToZAlgorithm() );
281  addAlgorithm( new QgsDropGeometryAlgorithm() );
282  addAlgorithm( new QgsDropMZValuesAlgorithm() );
283  addAlgorithm( new QgsDxfExportAlgorithm() );
284  addAlgorithm( new QgsExecutePostgisQueryAlgorithm() );
285  addAlgorithm( new QgsExecuteRegisteredSpatialiteQueryAlgorithm() );
286  addAlgorithm( new QgsExecuteSpatialiteQueryAlgorithm() );
287  addAlgorithm( new QgsExplodeAlgorithm() );
288  addAlgorithm( new QgsExplodeHstoreAlgorithm() );
289  addAlgorithm( new QgsExportMeshVerticesAlgorithm );
290  addAlgorithm( new QgsExportMeshFacesAlgorithm );
291  addAlgorithm( new QgsExportMeshEdgesAlgorithm );
292  addAlgorithm( new QgsExportMeshOnGridAlgorithm );
293  addAlgorithm( new QgsExtendLinesAlgorithm() );
294  addAlgorithm( new QgsExtentFromLayerAlgorithm() );
295  addAlgorithm( new QgsExtentToLayerAlgorithm() );
296  addAlgorithm( new QgsExtractBinaryFieldAlgorithm() );
297  addAlgorithm( new QgsExtractByAttributeAlgorithm() );
298  addAlgorithm( new QgsExtractByExpressionAlgorithm() );
299  addAlgorithm( new QgsExtractByExtentAlgorithm() );
300  addAlgorithm( new QgsExtractByLocationAlgorithm() );
301  addAlgorithm( new QgsExtractMValuesAlgorithm() );
302  addAlgorithm( new QgsExtractVerticesAlgorithm() );
303  addAlgorithm( new QgsExtractSpecificVerticesAlgorithm() );
304  addAlgorithm( new QgsExtractZValuesAlgorithm() );
305  addAlgorithm( new QgsFieldCalculatorAlgorithm() );
306  addAlgorithm( new QgsFileDownloaderAlgorithm() );
307  addAlgorithm( new QgsFillNoDataAlgorithm() );
308  addAlgorithm( new QgsFilterAlgorithm() );
309  addAlgorithm( new QgsFilterByGeometryAlgorithm() );
310  addAlgorithm( new QgsFilterByLayerTypeAlgorithm() );
311  addAlgorithm( new QgsFilterVerticesByM() );
312  addAlgorithm( new QgsFilterVerticesByZ() );
313  addAlgorithm( new QgsFixGeometriesAlgorithm() );
314  addAlgorithm( new QgsFlattenRelationshipsAlgorithm() );
315  addAlgorithm( new QgsForceRHRAlgorithm() );
316  addAlgorithm( new QgsFuzzifyRasterLinearMembershipAlgorithm() );
317  addAlgorithm( new QgsFuzzifyRasterPowerMembershipAlgorithm() );
318  addAlgorithm( new QgsFuzzifyRasterLargeMembershipAlgorithm() );
319  addAlgorithm( new QgsFuzzifyRasterSmallMembershipAlgorithm() );
320  addAlgorithm( new QgsFuzzifyRasterGaussianMembershipAlgorithm() );
321  addAlgorithm( new QgsFuzzifyRasterNearMembershipAlgorithm() );
322  addAlgorithm( new QgsGeometryByExpressionAlgorithm() );
323  addAlgorithm( new QgsGridAlgorithm() );
324  addAlgorithm( new QgsHillshadeAlgorithm() );
325  addAlgorithm( new QgsImportPhotosAlgorithm() );
326  addAlgorithm( new QgsInterpolatePointAlgorithm() );
327  addAlgorithm( new QgsIntersectionAlgorithm() );
328  addAlgorithm( new QgsJoinByAttributeAlgorithm() );
329  addAlgorithm( new QgsJoinByLocationAlgorithm() );
330  addAlgorithm( new QgsJoinByNearestAlgorithm() );
331  addAlgorithm( new QgsJoinWithLinesAlgorithm() );
332  addAlgorithm( new QgsKMeansClusteringAlgorithm() );
333  addAlgorithm( new QgsLayerToBookmarksAlgorithm() );
334  addAlgorithm( new QgsLayoutMapExtentToLayerAlgorithm() );
335 #ifndef QT_NO_PRINTER
336  addAlgorithm( new QgsLayoutAtlasToImageAlgorithm() );
337  addAlgorithm( new QgsLayoutAtlasToPdfAlgorithm() );
338  addAlgorithm( new QgsLayoutToImageAlgorithm() );
339  addAlgorithm( new QgsLayoutToPdfAlgorithm() );
340 #endif
341  addAlgorithm( new QgsLineDensityAlgorithm() );
342  addAlgorithm( new QgsLineIntersectionAlgorithm() );
343  addAlgorithm( new QgsLineSubstringAlgorithm() );
344  addAlgorithm( new QgsLoadLayerAlgorithm() );
345  addAlgorithm( new QgsMeanCoordinatesAlgorithm() );
346  addAlgorithm( new QgsMergeLinesAlgorithm() );
347  addAlgorithm( new QgsMergeVectorAlgorithm() );
348  addAlgorithm( new QgsMeshRasterizeAlgorithm );
349  addAlgorithm( new QgsMeshContoursAlgorithm );
350  addAlgorithm( new QgsMeshExportCrossSection );
351  addAlgorithm( new QgsMeshExportTimeSeries );
352  addAlgorithm( new QgsMinimumEnclosingCircleAlgorithm() );
353  addAlgorithm( new QgsMultipartToSinglepartAlgorithm() );
354  addAlgorithm( new QgsMultiRingConstantBufferAlgorithm() );
355  addAlgorithm( new QgsNearestNeighbourAnalysisAlgorithm() );
356  addAlgorithm( new QgsOffsetLinesAlgorithm() );
357  addAlgorithm( new QgsOrderByExpressionAlgorithm() );
358  addAlgorithm( new QgsOrientedMinimumBoundingBoxAlgorithm() );
359  addAlgorithm( new QgsOrthogonalizeAlgorithm() );
360  addAlgorithm( new QgsPackageAlgorithm() );
361  addAlgorithm( new QgsPixelCentroidsFromPolygonsAlgorithm() );
362  addAlgorithm( new QgsCreateArrayOffsetLinesAlgorithm() );
363  addAlgorithm( new QgsPointsInPolygonAlgorithm() );
364  addAlgorithm( new QgsPointOnSurfaceAlgorithm() );
365  addAlgorithm( new QgsPointToLayerAlgorithm() );
366  addAlgorithm( new QgsPointsAlongGeometryAlgorithm() );
367  addAlgorithm( new QgsPointsLayerFromTableAlgorithm() );
368  addAlgorithm( new QgsPoleOfInaccessibilityAlgorithm() );
369  addAlgorithm( new QgsPolygonizeAlgorithm() );
370  addAlgorithm( new QgsProjectPointCartesianAlgorithm() );
371  addAlgorithm( new QgsPromoteToMultipartAlgorithm() );
372  addAlgorithm( new QgsRaiseExceptionAlgorithm() );
373  addAlgorithm( new QgsRaiseWarningAlgorithm() );
374  addAlgorithm( new QgsRandomBinomialRasterAlgorithm() );
375  addAlgorithm( new QgsRandomExponentialRasterAlgorithm() );
376  addAlgorithm( new QgsRandomExtractAlgorithm() );
377  addAlgorithm( new QgsRandomGammaRasterAlgorithm() );
378  addAlgorithm( new QgsRandomGeometricRasterAlgorithm() );
379  addAlgorithm( new QgsRandomNegativeBinomialRasterAlgorithm() );
380  addAlgorithm( new QgsRandomNormalRasterAlgorithm() );
381  addAlgorithm( new QgsRandomPointsExtentAlgorithm() );
382  addAlgorithm( new QgsRandomPointsInPolygonsAlgorithm() );
383  addAlgorithm( new QgsRandomPointsOnLinesAlgorithm() );
384  addAlgorithm( new QgsRandomPoissonRasterAlgorithm() );
385  addAlgorithm( new QgsRandomUniformRasterAlgorithm() );
386  addAlgorithm( new QgsRasterFrequencyByEqualOperatorAlgorithm() );
387  addAlgorithm( new QgsRasterFrequencyByGreaterThanOperatorAlgorithm() );
388  addAlgorithm( new QgsRasterFrequencyByLessThanOperatorAlgorithm() );
389  addAlgorithm( new QgsRasterLayerUniqueValuesReportAlgorithm() );
390  addAlgorithm( new QgsRasterLayerZonalStatsAlgorithm() );
391  addAlgorithm( new QgsRasterLogicalAndAlgorithm() );
392  addAlgorithm( new QgsRasterLogicalOrAlgorithm() );
393  addAlgorithm( new QgsRasterizeAlgorithm() );
394  addAlgorithm( new QgsRasterPixelsToPointsAlgorithm() );
395  addAlgorithm( new QgsRasterPixelsToPolygonsAlgorithm() );
396  addAlgorithm( new QgsRasterSamplingAlgorithm() );
397  addAlgorithm( new QgsRasterStackHighestPositionAlgorithm() );
398  addAlgorithm( new QgsRasterStackLowestPositionAlgorithm() );
399  addAlgorithm( new QgsRasterStatisticsAlgorithm() );
400  addAlgorithm( new QgsRasterSurfaceVolumeAlgorithm() );
401  addAlgorithm( new QgsAlgorithmRemoveDuplicateVertices() );
402  addAlgorithm( new QgsReclassifyByLayerAlgorithm() );
403  addAlgorithm( new QgsReclassifyByTableAlgorithm() );
404  addAlgorithm( new QgsRectanglesOvalsDiamondsAlgorithm() );
405  addAlgorithm( new QgsRefactorFieldsAlgorithm() );
406  addAlgorithm( new QgsRemoveDuplicatesByAttributeAlgorithm() );
407  addAlgorithm( new QgsRemoveHolesAlgorithm() );
408  addAlgorithm( new QgsRemoveNullGeometryAlgorithm() );
409  addAlgorithm( new QgsRenameLayerAlgorithm() );
410  addAlgorithm( new QgsRenameTableFieldAlgorithm() );
411  addAlgorithm( new QgsRepairShapefileAlgorithm() );
412  addAlgorithm( new QgsRescaleRasterAlgorithm() );
413  addAlgorithm( new QgsReverseLineDirectionAlgorithm() );
414  addAlgorithm( new QgsRotateFeaturesAlgorithm() );
415  addAlgorithm( new QgsRoundRasterValuesAlgorithm() );
416  addAlgorithm( new QgsRuggednessAlgorithm() );
417  addAlgorithm( new QgsSaveFeaturesAlgorithm() );
418  addAlgorithm( new QgsSaveLogToFileAlgorithm() );
419  addAlgorithm( new QgsSaveSelectedFeatures() );
420  addAlgorithm( new QgsSegmentizeByMaximumAngleAlgorithm() );
421  addAlgorithm( new QgsSegmentizeByMaximumDistanceAlgorithm() );
422  addAlgorithm( new QgsSelectByLocationAlgorithm() );
423  addAlgorithm( new QgsServiceAreaFromLayerAlgorithm() );
424  addAlgorithm( new QgsServiceAreaFromPointAlgorithm() );
425  addAlgorithm( new QgsSetLayerEncodingAlgorithm() );
426  addAlgorithm( new QgsSetMValueAlgorithm() );
427  addAlgorithm( new QgsSetProjectVariableAlgorithm() );
428  addAlgorithm( new QgsSetZValueAlgorithm() );
429  addAlgorithm( new QgsShapefileEncodingInfoAlgorithm() );
430  addAlgorithm( new QgsShortestPathLayerToPointAlgorithm() );
431  addAlgorithm( new QgsShortestPathPointToLayerAlgorithm() );
432  addAlgorithm( new QgsShortestPathPointToPointAlgorithm() );
433  addAlgorithm( new QgsSimplifyAlgorithm() );
434  addAlgorithm( new QgsSingleSidedBufferAlgorithm() );
435  addAlgorithm( new QgsSlopeAlgorithm() );
436  addAlgorithm( new QgsSmoothAlgorithm() );
437  addAlgorithm( new QgsSnapGeometriesAlgorithm() );
438  addAlgorithm( new QgsSnapToGridAlgorithm() );
439  addAlgorithm( new QgsSpatialIndexAlgorithm() );
440  addAlgorithm( new QgsSplitFeaturesByAttributeCharacterAlgorithm() );
441  addAlgorithm( new QgsSplitGeometryAtAntimeridianAlgorithm() );
442  addAlgorithm( new QgsSplitLinesByLengthAlgorithm() );
443  addAlgorithm( new QgsSplitVectorLayerAlgorithm() );
444  addAlgorithm( new QgsSplitWithLinesAlgorithm() );
445  addAlgorithm( new QgsStringConcatenationAlgorithm() );
446  addAlgorithm( new QgsStyleFromProjectAlgorithm() );
447  addAlgorithm( new QgsSubdivideAlgorithm() );
448  addAlgorithm( new QgsSumLineLengthAlgorithm() );
449  addAlgorithm( new QgsSwapXYAlgorithm() );
450  addAlgorithm( new QgsSymmetricalDifferenceAlgorithm() );
451  addAlgorithm( new QgsTaperedBufferAlgorithm() );
452  addAlgorithm( new QgsTinMeshCreationAlgorithm() );
453  addAlgorithm( new QgsTransectAlgorithm() );
454  addAlgorithm( new QgsTransformAlgorithm() );
455  addAlgorithm( new QgsTranslateAlgorithm() );
456  addAlgorithm( new QgsTruncateTableAlgorithm() );
457  addAlgorithm( new QgsUnionAlgorithm() );
458  addAlgorithm( new QgsVariableWidthBufferByMAlgorithm() );
459  addAlgorithm( new QgsWedgeBuffersAlgorithm() );
460  addAlgorithm( new QgsWriteVectorTilesXyzAlgorithm() );
461  addAlgorithm( new QgsWriteVectorTilesMbtilesAlgorithm() );
462  addAlgorithm( new QgsZonalHistogramAlgorithm() );
463  addAlgorithm( new QgsZonalStatisticsAlgorithm() );
464  addAlgorithm( new QgsZonalStatisticsFeatureBasedAlgorithm() );
465  addAlgorithm( new QgsPolygonsToLinesAlgorithm() );
466  addAlgorithm( new QgsDensifyGeometriesByIntervalAlgorithm() );
467  addAlgorithm( new QgsDensifyGeometriesByCountAlgorithm() );
468 }
469 
QIcon icon() const override
Returns an icon for the provider.
Scoped object for logging of the runtime for a single operation or group of operations.
QString id() const override
Returns the unique provider id, used for identifying the provider.
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.
Abstract base class for processing providers.
QString helpId() const override
Returns the provider help id string, used for creating QgsHelp urls for algorithms belong to this pro...
void loadAlgorithms() override
Loads all algorithms belonging to this provider.
bool supportsNonFileBasedOutput() const override
Returns true if the provider supports non-file based outputs (such as memory layers or direct databas...
QString name() const override
Returns the provider name, which is used to describe the provider within the GUI. ...
bool addAlgorithm(QgsProcessingAlgorithm *algorithm)
Adds an algorithm to the provider.
QString svgIconPath() const override
Returns a path to an SVG version of the provider's icon.
QgsNativeAlgorithms(QObject *parent=nullptr)
Constructor for QgsNativeAlgorithms.