Marble

Tracking.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_DECLARATIVE_TRACKING_H
7#define MARBLE_DECLARATIVE_TRACKING_H
8
9#include "PositionSource.h"
10
11#include <QObject>
12#include <qqmlintegration.h>
13
14namespace Marble
15{
16class AutoNavigation;
17class MarbleQuickItem;
18
19class Tracking : public QObject
20{
22 QML_ELEMENT
23
24 Q_PROPERTY(MarbleQuickItem *map READ map WRITE setMap NOTIFY mapChanged)
25 Q_PROPERTY(bool showTrack READ showTrack WRITE setShowTrack NOTIFY showTrackChanged)
26 Q_PROPERTY(bool autoCenter READ autoCenter WRITE setAutoCenter NOTIFY autoCenterChanged)
27 Q_PROPERTY(bool autoZoom READ autoZoom WRITE setAutoZoom NOTIFY autoZoomChanged)
28 Q_PROPERTY(PositionSource *positionSource READ positionSource WRITE setPositionSource NOTIFY positionSourceChanged)
29 Q_PROPERTY(QObject *positionMarker READ positionMarker WRITE setPositionMarker NOTIFY positionMarkerChanged)
30 Q_PROPERTY(bool hasLastKnownPosition READ hasLastKnownPosition NOTIFY hasLastKnownPositionChanged)
31 Q_PROPERTY(Coordinate *lastKnownPosition READ lastKnownPosition WRITE setLastKnownPosition NOTIFY lastKnownPositionChanged)
32 Q_PROPERTY(PositionMarkerType positionMarkerType READ positionMarkerType WRITE setPositionMarkerType NOTIFY positionMarkerTypeChanged)
33 Q_PROPERTY(double distance READ distance NOTIFY distanceChanged)
34
35public:
36 enum PositionMarkerType {
37 None,
38 Circle,
39 Arrow,
40 };
41 Q_ENUM(PositionMarkerType)
42
43 explicit Tracking(QObject *parent = nullptr);
44
45 bool showTrack() const;
46
47 void setShowTrack(bool show);
48
49 PositionSource *positionSource();
50
51 void setPositionSource(PositionSource *source);
52
53 QObject *positionMarker();
54
55 void setPositionMarker(QObject *marker);
56
57 MarbleQuickItem *map();
58
59 void setMap(MarbleQuickItem *widget);
60
61 bool hasLastKnownPosition() const;
62
63 Coordinate *lastKnownPosition();
64
65 void setLastKnownPosition(Coordinate *lastKnownPosition);
66
67 bool autoCenter() const;
68
69 void setAutoCenter(bool enabled);
70
71 bool autoZoom() const;
72
73 void setAutoZoom(bool enabled);
74
75 PositionMarkerType positionMarkerType() const;
76
77 void setPositionMarkerType(PositionMarkerType type);
78
79 double distance() const;
80
81public Q_SLOTS:
82 void saveTrack(const QString &fileName);
83
84 void openTrack(const QString &fileName);
85
86 void clearTrack();
87
89 void mapChanged();
90
91 void showTrackChanged();
92
93 void positionSourceChanged();
94
95 void positionMarkerChanged();
96
97 void hasLastKnownPositionChanged();
98
99 void lastKnownPositionChanged();
100
101 void autoCenterChanged();
102
103 void autoZoomChanged();
104
105 void positionMarkerTypeChanged();
106
107 void distanceChanged();
108
109private Q_SLOTS:
110 void updatePositionMarker();
111
112 void updateLastKnownPosition();
113
114 void setHasLastKnownPosition();
115
116private:
117 void setShowPositionMarkerPlugin(bool visible);
118
119 bool m_showTrack;
120
121 PositionSource *m_positionSource = nullptr;
122
123 QObject *m_positionMarker = nullptr;
124
125 MarbleQuickItem *m_marbleQuickItem = nullptr;
126
127 bool m_hasLastKnownPosition;
128
129 Coordinate m_lastKnownPosition;
130
131 Marble::AutoNavigation *m_autoNavigation = nullptr;
132
133 PositionMarkerType m_positionMarkerType;
134};
135
136}
137
138#endif
Represents a coordinate with the properties of a name and coordinates.
Definition Coordinate.h:19
Binds a QML item to a specific geodetic location in screen coordinates.
Q_ENUM(...)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.