Marble

MarbleModel.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2005-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5// SPDX-FileCopyrightText: 2010-2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
6//
7
8//
9// MarbleModel is the data store and index class for the MarbleWidget.
10//
11
12#ifndef MARBLE_MARBLEMODEL_H
13#define MARBLE_MARBLEMODEL_H
14
15/** @file
16 * This file contains the headers for MarbleModel
17 *
18 * @author Torsten Rahn <tackat@kde.org>
19 * @author Inge Wallin <inge@lysator.liu.se>
20 */
21
22#include "marble_export.h"
23
24#include <QObject>
25#include <QString>
26
27#include "MarbleGlobal.h"
28
31class QTextDocument;
32class QDateTime;
33
34namespace Marble
35{
36
37class GeoDataPlacemark;
38class GeoPainter;
39class MeasureTool;
40class PositionTracking;
41class HttpDownloadManager;
42class MarbleModelPrivate;
43class MarbleClock;
44class SunLocator;
45class TileCreator;
46class PluginManager;
47class GeoDataCoordinates;
48class GeoDataTreeModel;
49class GeoSceneDocument;
50class Planet;
51class RoutingManager;
52class BookmarkManager;
53class FileManager;
54class ElevationModel;
55
56/**
57 * @short The data model (not based on QAbstractModel) for a MarbleWidget.
58 *
59 * This class provides a data storage and indexer that can be
60 * displayed in a MarbleWidget. It contains 3 different datatypes:
61 * <b>tiles</b> which provide the background, <b>vectors</b> which
62 * provide things like country borders and coastlines and
63 * <b>placemarks</b> which can show points of interest, such as
64 * cities, mountain tops or the poles.
65 *
66 * The <b>tiles</b> provide the background of the image and can be for
67 * instance height and depth fields, magnetic strength, topographic
68 * data or anything else that is area based.
69 *
70 * The <b>vectors</b> provide things like country borders and
71 * coastlines. They are stored in separate files and can be added or
72 * removed at anytime.
73 *
74 * The <b>placemarks</b> contain points of interest, such as cities,
75 * mountain tops or the poles. These are sorted by size (for cities)
76 * and category (capitals, other important cities, less important
77 * cities, etc) and are displayed with different color or shape like
78 * square or round.
79 *
80 * @see MarbleWidget
81 */
82
83class MARBLE_EXPORT MarbleModel : public QObject
84{
85 friend class MarbleModelPrivate;
86
87 Q_OBJECT
88
89 Q_PROPERTY(QString mapThemeId READ mapThemeId WRITE setMapThemeId NOTIFY themeChanged)
90 Q_PROPERTY(bool workOffline READ workOffline WRITE setWorkOffline NOTIFY workOfflineChanged)
91
92public:
93 /**
94 * @brief Construct a new MarbleModel.
95 * @param parent the parent widget
96 */
97 explicit MarbleModel(QObject *parent = nullptr);
98 ~MarbleModel() override;
99
100 /**
101 * @brief Return the list of Placemarks as a QAbstractItemModel *
102 * @return a list of all Placemarks in the MarbleModel.
103 */
104 GeoDataTreeModel *treeModel();
105 const GeoDataTreeModel *treeModel() const;
106
107 QAbstractItemModel *groundOverlayModel();
108 const QAbstractItemModel *groundOverlayModel() const;
109
110 QAbstractItemModel *placemarkModel();
111 const QAbstractItemModel *placemarkModel() const;
112
113 QItemSelectionModel *placemarkSelectionModel();
114
115 /**
116 * @brief Return the name of the current map theme.
117 * @return the identifier of the current MapTheme.
118 * To ensure that a unique identifier is being used the theme does NOT
119 * get represented by its name but the by relative location of the file
120 * that specifies the theme:
121 *
122 * Example:
123 * maptheme = "earth/bluemarble/bluemarble.dgml"
124 */
125 QString mapThemeId() const;
126
127 GeoSceneDocument *mapTheme();
128 const GeoSceneDocument *mapTheme() const;
129 void setMapTheme(GeoSceneDocument *document);
130
131 /**
132 * @brief Set a new map theme to use.
133 * @param mapThemeId the identifier of the new map theme
134 *
135 * This function sets the map theme, i.e. combination of tile set
136 * and color scheme to use. If the map theme is not previously
137 * used, some basic tiles are created and a progress dialog is
138 * shown.
139 *
140 * The ID of the new maptheme. To ensure that a unique
141 * identifier is being used the theme does NOT get represented by its
142 * name but the by relative location of the file that specifies the theme:
143 *
144 * Example:
145 * maptheme = "earth/bluemarble/bluemarble.dgml"
146 */
147 void setMapThemeId(const QString &mapThemeId);
148
149 /**
150 * @brief get the home point
151 * @param lon the longitude of the home point.
152 * @param lat the latitude of the home point.
153 * @param zoom the default zoom level of the home point.
154 */
155 void home(qreal &lon, qreal &lat, int &zoom) const;
156 /**
157 * @brief Set the home point
158 * @param lon the longitude of the new home point.
159 * @param lat the latitude of the new home point.
160 * @param zoom the default zoom level for the new home point.
161 */
162 void setHome(qreal lon, qreal lat, int zoom = 1050);
163 /**
164 * @brief Set the home point
165 * @param homePoint the new home point.
166 * @param zoom the default zoom level for the new home point.
167 */
168 void setHome(const GeoDataCoordinates &homePoint, int zoom = 1050);
169
170 /**
171 * @brief Return the downloadmanager to load missing tiles
172 * @return the HttpDownloadManager instance.
173 */
174 HttpDownloadManager *downloadManager();
175 const HttpDownloadManager *downloadManager() const;
176
177 /**
178 * @brief Handle file loading into the treeModel
179 * @param filename the file to load
180 */
181 void addGeoDataFile(const QString &filename);
182
183 /**
184 * @brief Handle raw data loading into the treeModel
185 * @param data the raw data to load
186 * @param key the name to remove this raw data later
187 */
188 void addGeoDataString(const QString &data, const QString &key = QLatin1String("data"));
189
190 /**
191 * @brief Remove the file or raw data from the treeModel
192 * @param key either the file name or the key for raw data
193 */
194 void removeGeoData(const QString &key);
195
196 FileManager *fileManager();
197
198 PositionTracking *positionTracking() const;
199
200 qreal planetRadius() const;
201 QString planetName() const;
202 QString planetId() const;
203
204 MarbleClock *clock();
205 const MarbleClock *clock() const;
206
207 SunLocator *sunLocator();
208 const SunLocator *sunLocator() const;
209
210 /**
211 * @brief Returns the limit in kilobytes of the persistent (on hard disc) tile cache.
212 * @return the limit of persistent tile cache in kilobytes.
213 */
214 quint64 persistentTileCacheLimit() const;
215
216 /**
217 * @brief Returns the limit of the volatile (in RAM) tile cache.
218 * @return the cache limit in kilobytes
219 */
220 quint64 volatileTileCacheLimit() const;
221
222 const PluginManager *pluginManager() const;
223
224 PluginManager *pluginManager();
225
226 /**
227 * @brief Returns the planet object for the current map.
228 * @return the planet object for the current map
229 */
230 const Planet *planet() const;
231
232 RoutingManager *routingManager();
233 const RoutingManager *routingManager() const;
234
235 void setClockDateTime(const QDateTime &datetime);
236
237 QDateTime clockDateTime() const;
238
239 int clockSpeed() const;
240
241 void setClockSpeed(int speed);
242
243 void setClockTimezone(int timeInSec);
244
245 int clockTimezone() const;
246
247 /**
248 * return instance of BookmarkManager
249 */
250 BookmarkManager *bookmarkManager();
251
252 QTextDocument *legend();
253
254 /**
255 * @brief Uses the given text document as the new content of the legend
256 * Any previous legend content is overwritten. MarbleModel takes ownership
257 * of the passed document.
258 */
259 void setLegend(QTextDocument *document);
260
261 bool workOffline() const;
262
263 void setWorkOffline(bool workOffline);
264
265 ElevationModel *elevationModel();
266 const ElevationModel *elevationModel() const;
267
268 /**
269 * Returns the placemark being tracked by this model or 0 if no
270 * placemark is currently tracked.
271 * @see setTrackedPlacemark(), trackedPlacemarkChanged()
272 */
273 const GeoDataPlacemark *trackedPlacemark() const;
274
275public Q_SLOTS:
276 void clearPersistentTileCache();
277
278 /**
279 * @brief Set the limit of the persistent (on hard disc) tile cache.
280 * @param kiloBytes The limit in kilobytes, 0 means no limit.
281 */
282 void setPersistentTileCacheLimit(quint64 kiloBytes);
283
284 /**
285 * @brief Change the placemark tracked by this model
286 * @see trackedPlacemark(), trackedPlacemarkChanged()
287 */
288 void setTrackedPlacemark(const GeoDataPlacemark *placemark);
289
290 void updateProperty(const QString &property, bool value);
291
292Q_SIGNALS:
293
294 /**
295 * @brief Signal that the MarbleModel has started to create a new set of tiles.
296 * @param name name of the set
297 * @param description the set description
298 */
299 void creatingTilesStart(TileCreator *, const QString &name, const QString &description);
300
301 /**
302 * @brief Signal that the map theme has changed, and to which theme.
303 * @param mapTheme the identifier of the new map theme.
304 * @see mapTheme
305 * @see setMapTheme
306 */
307 void themeChanged(const QString &mapTheme);
308
309 void workOfflineChanged();
310
311 /**
312 * @brief Emitted when the placemark tracked by this model has changed
313 * @see setTrackedPlacemark(), trackedPlacemark()
314 */
316
317 /** @brief Emitted when the home location is changed
318 * @see home(), setHome()
319 */
320 void homeChanged(const GeoDataCoordinates &newHomePoint);
321
322private:
323 Q_DISABLE_COPY(MarbleModel)
324
325 Q_PRIVATE_SLOT(d, void assignFillColors(const QString &filePath))
326
327 void addDownloadPolicies(const GeoSceneDocument *mapTheme);
328 MarbleModelPrivate *const d;
329};
330
331}
332
333#endif
This class is responsible for loading the book mark objects from the files and various book mark oper...
This class is responsible for loading the different files into Geodata model.
Definition FileManager.h:33
A 3d point representation.
a class representing a point of interest on the map
The representation of GeoData in a model This class represents all available data given by kml-data f...
A container for features parsed from the DGML file.
This class manages scheduled downloads.
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition MarbleModel.h:84
void trackedPlacemarkChanged(const GeoDataPlacemark *placemark)
Emitted when the placemark tracked by this model has changed.
quint64 volatileTileCacheLimit() const
Returns the limit of the volatile (in RAM) tile cache.
void homeChanged(const GeoDataCoordinates &newHomePoint)
Emitted when the home location is changed.
void themeChanged(const QString &mapTheme)
Signal that the map theme has changed, and to which theme.
void creatingTilesStart(TileCreator *, const QString &name, const QString &description)
Signal that the MarbleModel has started to create a new set of tiles.
The class that handles Marble's plugins.
Delegates data retrieval and model updates to the appropriate routing provider.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.