23#include <QObjectBindableProperty>
26#include "units/Distance.h"
28using namespace std::chrono_literals;
262 [[nodiscard]]
int alarmLevel()
const {
return m_alarmLevel.value();}
274 [[nodiscard]]
bool animate()
const {
return m_animate.value();}
286 [[nodiscard]] QString
callSign()
const {
return m_callSign.value();}
298 [[nodiscard]] QString
color()
const {
return m_color.value();}
310 [[nodiscard]] QString
description()
const {
return m_description.value();}
334 [[nodiscard]] QString
ID()
const {
return m_ID.value();}
340 [[nodiscard]] QBindable<QString>
bindableID()
const {
return &m_ID;}
346 [[nodiscard]]
bool relevant()
const {
return m_relevant.value();}
376 [[nodiscard]] QBindable<TrafficFactor_Abstract::Type>
bindableType() {
return &m_type;}
382 [[nodiscard]] QString
typeString()
const {
return m_typeString.value();}
394 [[nodiscard]]
bool valid()
const {
return m_valid.value();}
426 if ((newAlarmLevel < 0) || (newAlarmLevel > 3)) {
430 m_alarmLevel = newAlarmLevel;
437 void setCallSign(
const QString& newCallSign) {m_callSign = newCallSign;}
449 void setID(
const QString& newID) {m_ID = newID;}
492 QProperty<bool> m_valid {
false};
494 QProperty<QString> m_description;
497 QProperty<bool> m_validAbstractTrafficFactor;
568 QProperty<int> m_alarmLevel {0};
569 QProperty<bool> m_animate {
false};
570 QProperty<QString> m_callSign;
571 QProperty<QString> m_color {QStringLiteral(
"red")};
572 QProperty<Units::Distance> m_hDist;
573 QProperty<QString> m_ID;
574 QProperty<Type> m_type {
unknown};
575 QProperty<bool> m_relevant {
false};
576 QProperty<QString> m_relevantString;
577 QProperty<QString> m_typeString;
578 QProperty<Units::Distance> m_vDist;
585 QTimer lifetimeCounter;
QBindable< TrafficFactor_Abstract::Type > bindableType()
Getter method for property with the same name.
static constexpr qsizetype idMatchLength
Number of characters in ICAO HEX IDs.
QString typeString() const
Getter method for property with the same name.
QBindable< QString > bindableRelevantString()
Getter method for property with the same name.
void startLifetime()
Starts or extends the lifetime of this object.
QBindable< QString > bindableTypeString()
Getter method for property with the same name.
QString ID
Identifier string of the traffic.
Units::Distance vDist
Vertical distance from own position to the traffic, at the time of report.
void setCallSign(const QString &newCallSign)
Setter function for property with the same name.
QBindable< QString > bindableDescription() const
Getter method for property with the same name.
Type type
Type of aircraft, as reported by the traffic receiver.
QString description
Description of the traffic, for use in GUI.
static constexpr auto lifetime
Length of lifetime for objects of this class.
void setVDist(Units::Distance newVDist)
Setter function for property with the same name.
int alarmLevel
Alarm Level.
QString callSign() const
Getter method for property with the same name.
bool relevant
Indicates relevant traffic.
QString relevantString() const
Getter method for property with the same name.
TrafficFactor_Abstract::Type type() const
Getter method for property with the same name.
QString description() const
Getter method for property with the same name.
QBindable< bool > bindableAnimate()
Getter method for property with the same name.
QString relevantString
Translated string containing the 'relevant' property.
QBindable< QString > bindableCallSign() const
Getter method for property with the same name.
void setHDist(Units::Distance newHDist)
Setter function for property with the same name.
QString ID() const
Getter method for property with the same name.
void setAlarmLevel(int newAlarmLevel)
Setter function for property with the same name.
bool relevant() const
Getter method for property with the same name.
QBindable< Units::Distance > bindableVDist()
Getter method for property with the same name.
Units::Distance hDist
Horizontal distance from own position to the traffic, at the time of report.
bool hasHigherPriorityThan(const TrafficFactor_Abstract &rhs) const
Estimates if this traffic object has higher priority than other traffic object.
QString color
Suggested color for GUI representation of the traffic.
Units::Distance hDist() const
Getter method for property with the same name.
void setType(TrafficFactor_Abstract::Type newType)
Setter function for property with the same name.
QString callSign
Call sign.
QString color() const
Getter method for property with the same name.
QBindable< QString > bindableColor() const
Getter method for property with the same name.
bool isSameFactorAs(const TrafficFactorData &data) const
Check whether a data record refers to the same factor as *this.
QBindable< bool > bindableValid()
Getter method for property with the same name.
static bool isRelevant(Units::Distance hDist, Units::Distance vDist)
Relevance criterion shared by the "relevant" property and priority logic.
void replaceBy(const TrafficFactorData &data)
Replace this object by a different traffic factor.
QBindable< Units::Distance > bindableHDist()
Getter method for property with the same name.
QBindable< int > bindableAlarmLevel()
Getter method for property with the same name.
static constexpr Units::Distance maxVerticalDistance
Maximal vertical distance for relevant traffic.
QBindable< bool > bindableRelevant()
Getter method for property with the same name.
QString typeString
Type of aircraft, as reported by the traffic receiver.
TrafficFactor_Abstract(QObject *parent=nullptr)
Default constructor.
void updateFrom(const TrafficFactorData &data)
Update this object with newer data for the same traffic factor.
static constexpr Units::Distance maxHorizontalDistance
Maximal horizontal distance for relevant traffic.
Units::Distance vDist() const
Getter method for property with the same name.
bool valid() const
Getter method for property with the same name.
QBindable< QString > bindableID() const
Getter method for property with the same name.
bool animate() const
Getter method for property with the same name.
bool animate
Indicates if changes in properties should be animated in the GUI.
void setID(const QString &newID)
Setter function for property with the same name.
Convenience class for distance computations.
static Q_INVOKABLE constexpr Units::Distance fromNM(double distanceInNM)
Constructs a distance.
static Q_INVOKABLE constexpr Units::Distance fromM(double distanceInM)
Constructs a distance.
Conversion between units used in aviation.
Plain-data record of a traffic factor.