1
// Copyright 2010 Jens-Michael Hoffmann <jmho@c-xx.com>
3
// This library is free software; you can redistribute it and/or
4
// modify it under the terms of the GNU Lesser General Public
5
// License as published by the Free Software Foundation; either
6
// version 2.1 of the License, or (at your option) any later version.
8
// This library is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
// Lesser General Public License for more details.
13
// You should have received a copy of the GNU Lesser General Public
14
// License along with this library. If not, see <http://www.gnu.org/licenses/>.
16
#ifndef MARBLE_TILELOADER_H
17
#define MARBLE_TILELOADER_H
19
#include <QtCore/QHash>
20
#include <QtCore/QObject>
21
#include <QtCore/QSet>
22
#include <QtCore/QString>
23
#include <QtGui/QImage>
34
class HttpDownloadManager;
35
class GeoSceneTexture;
36
class MapThemeManager;
38
class TileLoader: public QObject
43
TileLoader( HttpDownloadManager * const, MapThemeManager const * mapThemeManager );
45
QImage loadTile( TileId const & tileId, DownloadUsage const );
46
void reloadTile( TileId const &tileId, DownloadUsage const );
47
void downloadTile( TileId const & tileId );
49
static int maximumTileLevel( GeoSceneTexture const & texture );
52
* Returns whether the mandatory most basic tile level is fully available for
53
* the given @p texture layer.
55
static bool baseTilesAvailable( GeoSceneTexture const & texture );
58
void updateTile( QByteArray const & imageData, QString const & tileId );
60
void updateTextureLayers();
63
void downloadTile( QUrl const & sourceUrl, QString const & destinationFileName,
64
QString const & id, DownloadUsage );
66
void tileCompleted( TileId const & tileId, QImage const & tileImage );
69
GeoSceneTexture const * findTextureLayer( TileId const & ) const;
70
QString tileFileName( TileId const & ) const;
71
void triggerDownload( TileId const &, DownloadUsage const );
72
QImage scaledLowerLevelTile( TileId const & );
74
MapThemeManager const * const m_mapThemeManager;
76
// TODO: comment about uint hash key
77
QHash<uint, GeoSceneTexture const *> m_textureLayers;
79
// contains tiles, for which a download has been triggered
80
// because the tile was not there at all or is expired.
81
QSet<TileId> m_waitingForUpdate;