QGIS API Documentation  3.17.0-Master (a035f434f4)
qgsmaprendererstagedrenderjob.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaprendererstagedrenderjob.h
3  --------------------------------------
4  Date : August 2019
5  Copyright : (C) 2019 by Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSMAPRENDERERSTAGEDRENDERJOB_H
17 #define QGSMAPRENDERERSTAGEDRENDERJOB_H
18 
19 #include "qgis_core.h"
20 #include "qgis_sip.h"
22 
23 #define SIP_NO_FILE
24 
33 {
34  Q_OBJECT
35  public:
36 
40  enum Flag
41  {
42  RenderLabelsByMapLayer = 0x01,
43  };
44  Q_DECLARE_FLAGS( Flags, Flag )
45 
46 
50  {
54  };
55 
62  QgsMapRendererStagedRenderJob( const QgsMapSettings &settings, Flags flags = Flags() );
64 
65  void start() override;
66  void cancel() override;
67  void cancelWithoutBlocking() override;
68  void waitForFinished() override;
69  bool isActive() const override;
70  bool usedCachedLabels() const override;
72 
78  bool renderCurrentPart( QPainter *painter );
79 
86  bool nextPart();
87 
91  bool isFinished() const;
92 
96  QString currentLayerId() const;
97 
103  double currentLayerOpacity() const;
104 
110  QPainter::CompositionMode currentLayerCompositionMode() const;
111 
115  RenderStage currentStage() const;
116 
117  private:
118 
119  std::unique_ptr< QgsLabelingEngine > mLabelingEngineV2;
120 
121  LayerRenderJobs mLayerJobs;
122  LabelRenderJob mLabelJob;
123  LayerRenderJobs::iterator mJobIt;
124 
125  bool mNextIsLabel = false;
126  bool mExportedLabels = false;
127  Flags mFlags = Flags();
128  bool mPreparedStagedLabelJob = false;
129  QStringList mLabelingLayers;
130  QStringList::iterator mLabelLayerIt;
131 };
132 
133 #endif // QGSMAPRENDERERSTAGEDRENDERJOB_H
The QgsMapSettings class contains configuration for rendering of the map.
Abstract base class for map renderer jobs which use custom painters.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
virtual void waitForFinished()=0
Block until the job has finished.
RenderStage
Represents the stages of a rendering job.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Render job implementation that renders maps in stages, allowing different stages (e.g.
virtual void start()=0
Start the rendering job and immediately return.
The QgsLabelingEngine class provides map labeling functionality.
Flag
Flags which control the staged render job behavior.
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.
Class that stores computed placement from labeling engine.
virtual QgsLabelingResults * takeLabelingResults()=0
Gets pointer to internal labeling engine (in order to get access to the results). ...
virtual bool isActive() const =0
Tell whether the rendering job is currently running in background.
virtual bool usedCachedLabels() const =0
Returns true if the render job was able to use a cached labeling solution.