27 tr(
"Executing “%1”" ).arg(
algorithm->displayName() ),
30 , mParameters( parameters )
32 , mFeedback( feedback )
37 mFeedback = mOwnedFeedback.get();
42 if ( !( mAlgorithm && mAlgorithm->prepare( mParameters, context, mFeedback ) ) )
69 mResults = mAlgorithm->runPrepared( mParameters, mContext, mFeedback );
84 QVariantMap ppResults;
87 ppResults = mAlgorithm->postProcess( mContext, mFeedback );
89 emit
executed( result, !ppResults.isEmpty() ? ppResults : mResults );
@ Critical
Critical/error message.
bool isCanceled() const
Tells whether the operation has been canceled already.
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
void cancel()
Tells the internal routines that the current operation should be canceled. This should be run by the ...
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
void cancel() override
Notifies the task that it should terminate.
void finished(bool result) override
If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether ...
bool run() override
Performs the task's operation.
void executed(bool successful, const QVariantMap &results)
Emitted when the algorithm has finished execution.
QgsProcessingAlgRunnerTask(const QgsProcessingAlgorithm *algorithm, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback=nullptr, QgsTask::Flags flags=QgsTask::CanCancel)
Constructor for QgsProcessingAlgRunnerTask.
Abstract base class for processing algorithms.
QgsProcessingAlgorithm * create(const QVariantMap &configuration=QVariantMap()) const
Creates a copy of the algorithm, ready for execution.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
Abstract base class for long running background tasks.
virtual void cancel()
Notifies the task that it should terminate.
bool isCanceled() const
Will return true if task should terminate ASAP.
void setProgress(double progress)
Sets the task's current progress.
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