QGIS API Documentation  3.21.0-Master (909859188c)
qgsmaprendererparalleljob.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaprendererparalleljob.h
3  --------------------------------------
4  Date : December 2013
5  Copyright : (C) 2013 by Martin Dobias
6  Email : wonder dot sk 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 QGSMAPRENDERERPARALLELJOB_H
17 #define QGSMAPRENDERERPARALLELJOB_H
18 
19 #include "qgis_core.h"
20 #include "qgis_sip.h"
21 #include "qgsmaprendererjob.h"
22 
33 {
34  Q_OBJECT
35  public:
36  QgsMapRendererParallelJob( const QgsMapSettings &settings );
37  ~QgsMapRendererParallelJob() override;
38 
39  void cancel() override;
40  void cancelWithoutBlocking() override;
41  void waitForFinished() override;
42  bool isActive() const override;
43 
44  bool usedCachedLabels() const override;
46 
47  // from QgsMapRendererJobWithPreview
48  QImage renderedImage() override;
49 
50  private slots:
52  void renderLayersFinished();
54  void renderLayersSecondPassFinished();
56  void renderingFinished();
57 
58  private:
59 
61  static void renderLayerStatic( LayerRenderJob &job ) SIP_SKIP;
63  static void renderLabelsStatic( QgsMapRendererParallelJob *self ) SIP_SKIP;
64 
65  void startPrivate() override;
66 
67  QImage mFinalImage;
68 
70  enum { Idle, RenderingLayers, RenderingSecondPass, RenderingLabels } mStatus SIP_SKIP;
71 
72  QFuture<void> mFuture;
73  QFutureWatcher<void> mFutureWatcher;
74 
75  std::vector< LayerRenderJob > mLayerJobs;
76  LabelRenderJob mLabelJob;
77 
78  std::vector< LayerRenderJob > mSecondPassLayerJobs;
79  QFuture<void> mSecondPassFuture;
80  QFutureWatcher<void> mSecondPassFutureWatcher;
81 
83  std::unique_ptr< QgsLabelingEngine > mLabelingEngineV2;
84  QFuture<void> mLabelingFuture;
85  QFutureWatcher<void> mLabelingFutureWatcher;
86 
87 };
88 
89 
90 #endif // QGSMAPRENDERERPARALLELJOB_H
Class that stores computed placement from labeling engine.
virtual void waitForFinished()=0
Block until the job has finished.
virtual QgsLabelingResults * takeLabelingResults()=0
Gets pointer to internal labeling engine (in order to get access to the results).
virtual bool usedCachedLabels() const =0
Returns true if the render job was able to use a cached labeling solution.
virtual bool isActive() const =0
Tell whether the rendering job is currently running in background.
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.
Job implementation that renders all layers in parallel.
Intermediate base class adding functionality that allows client to query the rendered image.
virtual QImage renderedImage()=0
Gets a preview/resulting image.
The QgsMapSettings class contains configuration for rendering of the map.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36