QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
maprenderer
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 "qgis_core.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsmaprendererjob.h
"
22
23
#include <QEventLoop>
24
31
class
CORE_EXPORT
QgsMapRendererAbstractCustomPainterJob
:
public
QgsMapRendererJob
SIP_ABSTRACT
32
{
33
Q_OBJECT
34
public
:
39
QgsMapRendererAbstractCustomPainterJob
(
const
QgsMapSettings
&settings );
40
41
protected
:
47
void
preparePainter
( QPainter *painter,
const
QColor &backgroundColor = Qt::transparent );
48
};
49
59
class
CORE_EXPORT
QgsMapRendererCustomPainterJob
:
public
QgsMapRendererAbstractCustomPainterJob
60
{
61
Q_OBJECT
62
public
:
63
QgsMapRendererCustomPainterJob
(
const
QgsMapSettings
&settings, QPainter *painter );
64
~QgsMapRendererCustomPainterJob
()
override
;
65
66
void
cancel
()
override
;
67
void
cancelWithoutBlocking
()
override
;
68
void
waitForFinished
()
override
;
69
bool
isActive
()
const override
;
70
bool
usedCachedLabels
()
const override
;
71
QgsLabelingResults
*
takeLabelingResults
()
SIP_TRANSFER
override
;
72
74
const
std::vector< LayerRenderJob > &
jobs
() const
SIP_SKIP
{
return
mLayerJobs; }
75
88
void
waitForFinishedWithEventLoop( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents );
89
99
void
renderSynchronously();
100
112
void
prepare();
113
124
void
renderPrepared();
125
126
127
private
slots:
128
void
futureFinished();
129
130
private
:
131
static
void
staticRender(
QgsMapRendererCustomPainterJob
*self );
// function to be used within the thread
132
133
void
startPrivate()
override
;
134
135
// these methods are called within worker thread
136
void
doRender();
137
138
QPainter *mPainter =
nullptr
;
139
QFuture<void> mFuture;
140
QFutureWatcher<void> mFutureWatcher;
141
std::unique_ptr< QgsLabelingEngine > mLabelingEngineV2;
142
143
bool
mActive =
false
;
144
std::vector< LayerRenderJob > mLayerJobs;
145
LabelRenderJob mLabelJob;
146
bool
mRenderSynchronously =
false
;
147
bool
mPrepared =
false
;
148
bool
mPrepareOnly =
false
;
149
150
std::vector< LayerRenderJob > mSecondPassLayerJobs;
151
};
152
153
154
#endif
// QGSMAPRENDERERCUSTOMPAINTERJOB_H
QgsLabelingResults
Stores computed placement from labeling engine.
Definition
qgslabelingresults.h:44
QgsMapRendererAbstractCustomPainterJob::preparePainter
void preparePainter(QPainter *painter, const QColor &backgroundColor=Qt::transparent)
Prepares the given painter ready for a map render.
Definition
qgsmaprenderercustompainterjob.cpp:43
QgsMapRendererAbstractCustomPainterJob::QgsMapRendererAbstractCustomPainterJob
QgsMapRendererAbstractCustomPainterJob(const QgsMapSettings &settings)
Constructor for QgsMapRendererAbstractCustomPainterJob, using the given map settings.
Definition
qgsmaprenderercustompainterjob.cpp:39
QgsMapRendererCustomPainterJob
Job implementation that renders everything sequentially using a custom painter.
Definition
qgsmaprenderercustompainterjob.h:60
QgsMapRendererCustomPainterJob::QgsMapRendererCustomPainterJob
QgsMapRendererCustomPainterJob(const QgsMapSettings &settings, QPainter *painter)
Definition
qgsmaprenderercustompainterjob.cpp:64
QgsMapRendererCustomPainterJob::jobs
const std::vector< LayerRenderJob > & jobs() const
Definition
qgsmaprenderercustompainterjob.h:74
QgsMapRendererJob::waitForFinished
virtual void waitForFinished()=0
Block until the job has finished.
QgsMapRendererJob::usedCachedLabels
virtual bool usedCachedLabels() const =0
Returns true if the render job was able to use a cached labeling solution.
QgsMapRendererJob::QgsMapRendererJob
QgsMapRendererJob(const QgsMapSettings &settings)
QgsMapRendererJob::isActive
virtual bool isActive() const =0
Tell whether the rendering job is currently running in background.
QgsMapRendererJob::takeLabelingResults
virtual QgsLabelingResults * takeLabelingResults()=0
Gets pointer to internal labeling engine (in order to get access to the results).
QgsMapRendererJob::cancel
virtual void cancel()=0
Stop the rendering job - does not return until the job has terminated.
QgsMapRendererJob::cancelWithoutBlocking
virtual void cancelWithoutBlocking()=0
Triggers cancellation of the rendering job without blocking.
QgsMapSettings
Contains configuration for rendering maps.
Definition
qgsmapsettings.h:91
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
SIP_ABSTRACT
#define SIP_ABSTRACT
Definition
qgis_sip.h:225
qgsmaprendererjob.h
Generated on
for QGIS API Documentation by
1.17.0