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