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