Marble

StackedTileLoader.h
1 /*
2  SPDX-FileCopyrightText: 2005-2007 Torsten Rahn <[email protected]>
3  SPDX-FileCopyrightText: 2007 Inge Wallin <[email protected]>
4  SPDX-FileCopyrightText: 2009 Jens-Michael Hoffmann <[email protected]>
5  SPDX-FileCopyrightText: 2010-2012 Bernhard Beschow <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef MARBLE_STACKEDTILELOADER_H
11 #define MARBLE_STACKEDTILELOADER_H
12 
13 #include <QObject>
14 
15 #include "RenderState.h"
16 
17 class QImage;
18 class QString;
19 class QSize;
20 
21 namespace Marble
22 {
23 
24 class GeoSceneAbstractTileProjection;
25 class MergedLayerDecorator;
26 class StackedTile;
27 class TileId;
28 
29 class StackedTileLoaderPrivate;
30 
31 /**
32  * @short Tile loading from a quad tree
33  *
34  * This class loads tiles into memory. For faster access
35  * we keep the tileIDs and their respective pointers to
36  * the tiles in a hashtable.
37  * The class also contains convenience methods to remove entries
38  * from the hashtable and to return more detailed properties
39  * about each tile level and their tiles.
40  *
41  * @author Torsten Rahn <[email protected]>
42  **/
43 
44 class StackedTileLoader : public QObject
45 {
46  Q_OBJECT
47 
48  public:
49  /**
50  * Creates a new tile loader.
51  *
52  * @param mergedLayerDecorator The decorator that shall be used to decorate
53  * the layer.
54  * @param parent The parent widget.
55  */
56  explicit StackedTileLoader( MergedLayerDecorator *mergedLayerDecorator, QObject *parent = nullptr );
57  ~StackedTileLoader() override;
58 
59  int tileColumnCount( int level ) const;
60 
61  int tileRowCount( int level ) const;
62 
63  const GeoSceneAbstractTileProjection *tileProjection() const;
64 
65  QSize tileSize() const;
66 
67  /**
68  * Loads a tile and returns it.
69  *
70  * @param stackedTileId The Id of the requested tile, containing the x and y coordinate
71  * and the zoom level.
72  */
73  const StackedTile* loadTile( TileId const &stackedTileId );
74 
75  /**
76  * Resets the internal tile hash.
77  */
78  void resetTilehash();
79 
80  /**
81  * Cleans up the internal tile hash.
82  *
83  * Removes all superfluous tiles from the hash.
84  */
85  void cleanupTilehash();
86 
87  /**
88  * @brief Returns the limit of the volatile (in RAM) cache.
89  * @return the cache limit in kilobytes
90  */
91  quint64 volatileCacheLimit() const;
92 
93  /**
94  * @brief Reloads the tiles that are currently displayed.
95  */
97 
98  /**
99  * @brief Return the number of tiles in the cache.
100  * @return number of tiles in cache
101  */
102  int tileCount() const;
103 
104  /**
105  * @brief Set the limit of the volatile (in RAM) cache.
106  * @param kiloBytes The limit in kilobytes.
107  */
108  void setVolatileCacheLimit( quint64 kiloBytes );
109 
110  /**
111  * Effectively triggers a reload of all tiles that are currently in use
112  * and clears the tile cache in physical memory.
113  */
114  void clear();
115 
116  /**
117  */
118  void updateTile(TileId const & tileId, QImage const &tileImage );
119 
120  RenderState renderState() const;
121 
122  Q_SIGNALS:
123  void tileLoaded( TileId const &tileId );
124  void cleared();
125 
126  private:
128 
129  friend class StackedTileLoaderPrivate;
130  StackedTileLoaderPrivate* const d;
131 };
132 
133 }
134 
135 #endif
Q_OBJECTQ_OBJECT
StackedTileLoader(MergedLayerDecorator *mergedLayerDecorator, QObject *parent=nullptr)
Creates a new tile loader.
quint64 volatileCacheLimit() const
Returns the limit of the volatile (in RAM) cache.
A single tile that consists of a stack of Tile layers.
Definition: StackedTile.h:50
const StackedTile * loadTile(TileId const &stackedTileId)
Loads a tile and returns it.
int tileCount() const
Return the number of tiles in the cache.
Tile loading from a quad tree.
void cleanupTilehash()
Cleans up the internal tile hash.
void clear()
Effectively triggers a reload of all tiles that are currently in use and clears the tile cache in phy...
QList< TileId > visibleTiles() const
Reloads the tiles that are currently displayed.
Binds a QML item to a specific geodetic location in screen coordinates.
Q_SIGNALSQ_SIGNALS
void setVolatileCacheLimit(quint64 kiloBytes)
Set the limit of the volatile (in RAM) cache.
void resetTilehash()
Resets the internal tile hash.
Q_DISABLE_COPY(Class)
QObject * parent() const const
A base class for projections between tile indizes and geo coordinates in Marble.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Feb 5 2023 03:59:29 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.