Enroute Flight Navigation
A navigation app for VFR pilots
TrafficFactor_WithPosition.h
1/***************************************************************************
2 * Copyright (C) 2021-2024 by Stefan Kebekus *
3 * stefan.kebekus@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21#pragma once
22
23#include "positioning/PositionInfo.h"
24#include "traffic/TrafficFactor_Abstract.h"
25
26
27namespace Traffic {
28
29
37
39 Q_OBJECT
40 QML_ELEMENT
41
42public:
47 explicit TrafficFactor_WithPosition(QObject *parent = nullptr);
48
49 // Standard destructor
50 ~TrafficFactor_WithPosition() override = default;
51
52 //
53 // Methods
54 //
55
66 {
68 TrafficFactor_Abstract::copyFrom(other); // This will also call updateDescription
69 }
70
71
72 //
73 // PROPERTIES
74 //
75
81 Q_PROPERTY(QString icon READ icon NOTIFY iconChanged)
82
83
87 [[nodiscard]] auto icon() const -> QString
88 {
89 return m_icon;
90 }
91
94
95
99 [[nodiscard]] auto positionInfo() const -> Positioning::PositionInfo
100 {
101 return m_positionInfo;
102 }
103
110 void setPositionInfo(const Positioning::PositionInfo& newPositionInfo);
111
112
113signals:
116
119
120
121protected:
122 // See documentation in base class
123 void updateDescription() override;
124
125 // Updates property icon
126 void updateIcon();
127
128private:
129 Q_DISABLE_COPY_MOVE(TrafficFactor_WithPosition)
130
131 // Setter function for the property valid. Implementors of this class must bind this to the
132 // notifier signals of all the properties that validity depends on.
133 void updateValid() override;
134
135 //
136 // Property values
137 //
138 QString m_icon;
139 Positioning::PositionInfo m_positionInfo;
140 Units::Distance m_vDist;
141 Units::Distance m_hDist;
142
143};
144
145} // namespace Traffic
Geographic position.
TrafficFactor_Abstract(QObject *parent=nullptr)
Default constructor.
void copyFrom(const TrafficFactor_Abstract &other)
Copy data from other object.
auto icon() const -> QString
Getter method for property with the same name.
void iconChanged()
Notifier signal.
void positionInfoChanged()
Notifier signal.
Positioning::PositionInfo positionInfo
PositionInfo of the traffic.
void setPositionInfo(const Positioning::PositionInfo &newPositionInfo)
Setter function for property with the same name.
auto positionInfo() const -> Positioning::PositionInfo
Getter method for property with the same name.
TrafficFactor_WithPosition(QObject *parent=nullptr)
Default constructor.
void copyFrom(const TrafficFactor_WithPosition &other)
Copy data from other object.
Convenience class for distance computations.
Definition Distance.h:35