QGIS API Documentation  2.99.0-Master (8ec3eaf)
qgsmaprenderercustompainterjob.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaprenderercustompainterjob.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 QGSMAPRENDERERCUSTOMPAINTERJOB_H
17 #define QGSMAPRENDERERCUSTOMPAINTERJOB_H
18 
19 #include "qgsmaprendererjob.h"
20 
21 #include <QEventLoop>
22 
33 {
34  Q_OBJECT
35  public:
36  QgsMapRendererCustomPainterJob( const QgsMapSettings& settings, QPainter* painter );
38 
39  virtual void start() override;
40  virtual void cancel() override;
41  virtual void waitForFinished() override;
42  virtual bool isActive() const override;
43  virtual QgsLabelingResults* takeLabelingResults() override;
44 
46  const LayerRenderJobs& jobs() const { return mLayerJobs; }
47 
60  void waitForFinishedWithEventLoop( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents );
61 
71  void renderSynchronously();
72 
73  protected slots:
74  void futureFinished();
75 
76  protected:
77  static void staticRender( QgsMapRendererCustomPainterJob* self ); // function to be used within the thread
78 
79  // these methods are called within worker thread
80  void doRender();
81 
82  private:
83  QPainter* mPainter;
84  QFuture<void> mFuture;
85  QFutureWatcher<void> mFutureWatcher;
86  QgsRenderContext mLabelingRenderContext;
87  QgsLabelingEngine* mLabelingEngineV2;
88 
89  bool mActive;
90  LayerRenderJobs mLayerJobs;
91  bool mRenderSynchronously;
92 };
93 
94 
95 #endif // QGSMAPRENDERERCUSTOMPAINTERJOB_H
const LayerRenderJobs & jobs() const
Job implementation that renders everything sequentially using a custom painter.
Abstract base class for map rendering implementations.
The QgsMapSettings class contains configuration for rendering of the map.
virtual void waitForFinished()=0
Block until the job has finished.
virtual void start()=0
Start the rendering job and immediately return.
The QgsLabelingEngine class provides map labeling functionality.
Contains information about the context of a rendering operation.
virtual void cancel()=0
Stop the rendering job - does not return until the job has terminated.
Class that stores computed placement from labeling engine.
QList< LayerRenderJob > LayerRenderJobs
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.