|
Enroute Flight Navigation
A navigation app for VFR pilots
|
Abstract base class for traffic factors. More...
#include <TrafficFactor_Abstract.h>
Public Types | |
| enum | Type : quint8 { unknown , Aircraft , Airship , Balloon , Copter , Drone , Glider , HangGlider , Jet , Paraglider , Skydiver , StaticObstacle , TowPlane } |
| Aircraft type. More... | |
Public Member Functions | |
| TrafficFactor_Abstract (QObject *parent=nullptr) | |
| Default constructor. | |
| bool | hasHigherPriorityThan (const TrafficFactor_Abstract &rhs) const |
| Estimates if this traffic object has higher priority than other traffic object. | |
| void | startLifetime () |
| Starts or extends the lifetime of this object. | |
| int | alarmLevel () const |
| Getter method for property with the same name. | |
| QBindable< int > | bindableAlarmLevel () |
| Getter method for property with the same name. | |
| bool | animate () const |
| Getter method for property with the same name. | |
| QBindable< bool > | bindableAnimate () |
| Getter method for property with the same name. | |
| QString | callSign () const |
| Getter method for property with the same name. | |
| QBindable< QString > | bindableCallSign () const |
| Getter method for property with the same name. | |
| QString | color () const |
| Getter method for property with the same name. | |
| QBindable< QString > | bindableColor () const |
| Getter method for property with the same name. | |
| QString | description () const |
| Getter method for property with the same name. | |
| QBindable< QString > | bindableDescription () const |
| Getter method for property with the same name. | |
| Units::Distance | hDist () const |
| Getter method for property with the same name. | |
| QBindable< Units::Distance > | bindableHDist () |
| Getter method for property with the same name. | |
| QString | ID () const |
| Getter method for property with the same name. | |
| QBindable< QString > | bindableID () const |
| Getter method for property with the same name. | |
| bool | relevant () const |
| Getter method for property with the same name. | |
| QBindable< bool > | bindableRelevant () |
| Getter method for property with the same name. | |
| QString | relevantString () const |
| Getter method for property with the same name. | |
| QBindable< QString > | bindableRelevantString () |
| Getter method for property with the same name. | |
| TrafficFactor_Abstract::Type | type () const |
| Getter method for property with the same name. | |
| QBindable< TrafficFactor_Abstract::Type > | bindableType () |
| Getter method for property with the same name. | |
| QString | typeString () const |
| Getter method for property with the same name. | |
| QBindable< QString > | bindableTypeString () |
| Getter method for property with the same name. | |
| bool | valid () const |
| Getter method for property with the same name. | |
| QBindable< bool > | bindableValid () |
| Getter method for property with the same name. | |
| Units::Distance | vDist () const |
| Getter method for property with the same name. | |
| QBindable< Units::Distance > | bindableVDist () |
| Getter method for property with the same name. | |
| void | setAlarmLevel (int newAlarmLevel) |
| Setter function for property with the same name. | |
| void | setCallSign (const QString &newCallSign) |
| Setter function for property with the same name. | |
| void | setHDist (Units::Distance newHDist) |
| Setter function for property with the same name. | |
| void | setID (const QString &newID) |
| Setter function for property with the same name. | |
| void | setType (TrafficFactor_Abstract::Type newType) |
| Setter function for property with the same name. | |
| void | setVDist (Units::Distance newVDist) |
| Setter function for property with the same name. | |
Static Public Member Functions | |
| static bool | isRelevant (Units::Distance hDist, Units::Distance vDist) |
| Relevance criterion shared by the "relevant" property and priority logic. | |
Static Public Attributes | |
| static constexpr auto | lifetime = 45s |
| Length of lifetime for objects of this class. | |
| static constexpr Units::Distance | maxVerticalDistance = Units::Distance::fromM(1500.0) |
| Maximal vertical distance for relevant traffic. | |
| static constexpr Units::Distance | maxHorizontalDistance = Units::Distance::fromNM(20.0) |
| Maximal horizontal distance for relevant traffic. | |
Protected Member Functions | |
| void | updateFrom (const TrafficFactorData &data) |
| Update this object with newer data for the same traffic factor. | |
| void | replaceBy (const TrafficFactorData &data) |
| Replace this object by a different traffic factor. | |
| bool | isSameFactorAs (const TrafficFactorData &data) const |
| Check whether a data record refers to the same factor as *this. | |
Static Protected Attributes | |
| static constexpr qsizetype | idMatchLength = 6 |
| Number of characters in ICAO HEX IDs. | |
Properties | |
| int | alarmLevel |
| Alarm Level. | |
| bool | animate |
| Indicates if changes in properties should be animated in the GUI. | |
| QString | callSign |
| Call sign. | |
| QString | color |
| Suggested color for GUI representation of the traffic. | |
| QString | description |
| Description of the traffic, for use in GUI. | |
| Units::Distance | hDist |
| Horizontal distance from own position to the traffic, at the time of report. | |
| QString | ID |
| Identifier string of the traffic. | |
| bool | relevant |
| Indicates relevant traffic. | |
| QString | relevantString |
| Translated string containing the 'relevant' property. | |
| Type | type |
| Type of aircraft, as reported by the traffic receiver. | |
| QString | typeString |
| Type of aircraft, as reported by the traffic receiver. | |
| bool | valid |
| Validity. | |
| Units::Distance | vDist |
| Vertical distance from own position to the traffic, at the time of report. | |
Abstract base class for traffic factors.
This is an abstract base class for traffic factors, as reported by traffic data receivers (e.g. FLARM devices).
Since the real-world traffic situation changes continuously, instances of this class have a limited lifetime. The length of the lifetime is specified in the constant "lifetime". You can (re)start an object's lifetime startLifetime(). Once the lifetime of an object is expired, the property "valid" will always be false, regardless of the object's other properties.
Classes that inherit from TrafficFactor_Abstract need to provide a binding for the properties 'description' and 'valid'.
Definition at line 51 of file TrafficFactor_Abstract.h.
| enum Traffic::TrafficFactor_Abstract::Type : quint8 |
Aircraft type.
This enum defines a few aircraft types. The list is modeled after the FLARM/NMEA specification.
Definition at line 61 of file TrafficFactor_Abstract.h.
|
explicit |
Default constructor.
| parent | The standard QObject parent pointer |
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 262 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 274 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 268 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 280 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 292 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 304 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 316 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 328 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 340 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 352 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 364 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 376 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 388 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 400 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 412 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 286 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 298 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 310 of file TrafficFactor_Abstract.h.
|
nodiscard |
Estimates if this traffic object has higher priority than other traffic object.
The following criteria are applied in order.
| rhs | Right hand side of the comparison |
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 322 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 334 of file TrafficFactor_Abstract.h.
|
staticnodiscard |
Relevance criterion shared by the "relevant" property and priority logic.
This helper holds the rule that decides whether traffic at the given distances is relevant, i.e. close enough to be worth showing. It is used both by the binding of the "relevant" property and by the free function hasHigherPriorityThan(const TrafficFactorData&, const TrafficFactor_Abstract&), so that both share a single definition.
|
nodiscardprotected |
Check whether a data record refers to the same factor as *this.
Two records describe the same factor exactly if the last idMatchLength characters of their IDs agree. This is the single identity rule shared by the updateFrom() overloads of all subclasses.
| data | Data record to compare against |
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 346 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 358 of file TrafficFactor_Abstract.h.
|
protected |
Replace this object by a different traffic factor.
This method is for the case where this is repurposed to represent a *different traffic factor, namely the one described by data. All properties are overwritten unconditionally and the "animate" property is set to false, since animating a transition between two unrelated factors would be meaningless.
The lifetime of *this is (re)started, so the caller does not need to call startLifetime() separately.
| data | Data record whose contents replace the data of *this |
|
inline |
Setter function for property with the same name.
| newAlarmLevel | Property alarmLevel |
Definition at line 423 of file TrafficFactor_Abstract.h.
|
inline |
Setter function for property with the same name.
| newCallSign | Property callSign |
Definition at line 437 of file TrafficFactor_Abstract.h.
|
inline |
Setter function for property with the same name.
| newHDist | Property hDist |
Definition at line 443 of file TrafficFactor_Abstract.h.
|
inline |
Setter function for property with the same name.
| newID | Property ID |
Definition at line 449 of file TrafficFactor_Abstract.h.
|
inline |
Setter function for property with the same name.
| newType | Property type |
Definition at line 455 of file TrafficFactor_Abstract.h.
|
inline |
Setter function for property with the same name.
| newVDist | Property vDist |
Definition at line 461 of file TrafficFactor_Abstract.h.
| void Traffic::TrafficFactor_Abstract::startLifetime | ( | ) |
Starts or extends the lifetime of this object.
Traffic information is volatile, and is considered valid only for "lifetime" seconds. This method starts or extends the object's lifetime.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 370 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 382 of file TrafficFactor_Abstract.h.
|
protected |
Update this object with newer data for the same traffic factor.
This method is for the case where data describes the same traffic factor as *this, observed again with (typically newer) data. The caller is responsible for establishing that the two refer to the same factor.
Identity data that is already established here is preserved, and the transition is animated:
If there is nothing to continue from — *this is no longer valid, i.e. its track had expired — there is no established identity to preserve and no meaningful transition to animate. The call then degrades to replaceBy().
In all cases the lifetime of *this is (re)started, so the caller does not need to call startLifetime() separately.
| data | Data record whose contents are used to update *this |
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 394 of file TrafficFactor_Abstract.h.
|
inlinenodiscard |
Getter method for property with the same name.
Definition at line 406 of file TrafficFactor_Abstract.h.
|
staticconstexprprotected |
Number of characters in ICAO HEX IDs.
Number of trailing ID characters compared to decide whether two records describe the same factor: the last six hex digits are the ICAO/FLARM device-address suffix.
Definition at line 548 of file TrafficFactor_Abstract.h.
|
staticconstexpr |
Maximal horizontal distance for relevant traffic.
Traffic whose horizontal distance to the own aircraft is larger than this number will be considered irrelevant.
Definition at line 489 of file TrafficFactor_Abstract.h.
|
staticconstexpr |
Maximal vertical distance for relevant traffic.
Traffic whose vertical distance to the own aircraft is larger than this number will be considered irrelevant.
Definition at line 479 of file TrafficFactor_Abstract.h.
|
readwrite |
Alarm Level.
This is the alarm level associated with the traffic object. The alarm level is an integer in the range 0 (no alarm), …, 3 (maximal alarm). The values are not computed by this class, but reported by the traffic receiver that reports the traffic. The precise meaning depends on the type of traffic receiver used.
FLARM
Other
Definition at line 158 of file TrafficFactor_Abstract.h.
|
read |
Indicates if changes in properties should be animated in the GUI.
This boolen properts is used to indicate if changes in properties should be animated in the GUI. This property is typically set to "true" before gradual changes are applied, such as the position change of an aircraft. It is typically set to "false" before data of a new aircraft set.
Definition at line 167 of file TrafficFactor_Abstract.h.
|
readwrite |
Call sign.
If known, this property holds the call sign of the traffic. Otherwise, it contains an empty string
Definition at line 174 of file TrafficFactor_Abstract.h.
|
read |
Suggested color for GUI representation of the traffic.
This propery suggests a color, depending on the alarmLevel.
Definition at line 184 of file TrafficFactor_Abstract.h.
|
read |
Description of the traffic, for use in GUI.
This method holds a human-readable, translated description of the traffic. This is a rich-text string of the form "Glider<br>+15 0m" or "Airship<br>Position unknown<br>-45 ft".
Definition at line 192 of file TrafficFactor_Abstract.h.
|
readwrite |
Horizontal distance from own position to the traffic, at the time of report.
If known, this property holds the horizontal distance from the own position to the traffic, at the time of report. Otherwise, it contains an invalid distance.
Definition at line 200 of file TrafficFactor_Abstract.h.
|
readwrite |
Identifier string of the traffic.
This property holds an identifier string for the traffic, as assigned by the FLARM device that reported the traffic. This can be the FLARM ID, or an empty string if no meaningful ID can be assigned.
Definition at line 208 of file TrafficFactor_Abstract.h.
|
read |
Indicates relevant traffic.
This property holds 'true' if the traffic is valid, and closer than maxVerticalDistance and maxHorizontalDistance specified below.
Definition at line 219 of file TrafficFactor_Abstract.h.
|
read |
Translated string containing the 'relevant' property.
The content of the string is a translated version of "Relevant Traffic" or "Irrelevant Traffic".
Definition at line 226 of file TrafficFactor_Abstract.h.
|
read |
Type of aircraft, as reported by the traffic receiver.
This property holds a translated, human-readable string.
Definition at line 235 of file TrafficFactor_Abstract.h.
|
read |
Validity.
A traffic object is considered valid if the data is meaningful and if the lifetime is not expired. Only valid traffic objects should be shown in the GUI.
Definition at line 243 of file TrafficFactor_Abstract.h.
|
readwrite |
Vertical distance from own position to the traffic, at the time of report.
If known, this property holds the vertical distance from the own position to the traffic, at the time of report. Otherwise, it contains NaN.
Definition at line 251 of file TrafficFactor_Abstract.h.