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

Traffic factor whose precise position is known. More...

#include <TrafficFactor_WithPosition.h>

Inheritance diagram for Traffic::TrafficFactor_WithPosition:
Traffic::TrafficFactor_Abstract

Public Slots

void updateExtrapolatedData ()
 Update extrapolated data.

Signals

void positionInfoChanged ()
 Notifier signal.

Public Member Functions

 TrafficFactor_WithPosition (QObject *parent=nullptr)
 Default constructor.
bool updateFrom (const TrafficFactorData_WithPosition &data)
 Offer a data record to this object, for the same traffic factor.
void replaceBy (const TrafficFactorData_WithPosition &data)
 Replace this object by a different traffic factor.
QGeoCoordinate extrapolatedCoordinate () const
 Getter method for property with the same name.
QBindable< QGeoCoordinate > bindableExtrapolatedCoordinate () const
 Getter method for property with the same name.
Units::Angle extrapolatedTrueTrack () const
 Getter method for property with the same name.
QBindable< Units::AnglebindableExtrapolatedTrueTrack () const
 Getter method for property with the same name.
QString icon () const
 Getter method for property with the same name.
QBindable< QString > bindableIcon () const
 Getter method for property with the same name.
Positioning::PositionInfo positionInfo () const
 Getter method for property with the same name.
QBindable< Positioning::PositionInfobindablePositionInfo () const
 Getter method for property with the same name.
void setPositionInfo (const Positioning::PositionInfo &newPositionInfo)
 Setter function for property with the same name.
Units::Distance uncertaintyRadius () const
 Getter method for property with the same name.
QBindable< Units::DistancebindableUncertaintyRadius () const
 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 extrapolatedCoordinate
 Extrapolated Coordinate.
Units::Angle extrapolatedTrueTrack
 Extrapolated True Track.
QString icon
 Suggested icon.
Positioning::PositionInfo positionInfo
 PositionInfo of the traffic.
Units::Distance uncertaintyRadius
 Uncertainty radius.
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 precise position is known.

Objects of this class represent traffic factors whose precise position is known. Other properties of the traffic, such as heading and ground speed, might also be known. Compared to TrafficFactor_Abstract, instances of this class hold an important additional property, namely the positionInfo for the traffic.

Definition at line 40 of file TrafficFactor_WithPosition.h.

Constructor & Destructor Documentation

◆ TrafficFactor_WithPosition()

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

Default constructor.

Parameters
parentThe standard QObject parent pointer

Member Function Documentation

◆ bindableExtrapolatedCoordinate()

QBindable< QGeoCoordinate > Traffic::TrafficFactor_WithPosition::bindableExtrapolatedCoordinate ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property extrapolatedCoordinate

Definition at line 155 of file TrafficFactor_WithPosition.h.

◆ bindableExtrapolatedTrueTrack()

QBindable< Units::Angle > Traffic::TrafficFactor_WithPosition::bindableExtrapolatedTrueTrack ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property extrapolatedTrueTrack

Definition at line 179 of file TrafficFactor_WithPosition.h.

◆ bindableIcon()

QBindable< QString > Traffic::TrafficFactor_WithPosition::bindableIcon ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property icon

Definition at line 198 of file TrafficFactor_WithPosition.h.

◆ bindablePositionInfo()

QBindable< Positioning::PositionInfo > Traffic::TrafficFactor_WithPosition::bindablePositionInfo ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property positionInfo

Definition at line 213 of file TrafficFactor_WithPosition.h.

◆ bindableUncertaintyRadius()

QBindable< Units::Distance > Traffic::TrafficFactor_WithPosition::bindableUncertaintyRadius ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property uncertaintyRadius

Definition at line 245 of file TrafficFactor_WithPosition.h.

◆ extrapolatedCoordinate()

QGeoCoordinate Traffic::TrafficFactor_WithPosition::extrapolatedCoordinate ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property extrapolatedCoordinate

Definition at line 149 of file TrafficFactor_WithPosition.h.

◆ extrapolatedTrueTrack()

Units::Angle Traffic::TrafficFactor_WithPosition::extrapolatedTrueTrack ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property extrapolatedTrueTrack

Definition at line 173 of file TrafficFactor_WithPosition.h.

◆ icon()

QString Traffic::TrafficFactor_WithPosition::icon ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property icon

Definition at line 192 of file TrafficFactor_WithPosition.h.

◆ positionInfo()

Positioning::PositionInfo Traffic::TrafficFactor_WithPosition::positionInfo ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property positionInfo

Definition at line 207 of file TrafficFactor_WithPosition.h.

◆ replaceBy()

void Traffic::TrafficFactor_WithPosition::replaceBy ( const TrafficFactorData_WithPosition & data)
inline

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. It takes over the positionInfo of data and replaces the remaining properties through TrafficFactor_Abstract::replaceBy().

Parameters
dataData record whose contents replace the data of *this

Definition at line 113 of file TrafficFactor_WithPosition.h.

◆ setPositionInfo()

void Traffic::TrafficFactor_WithPosition::setPositionInfo ( const Positioning::PositionInfo & newPositionInfo)
inline

Setter function for property with the same name.

Note
Setting a new position info does not update the hDist or vDist properties.
Parameters
newPositionInfoProperty positionInfo

Definition at line 222 of file TrafficFactor_WithPosition.h.

◆ uncertaintyRadius()

Units::Distance Traffic::TrafficFactor_WithPosition::uncertaintyRadius ( ) const
inlinenodiscard

Getter method for property with the same name.

Returns
Property uncertaintyRadius

Definition at line 239 of file TrafficFactor_WithPosition.h.

◆ updateExtrapolatedData

void Traffic::TrafficFactor_WithPosition::updateExtrapolatedData ( )
slot

Update extrapolated data.

This method extrapolates the position of the aircraft and sets the property extrapolatedCoordinate appropriately.

◆ updateFrom()

bool Traffic::TrafficFactor_WithPosition::updateFrom ( const TrafficFactorData_WithPosition & 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 a caller offers a freshly received record to each of its traffic objects in turn until one accepts it.

  • 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 record is then adopted only if it is newer than the data already held here: unless the timestamp of the positionInfo of data is strictly newer than the timestamp of the positionInfo of this, the record is considered stale or out-of-order and *this is left unchanged (its lifetime is not restarted either). A stale record is still *accepted — it belongs to this object, there is simply nothing newer to apply.

When the record is adopted, the positionInfo is taken over and the remaining properties are updated through TrafficFactor_Abstract::updateFrom(); see there for how the "animate" property, callsign and type are handled.

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 85 of file TrafficFactor_WithPosition.h.

Property Documentation

◆ extrapolatedCoordinate

QGeoCoordinate Traffic::TrafficFactor_WithPosition::extrapolatedCoordinate
read

Extrapolated Coordinate.

Extrapolated coordinate of the traffic, for use in the GUI. For performance reasons, instances of this class do not have their own timer/animation logic to update the property. Instead, the property is set whenever the positionInfo changes and whenever the slot updatedExtrapolatedData() is called. The owner of this class (= TrafficDataProvider) is responsible to call updatedExtrapolatedData() at regular intervals.

Definition at line 143 of file TrafficFactor_WithPosition.h.

◆ extrapolatedTrueTrack

Units::Angle Traffic::TrafficFactor_WithPosition::extrapolatedTrueTrack
read

Extrapolated True Track.

Extrapolated true track of the traffic, for use in the GUI. For performance reasons, instances of this class do not have their own timer/animation logic to update the property. Instead, the property is set whenever the positionInfo changes and whenever the slot updatedExtrapolatedData() is called. The owner of this class (= TrafficDataProvider) is responsible to call updatedExtrapolatedData() at regular intervals.

Definition at line 167 of file TrafficFactor_WithPosition.h.

◆ icon

QString Traffic::TrafficFactor_WithPosition::icon
read

Suggested icon.

Depending on alarm level, type and movement of the traffic opponent, this property suggests an icon for GUI representation of the traffic.

Definition at line 186 of file TrafficFactor_WithPosition.h.

◆ uncertaintyRadius

Units::Distance Traffic::TrafficFactor_WithPosition::uncertaintyRadius
read

Uncertainty radius.

If the last position update is less than 30s ago, this property holds the value zero. If the last position update is more than 30s ago, this property holds the radius of the "uncertainty circle" that should be drawn around the extrapolated position, to notify the user that the position data is stale. The radius is also zero when the object is invalid or has no finite groundSpeed/trueTrack.

Definition at line 233 of file TrafficFactor_WithPosition.h.


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