Marble

TileLoader.h
1 // SPDX-FileCopyrightText: 2010 Jens-Michael Hoffmann <[email protected]>
2 // SPDX-FileCopyrightText: 2010-2012 Bernhard Beschow <[email protected]>
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 
14 class QByteArray;
15 class QImage;
16 class QUrl;
17 class QString;
18 
19 namespace Marble
20 {
21 class TileId;
22 class HttpDownloadManager;
23 class GeoDataDocument;
24 class GeoSceneTileDataset;
25 class GeoSceneTextureTileDataset;
26 class GeoSceneVectorTileDataset;
27 
28 class TileLoader: public QObject
29 {
30  Q_OBJECT
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 
66  Q_SIGNALS:
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
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
DownloadUsage
This enum is used to describe the type of download.
Definition: MarbleGlobal.h:153
Binds a QML item to a specific geodetic location in screen coordinates.
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Oct 4 2023 04:09:43 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.