20 #include <QAbstractNetworkCache> 23 QCache<QUrl, QImage> QgsTileCache::sTileCache( 256 );
24 QMutex QgsTileCache::sTileCacheMutex;
29 QMutexLocker locker( &sTileCacheMutex );
30 sTileCache.insert( url,
new QImage( image ) );
35 QMutexLocker locker( &sTileCacheMutex );
37 if ( QImage *i = sTileCache.object( url ) )
46 QByteArray imageData = data->readAll();
49 image = QImage::fromData( imageData );
53 if ( ! image.isNull( ) )
55 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 void insertTile(const QUrl &url, const QImage &image)
Add a tile image with given URL to the cache.
static bool tile(const QUrl &url, QImage &image)
Try to access a tile and load it into "image" argument.