QGIS API Documentation  2.99.0-Master (c42dad3)
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
QgsMapRendererCache Class Reference

This class is responsible for keeping cache of rendered images of individual layers. More...

#include <qgsmaprenderercache.h>

Inheritance diagram for QgsMapRendererCache:
Inheritance graph
[legend]

Public Member Functions

 QgsMapRendererCache ()
 
QImage cacheImage (const QString &layerId)
 get cached image for the specified layer ID. Returns null image if it is not cached. More...
 
void clear ()
 invalidate the cache contents More...
 
void clearCacheImage (const QString &layerId)
 remove layer from the cache More...
 
bool init (const QgsRectangle &extent, double scale)
 initialize cache: set new parameters and erase cache if parameters have changed More...
 
void setCacheImage (const QString &layerId, const QImage &img)
 set cached image for the specified layer ID More...
 

Protected Slots

void layerRequestedRepaint ()
 remove layer (that emitted the signal) from the cache More...
 

Protected Member Functions

void clearInternal ()
 invalidate cache contents (without locking) More...
 

Protected Attributes

QMap< QString, QImage > mCachedImages
 
QgsRectangle mExtent
 
QMutex mMutex
 
double mScale
 

Detailed Description

This class is responsible for keeping cache of rendered images of individual layers.

Once a layer has rendered image stored in the cache (using setCacheImage(...)), the cache listens to repaintRequested() signals from layer. If triggered, the cache removes the rendered image (and disconnects from the layer).

The class is thread-safe (multiple classes can access the same instance safely).

Note
added in 2.4

Definition at line 37 of file qgsmaprenderercache.h.

Constructor & Destructor Documentation

§ QgsMapRendererCache()

QgsMapRendererCache::QgsMapRendererCache ( )

Definition at line 21 of file qgsmaprenderercache.cpp.

Member Function Documentation

§ cacheImage()

QImage QgsMapRendererCache::cacheImage ( const QString &  layerId)

get cached image for the specified layer ID. Returns null image if it is not cached.

Definition at line 81 of file qgsmaprenderercache.cpp.

§ clear()

void QgsMapRendererCache::clear ( )

invalidate the cache contents

Definition at line 26 of file qgsmaprenderercache.cpp.

§ clearCacheImage()

void QgsMapRendererCache::clearCacheImage ( const QString &  layerId)

remove layer from the cache

Definition at line 94 of file qgsmaprenderercache.cpp.

§ clearInternal()

void QgsMapRendererCache::clearInternal ( )
protected

invalidate cache contents (without locking)

Definition at line 32 of file qgsmaprenderercache.cpp.

§ init()

bool QgsMapRendererCache::init ( const QgsRectangle extent,
double  scale 
)

initialize cache: set new parameters and erase cache if parameters have changed

Returns
flag whether the parameters are the same as last time

Definition at line 50 of file qgsmaprenderercache.cpp.

§ layerRequestedRepaint

void QgsMapRendererCache::layerRequestedRepaint ( )
protectedslot

remove layer (that emitted the signal) from the cache

Definition at line 87 of file qgsmaprenderercache.cpp.

§ setCacheImage()

void QgsMapRendererCache::setCacheImage ( const QString &  layerId,
const QImage &  img 
)

set cached image for the specified layer ID

Definition at line 68 of file qgsmaprenderercache.cpp.

Member Data Documentation

§ mCachedImages

QMap<QString, QImage> QgsMapRendererCache::mCachedImages
protected

Definition at line 72 of file qgsmaprenderercache.h.

§ mExtent

QgsRectangle QgsMapRendererCache::mExtent
protected

Definition at line 70 of file qgsmaprenderercache.h.

§ mMutex

QMutex QgsMapRendererCache::mMutex
protected

Definition at line 69 of file qgsmaprenderercache.h.

§ mScale

double QgsMapRendererCache::mScale
protected

Definition at line 71 of file qgsmaprenderercache.h.


The documentation for this class was generated from the following files: