Skip to content

Commit 2fedba0

Browse files
committed
Doxymentation for QgsMapRendererJob + subclasses
1 parent 68cc9f4 commit 2fedba0

8 files changed

+97
-10
lines changed

python/core/qgsmaprenderercustompainterjob.sip

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

2-
/** job implementation that renders everything sequentially using a custom painter.
3-
* The returned image is always invalid (because there is none available).
2+
/** Job implementation that renders everything sequentially using a custom painter.
3+
*
4+
* Also supports synchronous rendering in main thread for cases when rendering in background
5+
* is not an option because of some technical limitations (e.g. printing to printer on some
6+
* platforms).
7+
*
8+
* @note added in 2.4
49
*/
510
class QgsMapRendererCustomPainterJob : QgsMapRendererJob
611
{

python/core/qgsmaprendererjob.sip

+26-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,30 @@ struct LayerRenderJob
1111

1212
typedef QList<LayerRenderJob> LayerRenderJobs;
1313

14-
/** abstract base class renderer jobs that asynchronously start map rendering */
14+
/**
15+
* Abstract base class for map rendering implementations.
16+
*
17+
* The API is designed in a way that rendering is done asynchronously, therefore
18+
* the caller is not blocked while the rendering is in progress. Non-blocking
19+
* operation is quite important because the rendering can take considerable
20+
* amount of time.
21+
*
22+
* Common use case:
23+
* 0. prepare QgsMapSettings with rendering configuration (extent, layer, map size, ...)
24+
* 1. create QgsMapRendererJob subclass with QgsMapSettings instance
25+
* 2. connect to job's finished() signal
26+
* 3. call start(). Map rendering will start in background, the function immediately returns
27+
* 4. at some point, slot connected to finished() signal is called, map rendering is done
28+
*
29+
* It is possible to cancel the rendering job while it is active by calling cancel() function.
30+
*
31+
* The following subclasses are available:
32+
* - QgsMapRendererSequentialJob - renders map in one background thread to an image
33+
* - QgsMapRendererParallelJob - renders map in multiple background threads to an image
34+
* - QgsMapRendererCustomPainterJob - renders map with given QPainter in one background thread
35+
*
36+
* @note added in 2.4
37+
*/
1538
class QgsMapRendererJob : QObject
1639
{
1740
%TypeHeaderCode
@@ -102,6 +125,8 @@ class QgsMapRendererJob : QObject
102125

103126
/** Intermediate base class adding functionality that allows client to query the rendered image.
104127
* The image can be queried even while the rendering is still in progress to get intermediate result
128+
*
129+
* @note added in 2.4
105130
*/
106131
class QgsMapRendererQImageJob : QgsMapRendererJob
107132
{

python/core/qgsmaprendererparalleljob.sip

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11

2-
/** job implementation that renders all layers in parallel */
2+
/** Job implementation that renders all layers in parallel.
3+
*
4+
* The resulting map image can be retrieved with renderedImage() function.
5+
* It is safe to call that function while rendering is active to see preview of the map.
6+
*
7+
* @note added in 2.4
8+
*/
39
class QgsMapRendererParallelJob : QgsMapRendererQImageJob
410
{
511
%TypeHeaderCode

python/core/qgsmaprenderersequentialjob.sip

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11

22

3-
/** job implementation that renders everything sequentially in one thread */
3+
/** Job implementation that renders everything sequentially in one thread.
4+
*
5+
* The resulting map image can be retrieved with renderedImage() function.
6+
* It is safe to call that function while rendering is active to see preview of the map.
7+
*
8+
* @note added in 2.4
9+
*/
410
class QgsMapRendererSequentialJob : QgsMapRendererQImageJob
511
{
612
%TypeHeaderCode

src/core/qgsmaprenderercustompainterjob.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@
2020

2121
#include <QEventLoop>
2222

23-
/** job implementation that renders everything sequentially using a custom painter.
24-
* The returned image is always invalid (because there is none available).
23+
/** Job implementation that renders everything sequentially using a custom painter.
24+
*
25+
* Also supports synchronous rendering in main thread for cases when rendering in background
26+
* is not an option because of some technical limitations (e.g. printing to printer on some
27+
* platforms).
28+
*
29+
* @note added in 2.4
2530
*/
2631
class CORE_EXPORT QgsMapRendererCustomPainterJob : public QgsMapRendererJob
2732
{

src/core/qgsmaprendererjob.h

+29-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ class QgsMapRendererCache;
3535
class QgsPalLabeling;
3636

3737

38+
/** Structure keeping low-level rendering job information.
39+
* @note not part of public API!
40+
*/
3841
struct LayerRenderJob
3942
{
4043
QgsRenderContext context;
@@ -48,7 +51,30 @@ struct LayerRenderJob
4851
typedef QList<LayerRenderJob> LayerRenderJobs;
4952

5053

51-
/** abstract base class renderer jobs that asynchronously start map rendering */
54+
/**
55+
* Abstract base class for map rendering implementations.
56+
*
57+
* The API is designed in a way that rendering is done asynchronously, therefore
58+
* the caller is not blocked while the rendering is in progress. Non-blocking
59+
* operation is quite important because the rendering can take considerable
60+
* amount of time.
61+
*
62+
* Common use case:
63+
* 0. prepare QgsMapSettings with rendering configuration (extent, layer, map size, ...)
64+
* 1. create QgsMapRendererJob subclass with QgsMapSettings instance
65+
* 2. connect to job's finished() signal
66+
* 3. call start(). Map rendering will start in background, the function immediately returns
67+
* 4. at some point, slot connected to finished() signal is called, map rendering is done
68+
*
69+
* It is possible to cancel the rendering job while it is active by calling cancel() function.
70+
*
71+
* The following subclasses are available:
72+
* - QgsMapRendererSequentialJob - renders map in one background thread to an image
73+
* - QgsMapRendererParallelJob - renders map in multiple background threads to an image
74+
* - QgsMapRendererCustomPainterJob - renders map with given QPainter in one background thread
75+
*
76+
* @note added in 2.4
77+
*/
5278
class CORE_EXPORT QgsMapRendererJob : public QObject
5379
{
5480
Q_OBJECT
@@ -149,6 +175,8 @@ class CORE_EXPORT QgsMapRendererJob : public QObject
149175

150176
/** Intermediate base class adding functionality that allows client to query the rendered image.
151177
* The image can be queried even while the rendering is still in progress to get intermediate result
178+
*
179+
* @note added in 2.4
152180
*/
153181
class CORE_EXPORT QgsMapRendererQImageJob : public QgsMapRendererJob
154182
{

src/core/qgsmaprendererparalleljob.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818

1919
#include "qgsmaprendererjob.h"
2020

21-
/** job implementation that renders all layers in parallel */
21+
/** Job implementation that renders all layers in parallel.
22+
*
23+
* The resulting map image can be retrieved with renderedImage() function.
24+
* It is safe to call that function while rendering is active to see preview of the map.
25+
*
26+
* @note added in 2.4
27+
*/
2228
class CORE_EXPORT QgsMapRendererParallelJob : public QgsMapRendererQImageJob
2329
{
2430
Q_OBJECT

src/core/qgsmaprenderersequentialjob.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020

2121
class QgsMapRendererCustomPainterJob;
2222

23-
/** job implementation that renders everything sequentially in one thread */
23+
/** Job implementation that renders everything sequentially in one thread.
24+
*
25+
* The resulting map image can be retrieved with renderedImage() function.
26+
* It is safe to call that function while rendering is active to see preview of the map.
27+
*
28+
* @note added in 2.4
29+
*/
2430
class CORE_EXPORT QgsMapRendererSequentialJob : public QgsMapRendererQImageJob
2531
{
2632
Q_OBJECT

0 commit comments

Comments
 (0)