Enroute Flight Navigation
A navigation app for VFR pilots
Traffic::TrafficFactor_DistanceOnly Class Reference

Traffic factor whose distance is known, but not its bearing. More...

#include <TrafficFactor_DistanceOnly.h>

Inheritance diagram for Traffic::TrafficFactor_DistanceOnly:
Traffic::TrafficFactor_Abstract

Public Member Functions

 TrafficFactor_DistanceOnly (QObject *parent=nullptr)
 Default constructor.
bool updateFrom (const TrafficFactorData_DistanceOnly &data)
 Offer a data record to this object, for the same traffic factor.
void replaceBy (const TrafficFactorData_DistanceOnly &data)
 Replace this object by a different traffic factor.
QGeoCoordinate coordinate () const
 Getter method for property with the same name.
QBindable< QGeoCoordinate > bindableCoordinate () const
 Getter method for property with the same name.
void setCoordinate (const QGeoCoordinate &newCoordinate)
 Setter function for property with the same name.
Units::Distance range () const
 Getter method for property with the same name.
QBindable< Units::DistancebindableRange ()
 Getter method for property with the same name.
Public Member Functions inherited from Traffic::TrafficFactor_Abstract
 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::DistancebindableHDist ()
 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::TypebindableType ()
 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::DistancebindableVDist ()
 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.

Properties

QGeoCoordinate coordinate
 Center coordinate of the range ring.
Units::Distance range
 Range to the traffic — the radius of the range ring.
Properties inherited from Traffic::TrafficFactor_Abstract
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.

Additional Inherited Members

Public Types inherited from Traffic::TrafficFactor_Abstract
enum  Type : quint8 {
  unknown , Aircraft , Airship , Balloon ,
  Copter , Drone , Glider , HangGlider ,
  Jet , Paraglider , Skydiver , StaticObstacle ,
  TowPlane
}
 Aircraft type. More...
Static Public Member Functions inherited from Traffic::TrafficFactor_Abstract
static bool isRelevant (Units::Distance hDist, Units::Distance vDist)
 Relevance criterion shared by the "relevant" property and priority logic.
Static Public Attributes inherited from Traffic::TrafficFactor_Abstract
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 inherited from Traffic::TrafficFactor_Abstract
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 inherited from Traffic::TrafficFactor_Abstract
static constexpr qsizetype idMatchLength = 6
 Number of characters in ICAO HEX IDs.

Detailed Description

Traffic factor whose distance is known, but not its bearing.

Objects of this class represent traffic factors for which only the distance to the traffic is known, not its bearing. This is typically the case for aircraft seen through a Mode-S transponder, which reports altitude and range but no position.

Geometrically, such a factor is described by a horizontal range ring: the traffic is somewhere on a circle of radius range(), centered at coordinate() — the ownship position at the time of report — and offset vertically by vDist(). Compared to TrafficFactor_Abstract, this class therefore adds the property coordinate (the center of the ring); the radius is exposed as range().

Note that a finite range() is required for the factor to be valid (see the binding of the "valid" property), so a distance-only factor can only be shown when both the range and the ownship position are known.

Definition at line 50 of file TrafficFactor_DistanceOnly.h.

Constructor & Destructor Documentation

◆ TrafficFactor_DistanceOnly()

Traffic::TrafficFactor_DistanceOnly::TrafficFactor_DistanceOnly ( QObject * parent = nullptr)
explicit

Default constructor.

Parameters
parentThe standard QObject parent pointer

Member Function Documentation

◆ bindableCoordinate()

QBindable< QGeoCoordinate > Traffic::TrafficFactor_DistanceOnly::bindableCoordinate ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property coordinate

Definition at line 142 of file TrafficFactor_DistanceOnly.h.

◆ bindableRange()

QBindable< Units::Distance > Traffic::TrafficFactor_DistanceOnly::bindableRange ( )
inlinenodiscard

Getter method for property with the same name.

Returns
Property range

Definition at line 178 of file TrafficFactor_DistanceOnly.h.

◆ coordinate()

QGeoCoordinate Traffic::TrafficFactor_DistanceOnly::coordinate ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property coordinate

Definition at line 136 of file TrafficFactor_DistanceOnly.h.

◆ range()

Units::Distance Traffic::TrafficFactor_DistanceOnly::range ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property range

Definition at line 172 of file TrafficFactor_DistanceOnly.h.

◆ replaceBy()

void Traffic::TrafficFactor_DistanceOnly::replaceBy ( const TrafficFactorData_DistanceOnly & data)
inline

Replace this object by a different traffic factor.

This method is for the case where this is repurposed to represent a *different position-less factor, namely the one described by data — typically after updateFrom() has declined the record. The coordinate is taken over and the remaining properties are replaced through TrafficFactor_Abstract::replaceBy().

Parameters
dataData record whose contents replace the data of *this

Definition at line 112 of file TrafficFactor_DistanceOnly.h.

◆ setCoordinate()

void Traffic::TrafficFactor_DistanceOnly::setCoordinate ( const QGeoCoordinate & newCoordinate)
inline

Setter function for property with the same name.

Parameters
newCoordinateProperty coordinate

Definition at line 148 of file TrafficFactor_DistanceOnly.h.

◆ updateFrom()

bool Traffic::TrafficFactor_DistanceOnly::updateFrom ( const TrafficFactorData_DistanceOnly & data)
inlinenodiscard

Offer a data record to this object, for the same traffic factor.

This method checks whether data describes the same traffic factor as *this, by comparing identifiers. The intended use is that the caller offers a freshly received record and falls back to replaceBy() if it is declined.

  • If data refers to a different factor, it is declined and *this is left unchanged.
  • If data refers to the same factor, it is accepted: the coordinate is taken over and the remaining properties are updated through TrafficFactor_Abstract::updateFrom(), so that the transition is animated (e.g. the range ring grows or shrinks smoothly as the target moves).
Parameters
dataData record offered to *this
Returns
True if data refers to the same factor and was accepted here, false if it refers to a different factor and was declined

Definition at line 88 of file TrafficFactor_DistanceOnly.h.

Property Documentation

◆ coordinate

QGeoCoordinate Traffic::TrafficFactor_DistanceOnly::coordinate
readwrite

Center coordinate of the range ring.

This property contains the center of the range ring, that is, the ownship position at the time of report. The traffic is located somewhere on the circle of radius range() around this coordinate.

Definition at line 130 of file TrafficFactor_DistanceOnly.h.

◆ range

Units::Distance Traffic::TrafficFactor_DistanceOnly::range
read

Range to the traffic — the radius of the range ring.

This property holds the horizontal distance from the ownship to the traffic, i.e. the radius of the range ring described in the class documentation. It is the defining datum of a distance-only factor: it is reported by the traffic receiver and set, together with the other data, through replaceBy() (which forwards to TrafficFactor_Abstract::replaceBy() and thus to setHDist()). A finite range is required for the factor to be valid.

range() is the first-class, well-named view of the distance for this class. It is backed by the inherited hDist property and always holds the same value; hDist is retained because the base class TrafficFactor_Abstract uses it for the "valid" property and for priority comparisons.

Definition at line 166 of file TrafficFactor_DistanceOnly.h.


The documentation for this class was generated from the following file: