This class is responsible for keeping cache of rendered images resulting from a map rendering job.
More...
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 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).
- Since
- QGIS 2.4
Definition at line 47 of file qgsmaprenderercache.h.
bool QgsMapRendererCache::hasAnyCacheImage |
( |
const QString & |
cacheKey, |
|
|
double |
minimumScaleThreshold = 0 , |
|
|
double |
maximumScaleThreshold = 0 |
|
) |
| const |
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.
- See also
- transformedCacheImage()
- Since
- QGIS 3.18
Definition at line 192 of file qgsmaprenderercache.cpp.
void QgsMapRendererCache::setCacheImageWithParameters |
( |
const QString & |
cacheKey, |
|
|
const QImage & |
image, |
|
|
const QgsRectangle & |
extent, |
|
|
const QgsMapToPixel & |
mapToPixel, |
|
|
const QList< QgsMapLayer * > & |
dependentLayers = QList< QgsMapLayer * >() |
|
) |
| |
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 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.
- See also
- cacheImage()
- Since
- QGIS 3.18
Definition at line 135 of file qgsmaprenderercache.cpp.