16#ifndef QGSMAPRENDERERCACHE_H
17#define QGSMAPRENDERERCACHE_H
88 void setCacheImage(
const QString &cacheKey,
const QImage &image,
const QList< QgsMapLayer * > &
dependentLayers = QList< QgsMapLayer * >() );
107 const QList< QgsMapLayer * > &
dependentLayers = QList< QgsMapLayer * >() );
130 bool hasAnyCacheImage(
const QString &cacheKey,
double minimumScaleThreshold = 0,
double maximumScaleThreshold = 0 )
const;
139 QImage
cacheImage(
const QString &cacheKey )
const;
158 QList< QgsMapLayer * >
dependentLayers(
const QString &cacheKey )
const;
175 void layerRequestedRepaint();
179 struct CacheParameters
188 void clearInternal();
191 void dropUnusedConnections();
195 mutable QMutex mMutex;
199 double mScale = -1.0;
202 QMap<QString, CacheParameters> mCachedImages;
204 QSet< QgsWeakMapLayerPointer > mConnectedLayers;
Base class for all map layer types.
bool updateParameters(const QgsRectangle &extent, const QgsMapToPixel &mtp)
Sets extent and scale parameters.
QList< QgsMapLayer * > dependentLayers(const QString &cacheKey) const
Returns a list of map layers on which an image in the cache depends.
void clear()
Invalidates the cache contents, clearing all cached images.
bool hasCacheImage(const QString &cacheKey) const
Returns true if the cache contains an image with the specified cacheKey that has the same extent and ...
QImage cacheImage(const QString &cacheKey) const
Returns the cached image for the specified cacheKey.
bool 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 (...
void 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 dif...
void setCacheImage(const QString &cacheKey, const QImage &image, const QList< QgsMapLayer * > &dependentLayers=QList< QgsMapLayer * >())
Set the cached image for a particular cacheKey, using the current cache parameters.
void invalidateCacheForLayer(QgsMapLayer *layer)
Invalidates cached images which relate to the specified map layer.
void clearCacheImage(const QString &cacheKey)
Removes an image from the cache with matching cacheKey.
QImage transformedCacheImage(const QString &cacheKey, const QgsMapToPixel &mtp) const
Returns the cached image for the specified cacheKey transformed to the particular extent and scale.
Q_DECL_DEPRECATED bool init(const QgsRectangle &extent, double scale)
Initialize cache: sets extent and scale parameters and clears the cache if any parameters have change...
Perform transforms between map coordinates and device coordinates.
A rectangle specified with double values.
QList< QgsWeakMapLayerPointer > QgsWeakMapLayerPointerList
A list of weak pointers to QgsMapLayers.