18#ifndef QGSPROCESSINGPOSTPROCESSOR_H
19#define QGSPROCESSINGPOSTPROCESSOR_H
151 QList<QgsProcessingResultsHandler::ResultLayerDetails>
addedLayers;
Layer tree group node serves as a container for layers and further groups.
Layer tree node points to a map layer.
Base class for nodes in a layer tree.
Base class for all map layer types.
Abstract base class for processing algorithms.
Details for layers to load into projects.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
virtual void postProcessLayer(QgsMapLayer *layer, const QString &outputName, const QgsProcessingAlgorithm *algorithm)
Post-processes a layer, e.g.
virtual ~QgsProcessingLayerPostProcessor()
QgsProcessingLayerPostProcessor()=default
int sortKey
Sort order key for ordering output layers in the layer tree.
QgsLayerTreeGroup * targetLayerTreeGroup
Optional target layer tree group, where the layer should be placed.
QgsMapLayer * layer
Associated map layer.
ResultLayerDetails(QgsMapLayer *layer)
Constructor for ResultLayerDetails.
QgsProject * destinationProject
Destination QGIS project.
static void configureResultLayerTreeLayer(QgsLayerTreeLayer *layerTreeLayer)
Applies post-processing steps to the QgsLayerTreeLayer created for an algorithm's output.
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 th...
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 dest...
virtual QgsMapLayer * handleAddResultLayers(const QgsProcessingResultsHandler::ResultDetails &details, const QgsProcessingContext &context)
Calls addResultLayers(), allowing for extra logic to be injected in subclasses.
virtual void setNewActiveLayer(QgsMapLayer *layer)
Handles setting the new project active layer after processing the results.
static QString determineOutputName(const QString &destinationId, const QgsProcessingContext::LayerDetails &details, const QgsProcessingAlgorithm *algorithm, QgsProcessingContext &context, const QVariantMap ¶meters)
Determines the desired layer name for a map layer output.
bool handleAlgorithmResults(const QgsProcessingAlgorithm *algorithm, QgsProcessingContext &context, const QVariantMap ¶meters, QgsProcessingFeedback *feedback=nullptr)
Handles the results from running an algorithm.
QgsProcessingResultsHandler()=default
virtual QgsProcessingResultsHandler::ResultDetails handleAlgorithmResultsProtected(const QgsProcessingAlgorithm *algorithm, QgsProcessingContext &context, const QVariantMap ¶meters, QgsProcessingFeedback *feedback)
Handles the results from running an algorithm.
virtual ~QgsProcessingResultsHandler()
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
Stores results of running the handleAlgorithmResultsProtected method.
bool succeeded
true if all layers could be successfully loaded
QList< QgsProcessingResultsHandler::ResultLayerDetails > addedLayers
Details of newly added layers.