32 mImage.setDotsPerMeterX( 1000 * settings.
outputDpi() / 25.4 );
33 mImage.setDotsPerMeterY( 1000 * settings.
outputDpi() / 25.4 );
34 mImage.fill( Qt::transparent );
43 QgsDebugMsgLevel( QStringLiteral(
"SEQUENTIAL destruct -- still running! (canceling)" ), 5 );
47 Q_ASSERT( !mInternalJob && !mPainter );
51 void QgsMapRendererSequentialJob::startPrivate()
56 mLabelingResults.reset();
64 Q_ASSERT( !mInternalJob && !mPainter );
66 mPainter =
new QPainter( &mImage );
76 mInternalJob->
start();
88 Q_ASSERT( !mInternalJob && !mPainter );
110 return nullptr != mInternalJob;
115 return mUsedCachedLabels;
120 return mLabelingResults.release();
152 mInternalJob->deleteLater();
153 mInternalJob =
nullptr;
Class that stores computed placement from labeling engine.
Job implementation that renders everything sequentially using a custom painter.
void cancel() override
Stop the rendering job - does not return until the job has terminated.
const std::vector< LayerRenderJob > & jobs() const
QgsLabelingResults * takeLabelingResults() override
Gets pointer to internal labeling engine (in order to get access to the results).
void cancelWithoutBlocking() override
Triggers cancellation of the rendering job without blocking.
void waitForFinished() override
Block until the job has finished.
bool usedCachedLabels() const override
Returns true if the render job was able to use a cached labeling solution.
static QImage composeImage(const QgsMapSettings &settings, const std::vector< LayerRenderJob > &jobs, const LabelRenderJob &labelJob, const QgsMapRendererCache *cache=nullptr)
void setCache(QgsMapRendererCache *cache)
Assign a cache to be used for reading and storing rendered images of individual layers.
void setLabelSink(QgsLabelSink *sink)
Assigns the label sink which will take over responsibility for handling labels during the rendering j...
std::unique_ptr< QgsRenderedItemResults > mRenderedItemResults
Errors errors() const
List of errors that happened during the rendering job - available when the rendering has been finishe...
void layerRendered(const QString &layerId)
Emitted when a layer has completed rendering.
QElapsedTimer mRenderingStart
QgsMapRendererCache * mCache
void finished()
emitted when asynchronous rendering is finished (or canceled).
QgsLabelSink * labelSink() const
Returns the label sink associated to this rendering job.
void start()
Start the rendering job and immediately return.
void layerRenderingStarted(const QString &layerId)
Emitted just before rendering starts for a particular layer.
QStringList mLayersRedrawnFromCache
QStringList layersRedrawnFromCache() const
Returns a list of the layer IDs for all layers which were redrawn from cached images.
QgsRenderedItemResults * takeRenderedItemResults()
Takes the rendered item results from the map render job and returns them.
Intermediate base class adding functionality that allows client to query the rendered image.
bool usedCachedLabels() const override
Returns true if the render job was able to use a cached labeling solution.
void cancelWithoutBlocking() override
Triggers cancellation of the rendering job without blocking.
~QgsMapRendererSequentialJob() override
QImage renderedImage() override
Gets a preview/resulting image.
void waitForFinished() override
Block until the job has finished.
void cancel() override
Stop the rendering job - does not return until the job has terminated.
QgsLabelingResults * takeLabelingResults() override
Gets pointer to internal labeling engine (in order to get access to the results).
QgsMapRendererSequentialJob(const QgsMapSettings &settings)
bool isActive() const override
Tell whether the rendering job is currently running in background.
The QgsMapSettings class contains configuration for rendering of the map.
QSize deviceOutputSize() const
Returns the device output size of the map render.
float devicePixelRatio() const
Returns the device pixel ratio.
QImage::Format outputImageFormat() const
format of internal QImage, default QImage::Format_ARGB32_Premultiplied
double outputDpi() const
Returns the DPI (dots per inch) used for conversion between real world units (e.g.
#define QgsDebugMsgLevel(str, level)