QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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( QgsRectangle extent, double scale );
50 
52  void setCacheImage( QString layerId, const QImage& img );
53 
55  QImage cacheImage( QString layerId );
56 
58  void clearCacheImage( QString layerId );
59 
60  protected slots:
62  void layerRequestedRepaint();
63 
64  protected:
66  void clearInternal();
67 
68  protected:
69  QMutex mMutex;
71  double mScale;
72  QMap<QString, QImage> mCachedImages;
73 };
74 
75 
76 #endif // QGSMAPRENDERERCACHE_H