QGIS API Documentation  2.99.0-Master (314842d)
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 "qgsmaprendererjob.h"
21 
31 {
32  Q_OBJECT
33  public:
34  QgsMapRendererParallelJob( const QgsMapSettings &settings );
36 
37  virtual void start() override;
38  virtual void cancel() override;
39  virtual void cancelWithoutBlocking() override;
40  virtual void waitForFinished() override;
41  virtual bool isActive() const override;
42 
43  virtual bool usedCachedLabels() const override;
44  virtual QgsLabelingResults *takeLabelingResults() override;
45 
46  // from QgsMapRendererJobWithPreview
47  virtual QImage renderedImage() override;
48 
49  private slots:
51  void renderLayersFinished();
53  void renderingFinished();
54 
55  private:
56 
58  static void renderLayerStatic( LayerRenderJob &job );
60  static void renderLabelsStatic( QgsMapRendererParallelJob *self );
61 
62  QImage mFinalImage;
63 
65  enum { Idle, RenderingLayers, RenderingLabels } mStatus;
66 
67  QFuture<void> mFuture;
68  QFutureWatcher<void> mFutureWatcher;
69 
70  LayerRenderJobs mLayerJobs;
71  LabelRenderJob mLabelJob;
72 
74  std::unique_ptr< QgsLabelingEngine > mLabelingEngineV2;
75  QFuture<void> mLabelingFuture;
76  QFutureWatcher<void> mLabelingFutureWatcher;
77 
78 };
79 
80 
81 #endif // QGSMAPRENDERERPARALLELJOB_H
virtual QImage renderedImage()=0
Get a preview/resulting image.
The QgsMapSettings class contains configuration for rendering of the map.
Job implementation that renders all layers in parallel.
virtual void waitForFinished()=0
Block until the job has finished.
virtual void start()=0
Start the rendering job and immediately return.
Intermediate base class adding functionality that allows client to query the rendered image...
virtual void cancel()=0
Stop the rendering job - does not return until the job has terminated.
virtual void cancelWithoutBlocking()=0
Triggers cancelation of the rendering job without blocking.
Class that stores computed placement from labeling engine.
virtual QgsLabelingResults * takeLabelingResults()=0
Get 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.