20 #include <QAbstractNetworkCache>
24 QCache<QUrl, QImage> QgsTileCache::sTileCache( 256 );
25 QMutex QgsTileCache::sTileCacheMutex;
30 QMutexLocker locker( &sTileCacheMutex );
31 sTileCache.insert( url,
new QImage( image ) );
36 QMutexLocker locker( &sTileCacheMutex );
38 if ( QImage *i = sTileCache.object( url ) )
47 QByteArray imageData = data->readAll();
50 image = QImage::fromData( imageData );
54 if ( ! image.isNull( ) )
56 sTileCache.insert( url,
new QImage( image ) );
static QgsNetworkAccessManager * instance(Qt::ConnectionType connectionType=Qt::BlockingQueuedConnection)
Returns a pointer to the active QgsNetworkAccessManager for the current thread.
static bool tile(const QUrl &url, QImage &image)
Try to access a tile and load it into "image" argument.
static void insertTile(const QUrl &url, const QImage &image)
Add a tile image with given URL to the cache.