16 #ifndef QGSMAPRENDERERJOB_H 
   17 #define QGSMAPRENDERERJOB_H 
   19 #include "qgis_core.h" 
   21 #include <QFutureWatcher> 
   26 #include <QElapsedTimer> 
   58   bool imageInitialized = 
false;
 
   60   bool imageCanBeComposed() 
const;
 
   64   QPainter::CompositionMode blendMode;
 
   76   bool completed = 
false;
 
   89   int estimatedRenderingTime = 0;
 
  119   QImage *maskImage = 
nullptr;
 
  125   LayerRenderJob *firstPassJob = 
nullptr;
 
  133   QList<QPair<LayerRenderJob *, int>> maskJobs;
 
  136 typedef QList<LayerRenderJob> LayerRenderJobs;
 
  142 struct LabelRenderJob
 
  150   QImage *img = 
nullptr;
 
  162   QVector<QImage *> maskImages;
 
  173   bool canUseCache = 
false;
 
  175   bool complete = 
false;
 
  177   int renderingTime = -1;
 
  179   QList< QPointer< QgsMapLayer > > participatingLayers;
 
  278       Error( 
const QString &lid, 
const QString &msg )
 
  287     typedef QList<QgsMapRendererJob::Error> 
Errors;
 
  324     void setLayerRenderingTimeHints( const QHash< QString, 
int > &hints ) 
SIP_SKIP;
 
  344     static const QString LABEL_PREVIEW_CACHE_ID 
SIP_SKIP;
 
  355     void renderingLayersFinished();
 
  363     QElapsedTimer mRenderingStart;
 
  368     int mRenderingTime = 0;
 
  378     QHash< QString, 
int > mLayerRenderingTimeHints;
 
  383     bool mRecordRenderingTime = true;
 
  420     LayerRenderJobs prepareSecondPassJobs( LayerRenderJobs &firstPassJobs, LabelRenderJob &labelJob ) 
SIP_SKIP;
 
  424                                 const LayerRenderJobs &jobs,
 
  425                                 const LabelRenderJob &labelJob,
 
  437     static 
void composeSecondPass( LayerRenderJobs &secondPassJobs, LabelRenderJob &labelJob ) 
SIP_SKIP;
 
  440     void logRenderingTime( const LayerRenderJobs &jobs, const LayerRenderJobs &secondPassJobs, const LabelRenderJob &labelJob ) 
SIP_SKIP;
 
  443     void cleanupJobs( LayerRenderJobs &jobs ) 
SIP_SKIP;
 
  446     void cleanupSecondPassJobs( LayerRenderJobs &jobs ) 
SIP_SKIP;
 
  454     void cleanupLabelJob( LabelRenderJob &job ) 
SIP_SKIP;
 
  483     QImage *allocateImage( QString layerId );
 
  486     QPainter *allocateImageAndPainter( QString layerId, QImage *&image );
 
Abstract interface for use by classes that filter the features or attributes of a layer.
The QgsLabelingEngine class provides map labeling functionality.
Class that stores computed placement from labeling engine.
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Base class for all map layer types.
This class is responsible for keeping cache of rendered images resulting from a map rendering job.
Abstract base class for map rendering implementations.
virtual void waitForFinished()=0
Block until the job has finished.
void setCache(QgsMapRendererCache *cache)
Assign a cache to be used for reading and storing rendered images of individual layers.
virtual QgsLabelingResults * takeLabelingResults()=0
Gets pointer to internal labeling engine (in order to get access to the results).
QHash< QgsMapLayer *, int > perLayerRenderingTime() const
Returns the render time (in ms) per layer.
virtual bool usedCachedLabels() const =0
Returns true if the render job was able to use a cached labeling solution.
const QgsFeatureFilterProvider * featureFilterProvider() const
Returns the feature filter provider used by the QgsRenderContext of each LayerRenderJob.
Errors errors() const
List of errors that happened during the rendering job - available when the rendering has been finishe...
QgsMapRendererJob(const QgsMapSettings &settings)
int renderingTime() const
Returns the total time it took to finish the job (in milliseconds).
virtual void start()=0
Start the rendering job and immediately return.
QList< QgsMapRendererJob::Error > Errors
virtual bool isActive() const =0
Tell whether the rendering job is currently running in background.
void setFeatureFilterProvider(const QgsFeatureFilterProvider *f)
Set the feature filter provider used by the QgsRenderContext of each LayerRenderJob.
virtual void cancel()=0
Stop the rendering job - does not return until the job has terminated.
virtual void cancelWithoutBlocking()=0
Triggers cancellation of the rendering job without blocking.
Intermediate base class adding functionality that allows client to query the rendered image.
QgsMapRendererQImageJob(const QgsMapSettings &settings)
virtual QImage renderedImage()=0
Gets a preview/resulting image.
The QgsMapSettings class contains configuration for rendering of the map.
This class allows the creation of mask ids based on the different label layers and to give a mask id ...
A rectangle specified with double values.
Contains information about the context of a rendering operation.
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
Error(const QString &lid, const QString &msg)