22 #include <QtConcurrentMap> 28 , mLabelingEngine( 0 )
65 QgsDebugMsg( QString(
"QThreadPool max thread count is %1" ).arg( QThreadPool::globalInstance()->maxThreadCount() ) );
85 it->context.setRenderingStopped(
true );
123 QgsDebugMsg( QString(
"waitForFinished (1): %1 ms" ).arg( t.elapsed() / 1000.0 ) );
137 QgsDebugMsg( QString(
"waitForFinished (2): %1 ms" ).arg( t.elapsed() / 1000.0 ) );
211 QgsDebugMsg( QString(
"job %1 start" ).arg(( ulong ) &job, 0, 16 ) );
215 job.renderer->render();
221 catch ( std::exception & e )
223 QgsDebugMsg(
"Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
227 QgsDebugMsg(
"Caught unhandled unknown exception" );
230 int tt = t.elapsed();
231 QgsDebugMsg( QString(
"job %1 end [%2 ms]" ).arg(( ulong ) &job, 0, 16 ).arg( tt ) );
238 QPainter painter( &self->mFinalImage );
242 drawLabeling( self->mSettings, self->mLabelingRenderContext, self->mLabelingEngine, &painter );
248 catch ( std::exception & e )
250 QgsDebugMsg(
"Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
254 QgsDebugMsg(
"Caught unhandled unknown exception" );
QgsRenderContext mLabelingRenderContext
void finished()
emitted when asynchronous rendering is finished (or canceled).
void setRenderingStopped(bool stopped)
void renderingFinished()
all rendering is finished, including labeling
virtual void waitForFinished() override
Block until the job has finished.
void cleanupJobs(LayerRenderJobs &jobs)
QgsLabelingResults * takeResults()
Return pointer to recently computed results (in drawLabeling()) and pass the ownership of results to ...
static QImage composeImage(const QgsMapSettings &settings, const LayerRenderJobs &jobs)
void loadEngineSettings()
load/save engine settings to project file
~QgsMapRendererParallelJob()
QgsPalLabeling * mLabelingEngine
virtual void cancel() override
Stop the rendering job - does not return until the job has terminated.
LayerRenderJobs prepareJobs(QPainter *painter, QgsPalLabeling *labelingEngine)
Enable drawing of labels on top of the map.
QFutureWatcher< void > mFutureWatcher
The QgsMapSettings class contains configuration for rendering of the map.
virtual Q_DECL_DEPRECATED void init(QgsMapRenderer *mr) override
called when we're going to start with rendering
QFuture< void > mLabelingFuture
QgsMapRendererParallelJob(const QgsMapSettings &settings)
bool renderingStopped() const
LayerRenderJobs mLayerJobs
Job implementation that renders all layers in parallel.
static void renderLabelsStatic(QgsMapRendererParallelJob *self)
void renderLayersFinished()
layers are rendered, labeling is still pending
bool testFlag(Flag flag) const
Check whether a particular flag is enabled.
enum QgsMapRendererParallelJob::@0 mStatus
Intermediate base class adding functionality that allows client to query the rendered image...
virtual void start() override
Start the rendering job and immediately return.
QFutureWatcher< void > mLabelingFutureWatcher
static void drawLabeling(const QgsMapSettings &settings, QgsRenderContext &renderContext, QgsPalLabeling *labelingEngine, QPainter *painter)
Class that stores computed placement from labeling engine.
static void renderLayerStatic(LayerRenderJob &job)
Defines a qgis exception class.
Structure keeping low-level rendering job information.
virtual bool isActive() const override
Tell whether the rendering job is currently running in background.
virtual QImage renderedImage() override
Get a preview/resulting image.
virtual QgsLabelingResults * takeLabelingResults() override
Get pointer to internal labeling engine (in order to get access to the results)