Marble

VectorTileModel.h
1/*
2 SPDX-License-Identifier: LGPL-2.1-or-later
3
4 SPDX-FileCopyrightText: 2012 Ander Pijoan <ander.pijoan@deusto.es>
5 SPDX-FileCopyrightText: 2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
6*/
7
8#ifndef MARBLE_VECTORTILEMODEL_H
9#define MARBLE_VECTORTILEMODEL_H
10
11#include <QObject>
12#include <QRunnable>
13
14#include <QMap>
15
16#include "TileId.h"
17#include "GeoDataLatLonBox.h"
18
19class QThreadPool;
20
21namespace Marble
22{
23
24class GeoDataDocument;
25class GeoDataTreeModel;
26class GeoSceneVectorTileDataset;
27class GeoDataObject;
28class TileLoader;
29
30class TileRunner : public QObject, public QRunnable
31{
33
34public:
35 TileRunner( TileLoader *loader, const GeoSceneVectorTileDataset *texture, const TileId &id );
36 void run() override;
37
39 void documentLoaded( const TileId &id, GeoDataDocument *document );
40
41private:
42 TileLoader *const m_loader;
43 const GeoSceneVectorTileDataset *const m_tileDataset;
44 const TileId m_id;
45};
46
47class VectorTileModel : public QObject
48{
50
51public:
52 explicit VectorTileModel( TileLoader *loader, const GeoSceneVectorTileDataset *layer, GeoDataTreeModel *treeModel, QThreadPool *threadPool );
53
54 void setViewport(const GeoDataLatLonBox &bbox);
55
56 QString name() const;
57
58 const GeoSceneVectorTileDataset *layer() const;
59
60 void removeTile(GeoDataDocument* document);
61
62 int tileZoomLevel() const;
63
64 int cachedDocuments() const;
65
66 void reload();
67
68public Q_SLOTS:
69 void updateTile( const TileId &id, GeoDataDocument *document );
70
71 void clear();
72
74 void tileCompleted( const TileId &tileId );
75 void tileAdded(GeoDataDocument *document);
76 void tileRemoved(GeoDataDocument *document);
77
78private Q_SLOTS:
79 void cleanupTile(GeoDataObject* feature);
80
81private:
82 void removeTilesOutOfView(const GeoDataLatLonBox &boundingBox);
83 void queryTiles(int tileZoomLevel, const QRect &rect);
84
85private:
86 struct CacheDocument
87 {
88 /** The CacheDocument takes ownership of doc */
89 CacheDocument(GeoDataDocument *doc, VectorTileModel* vectorTileModel, const GeoDataLatLonBox &boundingBox);
90
91 /** Remove the document from the tree and delete the document */
92 ~CacheDocument();
93
94 GeoDataLatLonBox latLonBox() const { return m_boundingBox; }
95
96 private:
97 Q_DISABLE_COPY( CacheDocument )
98
99 GeoDataDocument *const m_document;
100 VectorTileModel *const m_vectorTileModel;
101 GeoDataLatLonBox m_boundingBox;
102 };
103
104 TileLoader *const m_loader;
105 const GeoSceneVectorTileDataset *const m_layer;
106 GeoDataTreeModel *const m_treeModel;
107 QThreadPool *const m_threadPool;
108 int m_tileLoadLevel;
109 int m_tileZoomLevel;
110 QList<TileId> m_pendingDocuments;
111 QList<GeoDataDocument*> m_garbageQueue;
113 bool m_deleteDocumentsLater;
114};
115
116}
117
118#endif // MARBLE_VECTORTILEMODEL_H
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 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.