1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/maprenderer/qgsmaprendererjob.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsMapRendererJob : QObject /Abstract/
{
%Docstring(signature="appended")
Abstract base class for map rendering implementations.
The API is designed in a way that rendering is done asynchronously,
therefore the caller is not blocked while the rendering is in progress.
Non-blocking operation is quite important because the rendering can take
considerable amount of time.
Common use case:
1. Prepare :py:class:`QgsMapSettings` with rendering configuration (extent, layer, map size, ...)
2. Create :py:class:`QgsMapRendererJob` subclass with :py:class:`QgsMapSettings` instance
3. Connect to job's :py:func:`~finished` signal
4. Call :py:func:`~start`. Map rendering will start in background, the function immediately returns
5. At some point, slot connected to :py:func:`~finished` signal is called, map rendering is done
It is possible to cancel the rendering job while it is active by calling
:py:func:`~cancel` function.
The following subclasses are available:
- :py:class:`QgsMapRendererSequentialJob` - renders map in one
background thread to an image
- :py:class:`QgsMapRendererParallelJob` - renders map in multiple
background threads to an image
- :py:class:`QgsMapRendererCustomPainterJob` - renders map with given
QPainter in one background thread
%End
%TypeHeaderCode
#include "qgsmaprendererjob.h"
%End
public:
QgsMapRendererJob( const QgsMapSettings &settings );
~QgsMapRendererJob();
void start();
%Docstring
Start the rendering job and immediately return. Does nothing if the
rendering is already in progress.
%End
virtual void cancel() = 0;
%Docstring
Stop the rendering job - does not return until the job has terminated.
Does nothing if the rendering is not active.
%End
virtual void cancelWithoutBlocking() = 0;
%Docstring
Triggers cancellation of the rendering job without blocking. The render
job will continue to operate until it is able to cancel, at which stage
the :py:func:`~QgsMapRendererJob.finished` signal will be emitted. Does
nothing if the rendering is not active.
%End
virtual void waitForFinished() = 0;
%Docstring
Block until the job has finished.
%End
virtual bool isActive() const = 0;
%Docstring
Tell whether the rendering job is currently running in background.
%End
virtual bool usedCachedLabels() const = 0;
%Docstring
Returns ``True`` if the render job was able to use a cached labeling
solution. If so, any previously stored labeling results (see
:py:func:`~QgsMapRendererJob.takeLabelingResults`) should be retained.
.. seealso:: :py:func:`takeLabelingResults`
%End
QStringList layersRedrawnFromCache() const;
%Docstring
Returns a list of the layer IDs for all layers which were redrawn from
cached images.
This method should only be called after the render job is completed.
.. versionadded:: 3.22
%End
virtual QgsLabelingResults *takeLabelingResults() = 0 /Transfer/;
%Docstring
Gets pointer to internal labeling engine (in order to get access to the
results). This should not be used if cached labeling was redrawn - see
:py:func:`~QgsMapRendererJob.usedCachedLabels`.
.. seealso:: :py:func:`usedCachedLabels`
%End
QgsRenderedItemResults *takeRenderedItemResults() /Transfer/;
%Docstring
Takes the rendered item results from the map render job and returns
them.
Ownership is transferred to the caller.
.. versionadded:: 3.22
%End
void setFeatureFilterProvider( const QgsFeatureFilterProvider *f );
%Docstring
Set the feature filter provider used by the :py:class:`QgsRenderContext`
of each LayerRenderJob. Ownership is not transferred and the provider
must not be deleted before the render job.
%End
const QgsFeatureFilterProvider *featureFilterProvider() const;
%Docstring
Returns the feature filter provider used by the
:py:class:`QgsRenderContext` of each LayerRenderJob.
%End
struct Error
{
Error( const QString &lid, const QString &msg );
QString layerID;
QString message;
};
typedef QList<QgsMapRendererJob::Error> Errors;
Errors errors() const;
%Docstring
List of errors that happened during the rendering job - available when
the rendering has been finished
%End
void setCache( QgsMapRendererCache *cache );
%Docstring
Assign a cache to be used for reading and storing rendered images of
individual layers. Does not take ownership of the object.
%End
int renderingTime() const;
%Docstring
Returns the total time it took to finish the job (in milliseconds).
.. seealso:: :py:func:`perLayerRenderingTime`
%End
const QgsMapSettings &mapSettings() const;
%Docstring
Returns map settings with which this job was started.
:return: A :py:class:`QgsMapSettings` instance with render settings
%End
signals:
void renderingLayersFinished();
%Docstring
Emitted when the layers are rendered. Rendering labels is not yet done.
If the fully rendered layer including labels is required use
:py:func:`~QgsMapRendererJob.finished` instead.
%End
void layerRenderingStarted( const QString &layerId );
%Docstring
Emitted just before rendering starts for a particular layer.
.. note::
the :py:class:`QgsMapRendererParallelJob` subclass does not emit this signal.
.. versionadded:: 3.24
%End
void layerRendered( const QString &layerId );
%Docstring
Emitted when a layer has completed rendering.
.. note::
the :py:class:`QgsMapRendererParallelJob` subclass does not emit this signal.
.. versionadded:: 3.24
%End
void finished();
%Docstring
emitted when asynchronous rendering is finished (or canceled).
%End
protected:
};
class QgsMapRendererQImageJob : QgsMapRendererJob /Abstract/
{
%Docstring(signature="appended")
Intermediate base class adding functionality that allows client to query
the rendered image.
The image can be queried even while the rendering is still in progress
to get intermediate result
%End
%TypeHeaderCode
#include "qgsmaprendererjob.h"
%End
public:
QgsMapRendererQImageJob( const QgsMapSettings &settings );
virtual QImage renderedImage() = 0;
%Docstring
Gets a preview/resulting image
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/maprenderer/qgsmaprendererjob.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|