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 "MarbleGlobal.h"
12#include "PluginManager.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
32public:
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
62private Q_SLOTS:
63 void updateTile(QByteArray const &imageData, QString const &tileId);
64 void updateTile(QString const &fileName, QString const &idStr);
65
67 void tileRequested(QUrl const &sourceUrl, QString const &destinationFileName, QString const &id, DownloadUsage);
68
69 void tileCompleted(TileId const &tileId, QImage const &tileImage);
70
71 void tileCompleted(TileId const &tileId, GeoDataDocument *document);
72
73private:
74 static QString tileFileName(GeoSceneTileDataset const *tileData, TileId const &);
75 void triggerDownload(GeoSceneTileDataset const *tileData, TileId const &, DownloadUsage const);
76 static QImage scaledLowerLevelTile(GeoSceneTextureTileDataset const *textureData, TileId const &);
77 GeoDataDocument *openVectorFile(const QString &filename) const;
78
79 // For vectorTile parsing
80 PluginManager const *m_pluginManager;
81};
82
83}
84
85#endif
Binds a QML item to a specific geodetic location in screen coordinates.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.