Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make QgsMapRendererCache protected members private
This class isn't designed to be subclassed
  • Loading branch information
nyalldawson committed Feb 1, 2017
1 parent 54d8d11 commit d74fbff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 35 deletions.
5 changes: 5 additions & 0 deletions doc/api_break.dox
Expand Up @@ -1335,6 +1335,11 @@ be returned instead of a null pointer if no transformation is required.
- destinationSrsChanged() was renamed to destinationCrsChanged()
- getCompositionMode(), getBlendModeEnum() and BlendMode enum have been moved to QgsPainting utility class.

QgsMapRendererCache {#qgis_api_break_3_0_QgsMapRendererCache}
-------------------

- All protected members have been made private. This class is not designed to be subclassed.


QgsMapRendererJob {#qgis_api_break_3_0_QgsMapRendererJob}
-----------------
Expand Down
25 changes: 0 additions & 25 deletions python/core/qgsmaprenderercache.sip
@@ -1,15 +1,3 @@

/**
* 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
*/
class QgsMapRendererCache : QObject
{
%TypeHeaderCode
Expand All @@ -20,27 +8,14 @@ class QgsMapRendererCache : QObject

QgsMapRendererCache();

//! invalidate the cache contents
void clear();

//! initialize cache: set new parameters and erase cache if parameters have changed
//! @return flag whether the parameters are the same as last time
bool init( const QgsRectangle& extent, double scale );

//! set cached image for the specified layer ID
void setCacheImage( const QString& layerId, const QImage& img );

//! get cached image for the specified layer ID. Returns null image if it is not cached.
QImage cacheImage( const QString& layerId );

//! remove layer from the cache
void clearCacheImage( const QString& layerId );

protected slots:
//! remove layer (that emitted the signal) from the cache
void layerRequestedRepaint();

protected:
//! invalidate cache contents (without locking)
void clearInternal();
};
19 changes: 9 additions & 10 deletions src/core/qgsmaprenderercache.h
Expand Up @@ -42,31 +42,30 @@ class CORE_EXPORT QgsMapRendererCache : public QObject

QgsMapRendererCache();

//! invalidate the cache contents
//! Invalidate the cache contents
void clear();

//! initialize cache: set new parameters and erase cache if parameters have changed
//! Initialize cache: set new parameters and erase cache if parameters have changed
//! @return flag whether the parameters are the same as last time
bool init( const QgsRectangle& extent, double scale );

//! set cached image for the specified layer ID
//! Set the cached image for the specified layer ID
void setCacheImage( const QString& layerId, const QImage& img );

//! get cached image for the specified layer ID. Returns null image if it is not cached.
//! Returns the cached image for the specified layer ID. Returns null image if it is not cached.
QImage cacheImage( const QString& layerId );

//! remove layer from the cache
//! Removes a layer from the cache
void clearCacheImage( const QString& layerId );

protected slots:
//! remove layer (that emitted the signal) from the cache
private slots:
//! Remove layer (that emitted the signal) from the cache
void layerRequestedRepaint();

protected:
//! invalidate cache contents (without locking)
private:
//! Invalidate cache contents (without locking)
void clearInternal();

protected:
QMutex mMutex;
QgsRectangle mExtent;
double mScale;
Expand Down

0 comments on commit d74fbff

Please sign in to comment.