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