QGIS API Documentation  2.99.0-Master (0a63d1f)
qgsmaprenderercache.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmaprenderercache.h
3  --------------------------------------
4  Date : December 2013
5  Copyright : (C) 2013 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSMAPRENDERERCACHE_H
17 #define QGSMAPRENDERERCACHE_H
18 
19 #include "qgis_core.h"
20 #include <QMap>
21 #include <QImage>
22 #include <QMutex>
23 
24 #include "qgsrectangle.h"
25 
26 
38 class CORE_EXPORT QgsMapRendererCache : public QObject
39 {
40  Q_OBJECT
41  public:
42 
44 
46  void clear();
47 
50  bool init( const QgsRectangle& extent, double scale );
51 
53  void setCacheImage( const QString& layerId, const QImage& img );
54 
56  QImage cacheImage( const QString& layerId );
57 
59  void clearCacheImage( const QString& layerId );
60 
61  protected slots:
63  void layerRequestedRepaint();
64 
65  protected:
67  void clearInternal();
68 
69  protected:
70  QMutex mMutex;
72  double mScale;
73  QMap<QString, QImage> mCachedImages;
74 };
75 
76 
77 #endif // QGSMAPRENDERERCACHE_H
A rectangle specified with double values.
Definition: qgsrectangle.h:36
QMap< QString, QImage > mCachedImages
This class is responsible for keeping cache of rendered images of individual layers.