QGIS API Documentation
2.4.0-Chugiak
|
This class is responsible for keeping cache of rendered images of individual layers. More...
#include <qgsmaprenderercache.h>
Public Member Functions | |
QgsMapRendererCache () | |
void | clear () |
invalidate the cache contents More... | |
bool | init (QgsRectangle extent, double scale) |
initialize cache: set new parameters and erase cache if parameters have changed More... | |
void | setCacheImage (QString layerId, const QImage &img) |
set cached image for the specified layer ID More... | |
QImage | cacheImage (QString layerId) |
get cached image for the specified layer ID. Returns null image if it is not cached. More... | |
void | clearCacheImage (QString layerId) |
remove layer from the cache 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 | |
QMutex | mMutex |
QgsRectangle | mExtent |
double | mScale |
QMap< QString, QImage > | mCachedImages |
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).
Definition at line 37 of file qgsmaprenderercache.h.
QgsMapRendererCache::QgsMapRendererCache | ( | ) |
Definition at line 21 of file qgsmaprenderercache.cpp.
References clear().
QImage QgsMapRendererCache::cacheImage | ( | QString | layerId | ) |
get cached image for the specified layer ID. Returns null image if it is not cached.
Definition at line 80 of file qgsmaprenderercache.cpp.
References mCachedImages, and mMutex.
Referenced by QgsMapRendererJob::prepareJobs().
void QgsMapRendererCache::clear | ( | ) |
invalidate the cache contents
Definition at line 26 of file qgsmaprenderercache.cpp.
References clearInternal(), and mMutex.
Referenced by QgsMapCanvas::clearCache(), and QgsMapRendererCache().
void QgsMapRendererCache::clearCacheImage | ( | QString | layerId | ) |
remove layer from the cache
Definition at line 93 of file qgsmaprenderercache.cpp.
References QgsMapLayerRegistry::instance(), layerRequestedRepaint(), QgsMapLayerRegistry::mapLayer(), mCachedImages, and mMutex.
Referenced by layerRequestedRepaint(), and QgsMapRendererJob::prepareJobs().
|
protected |
invalidate cache contents (without locking)
Definition at line 32 of file qgsmaprenderercache.cpp.
References QgsMapLayerRegistry::instance(), layerRequestedRepaint(), QgsMapLayerRegistry::mapLayer(), mCachedImages, mExtent, mScale, and QgsRectangle::setMinimal().
bool QgsMapRendererCache::init | ( | QgsRectangle | extent, |
double | scale | ||
) |
initialize cache: set new parameters and erase cache if parameters have changed
Definition at line 49 of file qgsmaprenderercache.cpp.
References clearInternal(), mExtent, mMutex, and mScale.
Referenced by QgsMapRendererJob::prepareJobs().
|
protectedslot |
remove layer (that emitted the signal) from the cache
Definition at line 86 of file qgsmaprenderercache.cpp.
References clearCacheImage(), and QgsMapLayer::id().
Referenced by clearCacheImage(), clearInternal(), and setCacheImage().
void QgsMapRendererCache::setCacheImage | ( | QString | layerId, |
const QImage & | img | ||
) |
set cached image for the specified layer ID
Definition at line 67 of file qgsmaprenderercache.cpp.
References QgsMapLayerRegistry::instance(), layerRequestedRepaint(), QgsMapLayerRegistry::mapLayer(), mCachedImages, and mMutex.
Referenced by QgsMapRendererJob::cleanupJobs().
|
protected |
Definition at line 72 of file qgsmaprenderercache.h.
Referenced by cacheImage(), clearCacheImage(), clearInternal(), and setCacheImage().
|
protected |
Definition at line 70 of file qgsmaprenderercache.h.
Referenced by clearInternal(), and init().
|
protected |
Definition at line 69 of file qgsmaprenderercache.h.
Referenced by cacheImage(), clear(), clearCacheImage(), init(), and setCacheImage().
|
protected |
Definition at line 71 of file qgsmaprenderercache.h.
Referenced by clearInternal(), and init().