Marble

TileLoader.h
1// SPDX-FileCopyrightText: 2010 Jens-Michael Hoffmann <jmho@c-xx.com>
2// SPDX-FileCopyrightText: 2010-2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
3//
4// SPDX-License-Identifier: LGPL-2.1-or-later
5
6#ifndef MARBLE_TILELOADER_H
7#define MARBLE_TILELOADER_H
8
9#include <QObject>
10
11#include "PluginManager.h"
12#include "MarbleGlobal.h"
13
14class QByteArray;
15class QImage;
16class QUrl;
17class QString;
18
19namespace Marble
20{
21class TileId;
22class HttpDownloadManager;
23class GeoDataDocument;
24class GeoSceneTileDataset;
25class GeoSceneTextureTileDataset;
26class GeoSceneVectorTileDataset;
27
28class TileLoader: public QObject
29{
31
32 public:
33 enum TileStatus {
34 Missing,
35 Expired,
36 Available
37 };
38
39 explicit TileLoader(HttpDownloadManager * const, const PluginManager * );
40 ~TileLoader() override;
41
42 QImage loadTileImage( GeoSceneTextureTileDataset const *textureData, TileId const & tileId, DownloadUsage const );
43 GeoDataDocument* loadTileVectorData( GeoSceneVectorTileDataset const *vectorData, TileId const & tileId, DownloadUsage const usage );
44 void downloadTile( GeoSceneTileDataset const *tileData, TileId const &, DownloadUsage const );
45
46 static int maximumTileLevel( GeoSceneTileDataset const & tileData );
47
48 /**
49 * Returns whether the mandatory most basic tile level is fully available for
50 * the given @p layer.
51 */
52 static bool baseTilesAvailable( GeoSceneTileDataset const & tileData );
53
54 /**
55 * Returns the status of the downloaded tile file:
56 * - Missing when it has not been downloaded
57 * - Expired when it has been downloaded, but is too old (as per .dgml expiration time)
58 * - Available when it has been downloaded and is not expired
59 */
60 static TileStatus tileStatus( GeoSceneTileDataset const *tileData, const TileId &tileId );
61
62 private Q_SLOTS:
63 void updateTile( QByteArray const & imageData, QString const & tileId );
64 void updateTile( QString const & fileName, QString const & idStr );
65
67 void downloadTile( QUrl const & sourceUrl, QString const & destinationFileName,
68 QString const & id, DownloadUsage );
69
70 void tileCompleted( TileId const & tileId, QImage const & tileImage );
71
72 void tileCompleted( TileId const & tileId, GeoDataDocument * document );
73
74 private:
75 static QString tileFileName( GeoSceneTileDataset const * tileData, TileId const & );
76 void triggerDownload( GeoSceneTileDataset const *tileData, TileId const &, DownloadUsage const );
77 static QImage scaledLowerLevelTile( GeoSceneTextureTileDataset const * textureData, TileId const & );
78 GeoDataDocument* openVectorFile(const QString &filename) const;
79
80 // For vectorTile parsing
81 PluginManager const * m_pluginManager;
82};
83
84}
85
86#endif
Binds a QML item to a specific geodetic location in screen coordinates.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.