QGIS API Documentation 4.3.0-Master (3b7b3208a79)
Loading...
Searching...
No Matches
QgsProcessingResultsHandler Class Reference

Handles results output by Processing algorithms. More...

#include <qgsprocessingpostprocessor.h>

Classes

struct  ResultDetails
 Stores results of running the handleAlgorithmResultsProtected method. More...
class  ResultLayerDetails
 Contains details of a layer result from running an algorithm. More...

Public Member Functions

 QgsProcessingResultsHandler ()=default
virtual ~QgsProcessingResultsHandler ()
bool handleAlgorithmResults (const QgsProcessingAlgorithm *algorithm, QgsProcessingContext &context, const QVariantMap &parameters, QgsProcessingFeedback *feedback=nullptr)
 Handles the results from running an algorithm.

Static Public Member Functions

static QgsMapLayer * addResultLayers (const QVector< QgsProcessingResultsHandler::ResultLayerDetails > &layers, const QgsProcessingContext &context, QgsLayerTreeNode *currentSelectedNode)
 Responsible for adding layers created by an algorithm to a project and the project's layer tree in the correct location.
static void configureResultLayerTreeLayer (QgsLayerTreeLayer *layerTreeLayer)
 Applies post-processing steps to the QgsLayerTreeLayer created for an algorithm's output.
static QString determineOutputName (const QString &destinationId, const QgsProcessingContext::LayerDetails &details, const QgsProcessingAlgorithm *algorithm, QgsProcessingContext &context, const QVariantMap &parameters)
 Determines the desired layer name for a map layer output.
static QgsLayerTreeGroup * layerTreeResultsGroup (const QgsProcessingContext::LayerDetails &layerDetails, const QgsProcessingContext &context)
 Returns the destination layer tree group to store results in, or nullptr if there is no specific destination tree group associated with the layer.

Protected Member Functions

virtual QgsMapLayer * handleAddResultLayers (const QgsProcessingResultsHandler::ResultDetails &details, const QgsProcessingContext &context)
 Calls addResultLayers(), allowing for extra logic to be injected in subclasses.
virtual QgsProcessingResultsHandler::ResultDetails handleAlgorithmResultsProtected (const QgsProcessingAlgorithm *algorithm, QgsProcessingContext &context, const QVariantMap &parameters, QgsProcessingFeedback *feedback)
 Handles the results from running an algorithm.
virtual void setNewActiveLayer (QgsMapLayer *layer)
 Handles setting the new project active layer after processing the results.

Detailed Description

Handles results output by Processing algorithms.

Warning
This is not considered stable API, and is exposed to Python for internal use only.
Since
QGIS 4.4

Definition at line 64 of file qgsprocessingpostprocessor.h.

Constructor & Destructor Documentation

◆ QgsProcessingResultsHandler()

QgsProcessingResultsHandler::QgsProcessingResultsHandler ( )
default

◆ ~QgsProcessingResultsHandler()

QgsProcessingResultsHandler::~QgsProcessingResultsHandler ( )
virtualdefault

Member Function Documentation

◆ addResultLayers()

QgsMapLayer * QgsProcessingResultsHandler::addResultLayers ( const QVector< QgsProcessingResultsHandler::ResultLayerDetails > & layers,
const QgsProcessingContext & context,
QgsLayerTreeNode * currentSelectedNode )
static

Responsible for adding layers created by an algorithm to a project and the project's layer tree in the correct location.

Returns the map layer which should be set as the project's active layer after adding all the results.

Definition at line 328 of file qgsprocessingpostprocessor.cpp.

◆ configureResultLayerTreeLayer()

void QgsProcessingResultsHandler::configureResultLayerTreeLayer ( QgsLayerTreeLayer * layerTreeLayer)
static

Applies post-processing steps to the QgsLayerTreeLayer created for an algorithm's output.

Definition at line 187 of file qgsprocessingpostprocessor.cpp.

◆ determineOutputName()

QString QgsProcessingResultsHandler::determineOutputName ( const QString & destinationId,
const QgsProcessingContext::LayerDetails & details,
const QgsProcessingAlgorithm * algorithm,
QgsProcessingContext & context,
const QVariantMap & parameters )
static

Determines the desired layer name for a map layer output.

Definition at line 104 of file qgsprocessingpostprocessor.cpp.

◆ handleAddResultLayers()

QgsMapLayer * QgsProcessingResultsHandler::handleAddResultLayers ( const QgsProcessingResultsHandler::ResultDetails & details,
const QgsProcessingContext & context )
protectedvirtual

Calls addResultLayers(), allowing for extra logic to be injected in subclasses.

Definition at line 320 of file qgsprocessingpostprocessor.cpp.

◆ handleAlgorithmResults()

bool QgsProcessingResultsHandler::handleAlgorithmResults ( const QgsProcessingAlgorithm * algorithm,
QgsProcessingContext & context,
const QVariantMap & parameters,
QgsProcessingFeedback * feedback = nullptr )

Handles the results from running an algorithm.

Returns true if all results could be successfully loaded.

Definition at line 201 of file qgsprocessingpostprocessor.cpp.

◆ handleAlgorithmResultsProtected()

QgsProcessingResultsHandler::ResultDetails QgsProcessingResultsHandler::handleAlgorithmResultsProtected ( const QgsProcessingAlgorithm * algorithm,
QgsProcessingContext & context,
const QVariantMap & parameters,
QgsProcessingFeedback * feedback )
protectedvirtual

Handles the results from running an algorithm.

Definition at line 213 of file qgsprocessingpostprocessor.cpp.

◆ layerTreeResultsGroup()

QgsLayerTreeGroup * QgsProcessingResultsHandler::layerTreeResultsGroup ( const QgsProcessingContext::LayerDetails & layerDetails,
const QgsProcessingContext & context )
static

Returns the destination layer tree group to store results in, or nullptr if there is no specific destination tree group associated with the layer.

Definition at line 139 of file qgsprocessingpostprocessor.cpp.

◆ setNewActiveLayer()

void QgsProcessingResultsHandler::setNewActiveLayer ( QgsMapLayer * layer)
protectedvirtual

Handles setting the new project active layer after processing the results.

The base class version does nothing.

Definition at line 325 of file qgsprocessingpostprocessor.cpp.


The documentation for this class was generated from the following files: