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
13namespace Marble {
14class AutoNavigation;
15class MarbleQuickItem;
16
17class Tracking : public QObject
18{
20 Q_ENUMS( PositionMarkerType )
21
22 Q_PROPERTY( MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged )
23 Q_PROPERTY( bool showTrack READ showTrack WRITE setShowTrack NOTIFY showTrackChanged )
24 Q_PROPERTY( bool autoCenter READ autoCenter WRITE setAutoCenter NOTIFY autoCenterChanged )
25 Q_PROPERTY( bool autoZoom READ autoZoom WRITE setAutoZoom NOTIFY autoZoomChanged )
26 Q_PROPERTY( PositionSource* positionSource READ positionSource WRITE setPositionSource NOTIFY positionSourceChanged )
27 Q_PROPERTY( QObject* positionMarker READ positionMarker WRITE setPositionMarker NOTIFY positionMarkerChanged )
28 Q_PROPERTY( bool hasLastKnownPosition READ hasLastKnownPosition NOTIFY hasLastKnownPositionChanged )
29 Q_PROPERTY( Coordinate* lastKnownPosition READ lastKnownPosition WRITE setLastKnownPosition NOTIFY lastKnownPositionChanged )
30 Q_PROPERTY( PositionMarkerType positionMarkerType READ positionMarkerType WRITE setPositionMarkerType NOTIFY positionMarkerTypeChanged )
31 Q_PROPERTY( double distance READ distance NOTIFY distanceChanged )
32
33public:
34 enum PositionMarkerType {
35 None,
36 Circle,
37 Arrow
38 };
39
40 explicit Tracking( QObject* parent = nullptr );
41
42 bool showTrack() const;
43
44 void setShowTrack( bool show );
45
46 PositionSource* positionSource();
47
48 void setPositionSource( PositionSource* source );
49
50 QObject* positionMarker();
51
52 void setPositionMarker( QObject* marker );
53
54 MarbleQuickItem* map();
55
56 void setMap( MarbleQuickItem* widget );
57
58 bool hasLastKnownPosition() const;
59
60 Coordinate *lastKnownPosition();
61
62 void setLastKnownPosition( Coordinate* lastKnownPosition );
63
64 bool autoCenter() const;
65
66 void setAutoCenter( bool enabled );
67
68 bool autoZoom() const;
69
70 void setAutoZoom( bool enabled );
71
72 PositionMarkerType positionMarkerType() const;
73
74 void setPositionMarkerType( PositionMarkerType type );
75
76 double distance() const;
77
78public Q_SLOTS:
79 void saveTrack( const QString &fileName );
80
81 void openTrack( const QString &fileName );
82
83 void clearTrack();
84
86 void mapChanged();
87
88 void showTrackChanged();
89
90 void positionSourceChanged();
91
92 void positionMarkerChanged();
93
94 void hasLastKnownPositionChanged();
95
96 void lastKnownPositionChanged();
97
98 void autoCenterChanged();
99
100 void autoZoomChanged();
101
102 void positionMarkerTypeChanged();
103
104 void distanceChanged();
105
106private Q_SLOTS:
107 void updatePositionMarker();
108
109 void updateLastKnownPosition();
110
111 void setHasLastKnownPosition();
112
113private:
114 void setShowPositionMarkerPlugin( bool visible );
115
116 bool m_showTrack;
117
118 PositionSource* m_positionSource;
119
120 QObject* m_positionMarker;
121
122 MarbleQuickItem* m_marbleQuickItem;
123
124 bool m_hasLastKnownPosition;
125
126 Coordinate m_lastKnownPosition;
127
128 Marble::AutoNavigation* m_autoNavigation;
129
130 PositionMarkerType m_positionMarkerType;
131};
132
133}
134
135
136#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_ENUMS(...)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
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 Fri Jun 14 2024 11:54:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.