QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
27 , mParameters( parameters )
29 , mFeedback( feedback )
34 mFeedback = mOwnedFeedback.get();
39 if ( !( mAlgorithm && mAlgorithm->prepare( mParameters, context, mFeedback ) ) )
66 mResults = mAlgorithm->runPrepared( mParameters, mContext, mFeedback );
81 QVariantMap ppResults;
84 ppResults = mAlgorithm->postProcess( mContext, mFeedback );
86 emit
executed( result, !ppResults.isEmpty() ? ppResults : mResults );
Base class for providing feedback from a processing algorithm.
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
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
bool run() override
Performs the task's operation.
void cancel()
Tells the internal routines that the current operation should be canceled. This should be run by the ...
virtual void cancel()
Notifies the task that it should terminate.
void cancel() override
Notifies the task that it should terminate.
QgsProcessingAlgRunnerTask(const QgsProcessingAlgorithm *algorithm, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback=nullptr)
Constructor for QgsProcessingAlgRunnerTask.
Contains information about the context in which a processing algorithm is executed.
void executed(bool successful, const QVariantMap &results)
Emitted when the algorithm has finished execution.
void setProgress(double progress)
Sets the task's current progress.
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
bool isCanceled() const
Tells whether the operation has been canceled already.
Abstract base class for processing algorithms.
QgsProcessingAlgorithm * create(const QVariantMap &configuration=QVariantMap()) const SIP_THROW(QgsProcessingException)
Creates a copy of the algorithm, ready for execution.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
void finished(bool result) override
If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether ...
Custom exception class for processing related exceptions.
bool isCanceled() const
Will return true if task should terminate ASAP.
Abstract base class for long running background tasks.