27 , mParameters( parameters )
29 , mFeedback( feedback )
34 mFeedback = mOwnedFeedback.get();
38 mAlgorithm.reset( algorithm->
create() );
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 );
bool isCanceled() const
Tells whether the operation has been canceled already.
void setProgress(double progress)
Sets the task's current progress.
Base class for providing feedback from a processing algorithm.
void cancel()
Tells the internal routines that the current operation should be canceled. This should be run by the ...
bool run() override
Performs the task's operation.
Abstract base class for processing algorithms.
QgsProcessingAlgRunnerTask(const QgsProcessingAlgorithm *algorithm, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback=nullptr)
Constructor for QgsProcessingAlgRunnerTask.
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
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).
Abstract base class for long running background tasks.
Custom exception class for processing related exceptions.
bool isCanceled() const
Will return true if task should terminate ASAP.
void cancel() override
Notifies the task that it should terminate.
virtual void cancel()
Notifies the task that it should terminate.
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
void finished(bool result) override
If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether ...
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.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
QgsProcessingAlgorithm * create(const QVariantMap &configuration=QVariantMap()) const SIP_THROW(QgsProcessingException)
Creates a copy of the algorithm, ready for execution.