QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
22 #include <gdal_version.h>
26 #include <pdal/pdal.hpp>
30 : mLogFeedback( logFeedback )
39 void QgsProcessingFeedback::log(
const QString &htmlMessage,
const QString &textMessage )
41 constexpr
int MESSAGE_COUNT_LIMIT = 10000;
43 if ( mMessageLoggedCount == MESSAGE_COUNT_LIMIT )
45 ++mMessageLoggedCount;
46 if ( mMessageLoggedCount == MESSAGE_COUNT_LIMIT )
48 mHtmlLog.append( QStringLiteral(
"<span style=\"color:red\">%1</span><br/>" ).arg( tr(
"Message log truncated" ) ) );
49 mTextLog.append( tr(
"Message log truncated" ) +
'\n' );
53 mHtmlLog.append( htmlMessage );
54 mTextLog.append( textMessage );
64 log( QStringLiteral(
"<span style=\"color:red\">%1</span><br/>" ).arg( error.toHtmlEscaped() ).replace(
'\n', QLatin1String(
"<br>" ) ),
73 log( QStringLiteral(
"<span style=\"color:#b85a20;\">%1</span><br/>" ).arg( warning.toHtmlEscaped() ).replace(
'\n', QLatin1String(
"<br>" ) ) + QStringLiteral(
"<br/>" ),
82 mHtmlLog.append( info.toHtmlEscaped().replace(
'\n', QLatin1String(
"<br>" ) ) + QStringLiteral(
"<br/>" ) );
83 mTextLog.append( info +
'\n' );
91 log( QStringLiteral(
"<code>%1</code><br/>" ).arg( info.toHtmlEscaped().replace(
'\n', QLatin1String(
"<br>" ) ) ),
100 log( QStringLiteral(
"<span style=\"color:#777\">%1</span><br/>" ).arg( info.toHtmlEscaped().replace(
'\n', QLatin1String(
"<br>" ) ) ),
109 log( QStringLiteral(
"<code style=\"color:#777\">%1</code><br/>" ).arg( info.toHtmlEscaped().replace(
'\n', QLatin1String(
"<br>" ) ) ),
121 pushDebugInfo( tr(
"Python version: %1" ).arg( PYTHON_VERSION ) );
122 pushDebugInfo( tr(
"GDAL version: %1" ).arg( GDALVersionInfo(
"RELEASE_NAME" ) ) );
123 pushDebugInfo( tr(
"GEOS version: %1" ).arg( GEOSversion() ) );
125 const PJ_INFO info = proj_info();
126 pushDebugInfo( tr(
"PROJ version: %1" ).arg( info.release ) );
128 #ifdef HAVE_PDAL_QGIS
129 #if PDAL_VERSION_MAJOR_INT > 1 || (PDAL_VERSION_MAJOR_INT == 1 && PDAL_VERSION_MINOR_INT >= 7)
130 pushDebugInfo( tr(
"PDAL version: %1" ).arg( QString::fromStdString( pdal::Config::fullVersionString() ) ) );
132 pushDebugInfo( tr(
"PDAL version: %1" ).arg( QString::fromStdString( pdal::GetFullVersionString() ) ) );
136 if ( provider && !provider->
versionInfo().isEmpty() )
154 : mChildSteps( childAlgorithmCount )
155 , mFeedback( feedback )
164 mFeedback->
setProgress( 100.0 *
static_cast< double >( mCurrentStep ) / mChildSteps );
212 void QgsProcessingMultiStepFeedback::updateOverallProgress(
double progress )
214 const double baseProgress = 100.0 *
static_cast< double >( mCurrentStep ) / mChildSteps;
215 const double currentAlgorithmProgress =
progress / mChildSteps;
216 mFeedback->
setProgress( baseProgress + currentAlgorithmProgress );
void setProgress(double progress)
Sets the current progress for the feedback object.
virtual void setProgressText(const QString &text)
Sets a progress report text string.
QgsProcessingFeedback(bool logFeedback=true)
Constructor for QgsProcessingFeedback.
static QString version()
Version string.
virtual void pushCommandInfo(const QString &info)
Pushes an informational message containing a command from the algorithm.
void pushWarning(const QString &warning) override
Pushes a warning informational message from the algorithm.
Base class for providing feedback from a processing algorithm.
void canceled()
Internal routines can connect to this signal if they use event loop.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
Abstract base class for processing providers.
void reportError(const QString &error, bool fatalError=false) override
Reports that the algorithm encountered an error while executing.
virtual QString textLog() const
Returns the plain text contents of the log, which contains all messages pushed to the feedback object...
void cancel()
Tells the internal routines that the current operation should be canceled. This should be run by the ...
virtual QString versionInfo() const
Returns a version information string for the provider, or an empty string if this is not applicable (...
void pushConsoleInfo(const QString &info) override
Pushes a console feedback message from the algorithm.
virtual void pushConsoleInfo(const QString &info)
Pushes a console feedback message from the algorithm.
QString htmlLog() const override
Returns the HTML formatted contents of the log, which contains all messages pushed to the feedback ob...
virtual QString name() const =0
Returns the provider name, which is used to describe the provider within the GUI.
QgsProcessingMultiStepFeedback(int steps, QgsProcessingFeedback *feedback)
Constructor for QgsProcessingMultiStepFeedback, for a process with the specified number of steps.
void pushVersionInfo(const QgsProcessingProvider *provider=nullptr)
Pushes a summary of the QGIS (and underlying library) version information to the log.
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 progressChanged(double progress)
Emitted when the feedback object reports a progress change.
void pushDebugInfo(const QString &info) override
Pushes an informational message containing debugging helpers from the algorithm.
virtual void pushDebugInfo(const QString &info)
Pushes an informational message containing debugging helpers from the algorithm.
virtual QString htmlLog() const
Returns the HTML formatted contents of the log, which contains all messages pushed to the feedback ob...
double progress() const SIP_HOLDGIL
Returns the current progress reported by the feedback object.
QString textLog() const override
Returns the plain text contents of the log, which contains all messages pushed to the feedback object...
void pushCommandInfo(const QString &info) override
Pushes an informational message containing a command from the algorithm.
void pushInfo(const QString &info) override
Pushes a general informational message from the algorithm.
void setCurrentStep(int step)
Sets the step which is being executed.
void setProgressText(const QString &text) override
Sets a progress report text string.
virtual void pushWarning(const QString &warning)
Pushes a warning informational message from the algorithm.
static QString devVersion()
The development version.