QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgstilecache.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgstilecache.h
3  --------------------------------------
4  Date : September 2016
5  Copyright : (C) 2016 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 QGSTILECACHE_H
17 #define QGSTILECACHE_H
18 
19 #include "qgis_core.h"
20 #include <QCache>
21 #include <QMutex>
22 
23 class QImage;
24 class QUrl;
25 
26 #define SIP_NO_FILE
27 
40 class CORE_EXPORT QgsTileCache
41 {
42  public:
43 
45  static void insertTile( const QUrl &url, const QImage &image );
46 
51  static bool tile( const QUrl &url, QImage &image );
52 
54  static int totalCost() { QMutexLocker locker( &sTileCacheMutex ); return sTileCache.totalCost(); }
56  static int maxCost() { QMutexLocker locker( &sTileCacheMutex ); return sTileCache.maxCost(); }
57 
58  private:
60  static QCache<QUrl, QImage> sTileCache;
62  static QMutex sTileCacheMutex;
63 };
64 
65 #endif // QGSTILECACHE_H
QgsTileCache
A simple tile cache implementation.
Definition: qgstilecache.h:41
QgsTileCache::totalCost
static int totalCost()
how many tiles are stored in the in-memory cache
Definition: qgstilecache.h:54
QgsTileCache::maxCost
static int maxCost()
how many tiles can be stored in the in-memory cache
Definition: qgstilecache.h:56