Marble

StackedTileLoader.h
1/*
2 SPDX-FileCopyrightText: 2005-2007 Torsten Rahn <tackat@kde.org>
3 SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
4 SPDX-FileCopyrightText: 2009 Jens-Michael Hoffmann <jensmh@gmx.de>
5 SPDX-FileCopyrightText: 2010-2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
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
17class QImage;
18class QString;
19class QSize;
20
21namespace Marble
22{
23
24class GeoSceneAbstractTileProjection;
25class MergedLayerDecorator;
26class StackedTile;
27class TileId;
28
29class 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 <rahn@kde.org>
42 **/
43
45{
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:
127 Q_DISABLE_COPY( StackedTileLoader )
128
129 friend class StackedTileLoaderPrivate;
130 StackedTileLoaderPrivate* const d;
131};
132
133}
134
135#endif
A base class for projections between tile indizes and geo coordinates in Marble.
Tile loading from a quad tree.
void clear()
Effectively triggers a reload of all tiles that are currently in use and clears the tile cache in phy...
int tileCount() const
Return the number of tiles in the cache.
void cleanupTilehash()
Cleans up the internal tile hash.
void resetTilehash()
Resets the internal tile hash.
quint64 volatileCacheLimit() const
Returns the limit of the volatile (in RAM) cache.
StackedTileLoader(MergedLayerDecorator *mergedLayerDecorator, QObject *parent=nullptr)
Creates a new tile loader.
QList< TileId > visibleTiles() const
Reloads the tiles that are currently displayed.
const StackedTile * loadTile(TileId const &stackedTileId)
Loads a tile and returns it.
void setVolatileCacheLimit(quint64 kiloBytes)
Set the limit of the volatile (in RAM) cache.
A single tile that consists of a stack of Tile layers.
Definition StackedTile.h:51
Binds a QML item to a specific geodetic location in screen coordinates.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.