QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 <QMap>
20 #include <QImage>
21 #include <QMutex>
22 
23 #include "qgsrectangle.h"
24 
25 
37 class CORE_EXPORT QgsMapRendererCache : public QObject
38 {
39  Q_OBJECT
40  public:
41 
43 
45  void clear();
46 
49  bool init( const QgsRectangle& extent, double scale );
50 
52  void setCacheImage( const QString& layerId, const QImage& img );
53 
55  QImage cacheImage( const QString& layerId );
56 
58  void clearCacheImage( const QString& layerId );
59 
60  protected slots:
62  void layerRequestedRepaint();
63 
64  protected:
66  void clearInternal();
67 
68  protected:
71  double mScale;
73 };
74 
75 
76 #endif // QGSMAPRENDERERCACHE_H
A rectangle specified with double values.
Definition: qgsrectangle.h:35
QMap< QString, QImage > mCachedImages
This class is responsible for keeping cache of rendered images of individual layers.