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
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/maprenderer/qgsmaprenderercache.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsMapRendererCache : QObject
{
%Docstring(signature="appended")
This class is responsible for keeping cache of rendered images resulting
from a map rendering job.
Once a job has a rendered image stored in the cache (using
setCacheImage(...)), the cache listens to :py:func:`~repaintRequested`
signals from dependent layers. If triggered, the cache removes the
rendered image (and disconnects from the layers).
When user pans/zooms the canvas, the cache is also used in rendering
period for particular layers between the first render update and the
moment the layer actually has partially rendered something in the
resulting image.
The class is thread-safe (multiple classes can access the same instance
safely).
%End
%TypeHeaderCode
#include "qgsmaprenderercache.h"
%End
public:
QgsMapRendererCache();
void clear();
%Docstring
Invalidates the cache contents, clearing all cached images.
.. seealso:: :py:func:`clearCacheImage`
%End
bool init( const QgsRectangle &extent, double scale ) /Deprecated/;
%Docstring
Initialize cache: sets extent and scale parameters and clears the cache
if any parameters have changed since last initialization.
:return: flag whether the parameters are the same as last time
.. deprecated:: 3.18
Will be removed in QGIS 4.0. Use the :py:func:`~QgsMapRendererCache.updateParameters` and :py:func:`~QgsMapRendererCache.clear`.
%End
bool updateParameters( const QgsRectangle &extent, const QgsMapToPixel &mtp );
%Docstring
Sets extent and scale parameters
:return: flag whether the parameters are the same as last time
.. versionadded:: 3.18
%End
void setCacheImage( const QString &cacheKey, const QImage &image, const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );
%Docstring
Set the cached ``image`` for a particular ``cacheKey``, using the
current cache parameters.
The ``cacheKey`` usually matches the :py:func:`QgsMapLayer.id()` which
the image is a render of.
A list of ``dependentLayers`` should be passed containing all layer on
which this cache image is dependent. If any of these layers triggers a
repaint then the cache image will be cleared.
.. seealso:: :py:func:`setCacheImageWithParameters`
.. seealso:: :py:func:`cacheImage`
%End
void setCacheImageWithParameters( const QString &cacheKey,
const QImage &image,
const QgsRectangle &extent,
const QgsMapToPixel &mapToPixel,
const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );
%Docstring
Set the cached ``image`` for a particular ``cacheKey``, using a specific
``extent`` and ``mapToPixel`` (which may differ from the current cache
parameters).
The ``cacheKey`` usually matches the :py:func:`QgsMapLayer.id()` which
the image is a render of.
A list of ``dependentLayers`` should be passed containing all layer on
which this cache image is dependent. If any of these layers triggers a
repaint then the cache image will be cleared.
.. seealso:: :py:func:`cacheImage`
.. versionadded:: 3.18
%End
bool hasCacheImage( const QString &cacheKey ) const;
%Docstring
Returns ``True`` if the cache contains an image with the specified
``cacheKey`` that has the same extent and scale as the cache's global
extent and scale
.. seealso:: :py:func:`cacheImage`
%End
bool hasAnyCacheImage( const QString &cacheKey, double minimumScaleThreshold = 0, double maximumScaleThreshold = 0 ) const;
%Docstring
Returns ``True`` if the cache contains an image with the specified
``cacheKey`` with any cache's parameters (extent and scale)
The optional ``minimumScaleThreshold`` and ``maximumScaleThreshold``
arguments can be used to specify a range of acceptable cached scales vs
current cache scale parameter. E.g. if the ``minimumScaleThreshold`` is
0.5 and ``maximumScaleThreshold`` is 2.0, then only cached images with a
scale between 0.5 * current cache scale and 2.0 * current cache scale
will be considered.
.. seealso:: :py:func:`transformedCacheImage`
.. versionadded:: 3.18
%End
QImage cacheImage( const QString &cacheKey ) const;
%Docstring
Returns the cached image for the specified ``cacheKey``. The
``cacheKey`` usually matches the :py:func:`QgsMapLayer.id()` which the
image is a render of. Returns a null image if it is not cached.
.. seealso:: :py:func:`setCacheImage`
.. seealso:: :py:func:`hasCacheImage`
%End
QImage transformedCacheImage( const QString &cacheKey, const QgsMapToPixel &mtp ) const;
%Docstring
Returns the cached image for the specified ``cacheKey`` transformed to
the particular extent and scale.
The ``cacheKey`` usually matches the :py:func:`QgsMapLayer.id()` which
the image is a render of. Returns a null image if it is not cached.
.. seealso:: :py:func:`hasAnyCacheImage`
.. versionadded:: 3.18
%End
QList< QgsMapLayer * > dependentLayers( const QString &cacheKey ) const;
%Docstring
Returns a list of map layers on which an image in the cache depends.
%End
void clearCacheImage( const QString &cacheKey );
%Docstring
Removes an image from the cache with matching ``cacheKey``.
.. seealso:: :py:func:`clear`
%End
void invalidateCacheForLayer( QgsMapLayer *layer );
%Docstring
Invalidates cached images which relate to the specified map ``layer``.
.. versionadded:: 3.14
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/maprenderer/qgsmaprenderercache.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|