Skip to content

Commit

Permalink
Fix doxygen warning by renaming function
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 28, 2021
1 parent 6606471 commit 6ab0e4d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 25 deletions.
16 changes: 8 additions & 8 deletions python/core/auto_generated/qgsmaprenderercache.sip.in
Expand Up @@ -64,9 +64,7 @@ Sets extent and scale parameters
.. versionadded:: 3.18
%End

void setCacheImage( const QString &cacheKey,
const QImage &image,
const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );
void setCacheImage( const QString &cacheKey, const QImage &image, const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );
%Docstring
Set the cached ``image`` for a particular ``cacheKey``, using the current cache parameters.

Expand All @@ -76,14 +74,16 @@ 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.

.. seealso:: :py:func:`setCacheImageWithParameters`

.. seealso:: :py:func:`cacheImage`
%End

void setCacheImage( const QString &cacheKey,
const QImage &image,
const QgsRectangle &extent,
const QgsMapToPixel &mapToPixel,
const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );
void setCacheImageWithParameters( const QString &cacheKey,
const QImage &image,
const QgsRectangle &extent,
const QgsMapToPixel &mapToPixel,
const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );
%Docstring
Set the cached ``image`` for a particular ``cacheKey``, using a specific ``extent`` and ``mapToPixel``
(which may differ from the current cache parameters).
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaprenderercache.cpp
Expand Up @@ -129,10 +129,10 @@ void QgsMapRendererCache::setCacheImage( const QString &cacheKey, const QImage &
QgsMapToPixel mapToPixel = mMtp;

lock.unlock();
setCacheImage( cacheKey, image, extent, mapToPixel, dependentLayers );
setCacheImageWithParameters( cacheKey, image, extent, mapToPixel, dependentLayers );
}

void QgsMapRendererCache::setCacheImage( const QString &cacheKey, const QImage &image, const QgsRectangle &extent, const QgsMapToPixel &mapToPixel, const QList<QgsMapLayer *> &dependentLayers )
void QgsMapRendererCache::setCacheImageWithParameters( const QString &cacheKey, const QImage &image, const QgsRectangle &extent, const QgsMapToPixel &mapToPixel, const QList<QgsMapLayer *> &dependentLayers )
{
QMutexLocker lock( &mMutex );

Expand Down
15 changes: 7 additions & 8 deletions src/core/qgsmaprenderercache.h
Expand Up @@ -83,11 +83,10 @@ class CORE_EXPORT QgsMapRendererCache : public QObject
* on which this cache image is dependent. If any of these layers triggers a
* repaint then the cache image will be cleared.
*
* \see setCacheImageWithParameters()
* \see cacheImage()
*/
void setCacheImage( const QString &cacheKey,
const QImage &image,
const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );
void setCacheImage( const QString &cacheKey, const QImage &image, const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );

/**
* Set the cached \a image for a particular \a cacheKey, using a specific \a extent and \a mapToPixel
Expand All @@ -102,11 +101,11 @@ class CORE_EXPORT QgsMapRendererCache : public QObject
* \see cacheImage()
* \since QGIS 3.18
*/
void setCacheImage( const QString &cacheKey,
const QImage &image,
const QgsRectangle &extent,
const QgsMapToPixel &mapToPixel,
const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );
void setCacheImageWithParameters( const QString &cacheKey,
const QImage &image,
const QgsRectangle &extent,
const QgsMapToPixel &mapToPixel,
const QList< QgsMapLayer * > &dependentLayers = QList< QgsMapLayer * >() );

/**
* Returns TRUE if the cache contains an image with the specified \a cacheKey
Expand Down
8 changes: 4 additions & 4 deletions src/core/qgsmaprendererjob.cpp
Expand Up @@ -685,8 +685,8 @@ void QgsMapRendererJob::cleanupJobs( LayerRenderJobs &jobs )
if ( mCache && !job.cached && job.completed && job.layer )
{
QgsDebugMsgLevel( QStringLiteral( "caching image for %1" ).arg( job.layerId ), 2 );
mCache->setCacheImage( job.layerId, *job.img, mSettings.visibleExtent(), mSettings.mapToPixel(), QList< QgsMapLayer * >() << job.layer );
mCache->setCacheImage( job.layerId + QStringLiteral( "_preview" ), *job.img, mSettings.visibleExtent(), mSettings.mapToPixel(), QList< QgsMapLayer * >() << job.layer );
mCache->setCacheImageWithParameters( job.layerId, *job.img, mSettings.visibleExtent(), mSettings.mapToPixel(), QList< QgsMapLayer * >() << job.layer );
mCache->setCacheImageWithParameters( job.layerId + QStringLiteral( "_preview" ), *job.img, mSettings.visibleExtent(), mSettings.mapToPixel(), QList< QgsMapLayer * >() << job.layer );
}

delete job.img;
Expand Down Expand Up @@ -751,8 +751,8 @@ void QgsMapRendererJob::cleanupLabelJob( LabelRenderJob &job )
if ( mCache && !job.cached && !job.context.renderingStopped() )
{
QgsDebugMsgLevel( QStringLiteral( "caching label result image" ), 2 );
mCache->setCacheImage( LABEL_CACHE_ID, *job.img, mSettings.visibleExtent(), mSettings.mapToPixel(), _qgis_listQPointerToRaw( job.participatingLayers ) );
mCache->setCacheImage( LABEL_PREVIEW_CACHE_ID, *job.img, mSettings.visibleExtent(), mSettings.mapToPixel(), _qgis_listQPointerToRaw( job.participatingLayers ) );
mCache->setCacheImageWithParameters( LABEL_CACHE_ID, *job.img, mSettings.visibleExtent(), mSettings.mapToPixel(), _qgis_listQPointerToRaw( job.participatingLayers ) );
mCache->setCacheImageWithParameters( LABEL_PREVIEW_CACHE_ID, *job.img, mSettings.visibleExtent(), mSettings.mapToPixel(), _qgis_listQPointerToRaw( job.participatingLayers ) );
}

delete job.img;
Expand Down
6 changes: 3 additions & 3 deletions tests/src/python/test_qgsmaprenderercache.py
Expand Up @@ -301,13 +301,13 @@ def testSetCacheImageDifferentParams(self):
# if existing cached image exists with matching parameters, we don't store a new image -- old
# one should still be retained
im = QImage(201, 201, QImage.Format_RGB32)
cache.setCacheImage('im1', im, QgsRectangle(1, 1, 3, 4), QgsMapToPixel(5), [])
cache.setCacheImageWithParameters('im1', im, QgsRectangle(1, 1, 3, 4), QgsMapToPixel(5), [])
self.assertEqual(cache.cacheImage('im1').width(), 200)
cache.setCacheImage('im1', im, QgsRectangle(1, 1, 3, 3), QgsMapToPixel(6), [])
cache.setCacheImageWithParameters('im1', im, QgsRectangle(1, 1, 3, 3), QgsMapToPixel(6), [])
self.assertEqual(cache.cacheImage('im1').width(), 200)

# replace with matching parameters
cache.setCacheImage('im1', im, QgsRectangle(1, 1, 3, 3), QgsMapToPixel(5), [])
cache.setCacheImageWithParameters('im1', im, QgsRectangle(1, 1, 3, 3), QgsMapToPixel(5), [])
self.assertEqual(cache.cacheImage('im1').width(), 201)
im = QImage(202, 202, QImage.Format_RGB32)
cache.setCacheImage('im1', im, [])
Expand Down

0 comments on commit 6ab0e4d

Please sign in to comment.