QGIS API Documentation 3.99.0-Master (a8f284845db)
Loading...
Searching...
No Matches
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
21#include <QCache>
22#include <QMutex>
23
24#define SIP_NO_FILE
25
26class QImage;
27class QUrl;
28
29
42class CORE_EXPORT QgsTileCache
43{
44 public:
45
47 static void insertTile( const QUrl &url, const QImage &image );
48
53 static bool tile( const QUrl &url, QImage &image );
54
56 static int totalCost();
58 static int maxCost();
59
60 private:
62 static QCache<QUrl, QImage> sTileCache;
64 static QMutex sTileCacheMutex;
65};
66
67#endif // QGSTILECACHE_H
A simple tile cache implementation.
static bool tile(const QUrl &url, QImage &image)
Try to access a tile and load it into "image" argument.
static int totalCost()
how many tiles are stored in the in-memory cache
static void insertTile(const QUrl &url, const QImage &image)
Add a tile image with given URL to the cache.
static int maxCost()
how many tiles can be stored in the in-memory cache