Marble

PositionTracking.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007 Andrew Manson <g.real.ate@gmail.com>
4// SPDX-FileCopyrightText: 2009 Eckhart Wörner <ewoerner@kde.org>
5// SPDX-FileCopyrightText: 2010 Thibaut Gridel <tgridel@free.fr>
6//
7
8#ifndef MARBLE_POSITIONTRACKING_H
9#define MARBLE_POSITIONTRACKING_H
10
11#include "PositionProviderPluginInterface.h"
12#include "marble_export.h"
13
14#include <QObject>
15
16namespace Marble
17{
18
19class GeoDataAccuracy;
20class GeoDataCoordinates;
21class GeoDataTreeModel;
22class PositionProviderPlugin;
23class PositionTrackingPrivate;
24
25class MARBLE_EXPORT PositionTracking : public QObject
26{
27 Q_OBJECT
28
29 Q_PROPERTY(PositionProviderPlugin *positionProviderPlugin READ positionProviderPlugin WRITE setPositionProviderPlugin NOTIFY positionProviderPluginChanged)
30
31public:
32 explicit PositionTracking(GeoDataTreeModel *model);
33 ~PositionTracking() override;
34
35 /**
36 * Change the position provider to use. You can provide 0 to disable
37 * position tracking. Ownership of the provided plugin is taken.
38 */
39 void setPositionProviderPlugin(PositionProviderPlugin *plugin);
40
41 /** @brief Returns the current position provider plugin, or 0 if none is in use */
42 PositionProviderPlugin *positionProviderPlugin();
43
44 /**
45 * @brief gives the error message from the current position provider
46 */
47 QString error() const;
48
49 /**
50 * @brief provides speed of the gps device
51 */
52 qreal speed() const;
53
54 /**
55 * @brief provides direction of the gps device in degrees with geographical north
56 */
57 qreal direction() const;
58
59 /**
60 * @brief Returns the timestamp of last recent tracking point.
61 */
62 QDateTime timestamp() const;
63
64 /** @brief Returns the estimated accuracy of the current position */
65 GeoDataAccuracy accuracy() const;
66
67 /**
68 * @brief provides the visibility of the Position Tracking document
69 */
70 bool trackVisible() const;
71
72 /** @brief Returns the current position, if any */
73 GeoDataCoordinates currentLocation() const;
74
75 /** @brief Returns the status of the current position provider plugin, if any */
76 PositionProviderStatus status() const;
77
78 /** @brief Returns true if there is no position in the track */
79 bool isTrackEmpty() const;
80
81 /**
82 * @brief Returns the total track length
83 * @param planetRadius Scale factor, usually the radius of the underlying planet
84 * @return Length of all track segments on the unit sphere scaled by planetRadius
85 */
86 qreal length(qreal planetRadius) const;
87
88 void readSettings();
89
90 void writeSettings();
91
92public Q_SLOTS:
93 /**
94 * Toggles the visibility of the Position Tracking document
95 */
96 void setTrackVisible(bool visible);
97
98 /**
99 * Saves the track document to file
100 */
101 bool saveTrack(const QString &fileName);
102
103 /**
104 * Removes all track segments which were recorded
105 */
106 void clearTrack();
107
108Q_SIGNALS:
109 void gpsLocation(const GeoDataCoordinates &, qreal);
110
111 void statusChanged(PositionProviderStatus status);
112
113 /**
114 * @brief emits positionProviderPluginChanged(0) when provider is disabled
115 */
116 void positionProviderPluginChanged(PositionProviderPlugin *activePlugin);
117
118private:
119 Q_PRIVATE_SLOT(d, void updatePosition())
120 Q_PRIVATE_SLOT(d, void updateStatus())
121
122 friend class PositionTrackingPrivate;
123 PositionTrackingPrivate *const d;
124};
125
126}
127
128#endif
Q_SCRIPTABLE CaptureState status()
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
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 Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.