Ref T129, formatting aircraft parts/situation

This commit is contained in:
Klaus Basan
2017-09-30 20:14:55 +02:00
committed by Mathew Sutcliffe
parent bfa3908a99
commit db9236a266
4 changed files with 124 additions and 189 deletions

View File

@@ -42,21 +42,15 @@ namespace BlackMisc
if (index.isMyself()) { return CVariant::from(*this); } if (index.isMyself()) { return CVariant::from(*this); }
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexEngines: case IndexEngines: return CVariant::fromValue(m_engines);
return CVariant::fromValue(this->m_engines); case IndexFlapsPercentage: return CVariant::fromValue(m_flapsPercentage);
case IndexFlapsPercentage: case IndexGearDown: return CVariant::fromValue(m_gearDown);
return CVariant::fromValue(this->m_flapsPercentage); case IndexLights: return m_lights.propertyByIndex(index.copyFrontRemoved());
case IndexGearDown: case IndexSpoilersOut: return CVariant::fromValue(m_spoilersOut);
return CVariant::fromValue(this->m_gearDown); default: return CValueObject::propertyByIndex(index);
case IndexLights:
return this->m_lights.propertyByIndex(index.copyFrontRemoved());
case IndexSpoilersOut:
return CVariant::fromValue(this->m_spoilersOut);
default:
return CValueObject::propertyByIndex(index);
} }
} }
@@ -65,27 +59,15 @@ namespace BlackMisc
if (index.isMyself()) { (*this) = variant.to<CAircraftParts>(); return; } if (index.isMyself()) { (*this) = variant.to<CAircraftParts>(); return; }
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; }
ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexEngines: case IndexEngines: m_engines = variant.to < decltype(m_engines) > (); break;
this->m_engines = variant.to < decltype(this->m_engines) > (); case IndexFlapsPercentage: m_flapsPercentage = variant.toInt(); break;
break; case IndexGearDown: m_gearDown = variant.toBool(); break;
case IndexFlapsPercentage: case IndexLights: m_lights.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
this->m_flapsPercentage = variant.toInt(); case IndexSpoilersOut: m_spoilersOut = variant.toBool(); break;
break; default: CValueObject::setPropertyByIndex(index, variant); break;
case IndexGearDown:
this->m_gearDown = variant.toBool();
break;
case IndexLights:
this->m_lights.setPropertyByIndex(index.copyFrontRemoved(), variant);
break;
case IndexSpoilersOut:
this->m_spoilersOut = variant.toBool();
break;
default:
CValueObject::setPropertyByIndex(index, variant);
break;
} }
} }
@@ -94,21 +76,15 @@ namespace BlackMisc
if (index.isMyself()) { return ITimestampBased::comparePropertyByIndex(CPropertyIndex(), compareValue); } if (index.isMyself()) { return ITimestampBased::comparePropertyByIndex(CPropertyIndex(), compareValue); }
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue); }
ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexEngines: case IndexEngines: return Compare::compare(this->getEnginesCount(), compareValue.getEnginesCount());
return Compare::compare(this->getEnginesCount(), compareValue.getEnginesCount()); case IndexFlapsPercentage: return Compare::compare(m_flapsPercentage, compareValue.getFlapsPercent());
case IndexFlapsPercentage: case IndexGearDown: return Compare::compare(m_gearDown, compareValue.isGearDown());
return Compare::compare(this->m_flapsPercentage, compareValue.getFlapsPercent()); case IndexSpoilersOut: return Compare::compare(m_spoilersOut, compareValue.isSpoilersOut());
case IndexGearDown:
return Compare::compare(this->m_gearDown, compareValue.isGearDown());
case IndexLights: case IndexLights:
break; default: break;
case IndexSpoilersOut:
return Compare::compare(this->m_spoilersOut, compareValue.isSpoilersOut());
default:
break;
} }
Q_ASSERT_X(false, Q_FUNC_INFO, "No comparison"); Q_ASSERT_X(false, Q_FUNC_INFO, "No comparison");
return 0; return 0;
@@ -126,26 +102,26 @@ namespace BlackMisc
CAircraftEngine CAircraftParts::getEngine(int number) const CAircraftEngine CAircraftParts::getEngine(int number) const
{ {
return this->m_engines.getEngine(number); return m_engines.getEngine(number);
} }
bool CAircraftParts::isEngineOn(int number) const bool CAircraftParts::isEngineOn(int number) const
{ {
return this->m_engines.isEngineOn(number); return m_engines.isEngineOn(number);
} }
bool CAircraftParts::isAnyEngineOn() const bool CAircraftParts::isAnyEngineOn() const
{ {
return this->m_engines.isAnyEngineOn(); return m_engines.isAnyEngineOn();
} }
double CAircraftParts::isOnGroundInterpolated() const double CAircraftParts::isOnGroundInterpolated() const
{ {
if (this->m_isOnGroundInterpolated < 0) if (m_isOnGroundInterpolated < 0)
{ {
return this->m_isOnGround ? 1.0 : 0.0; return m_isOnGround ? 1.0 : 0.0;
} }
return this->m_isOnGroundInterpolated; return m_isOnGroundInterpolated;
} }
} // namespace } // namespace

View File

@@ -32,7 +32,7 @@ namespace BlackMisc
//! Value object encapsulating information of aircraft's parts //! Value object encapsulating information of aircraft's parts
class BLACKMISC_EXPORT CAircraftParts : class BLACKMISC_EXPORT CAircraftParts :
public CValueObject<CAircraftParts>, public CValueObject<CAircraftParts>,
public BlackMisc::ITimestampBased public ITimestampBased
{ {
public: public:
//! Properties by index //! Properties by index
@@ -126,10 +126,10 @@ namespace BlackMisc
void setOnGroundInterpolated(double onGround) { m_isOnGroundInterpolated = onGround; } void setOnGroundInterpolated(double onGround) { m_isOnGroundInterpolated = onGround; }
//! Milliseconds to add to timestamp for interpolation //! Milliseconds to add to timestamp for interpolation
void setTimeOffsetMs(qint64 offset) { this->m_timeOffsetMs = offset; } void setTimeOffsetMs(qint64 offset) { m_timeOffsetMs = offset; }
//! Milliseconds to add to timestamp for interpolation //! Milliseconds to add to timestamp for interpolation
qint64 getTimeOffsetMs() const { return this->m_timeOffsetMs; } qint64 getTimeOffsetMs() const { return m_timeOffsetMs; }
//! Timestamp with offset added for interpolation //! Timestamp with offset added for interpolation
qint64 getAdjustedMSecsSinceEpoch() const { return this->getMSecsSinceEpoch() + this->getTimeOffsetMs(); } qint64 getAdjustedMSecsSinceEpoch() const { return this->getMSecsSinceEpoch() + this->getTimeOffsetMs(); }

View File

@@ -42,12 +42,12 @@ namespace BlackMisc
QString CAircraftSituation::convertToQString(bool i18n) const QString CAircraftSituation::convertToQString(bool i18n) const
{ {
const QString s = (this->m_position.toQString(i18n)) % const QString s = (m_position.toQString(i18n)) %
QLatin1String(" bank: ") % (this->m_bank.toQString(i18n)) % QLatin1String(" bank: ") % (m_bank.toQString(i18n)) %
QLatin1String(" pitch: ") % (this->m_pitch.toQString(i18n)) % QLatin1String(" pitch: ") % (m_pitch.toQString(i18n)) %
QLatin1String(" gs: ") % (this->m_groundSpeed.toQString(i18n)) % QLatin1String(" gs: ") % (m_groundSpeed.toQString(i18n)) %
QLatin1String(" elevation: ") % (this->m_groundElevation.toQString(i18n)) % QLatin1String(" elevation: ") % (m_groundElevation.toQString(i18n)) %
QLatin1String(" heading: ") % (this->m_heading.toQString(i18n)) % QLatin1String(" heading: ") % (m_heading.toQString(i18n)) %
QLatin1String(" timestamp: ") % (this->hasValidTimestamp() ? this->getFormattedUtcTimestampDhms() : QStringLiteral("-")); QLatin1String(" timestamp: ") % (this->hasValidTimestamp() ? this->getFormattedUtcTimestampDhms() : QStringLiteral("-"));
return s; return s;
} }
@@ -97,36 +97,21 @@ namespace BlackMisc
const ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexPosition: case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved());
return this->m_position.propertyByIndex(index.copyFrontRemoved()); case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved());
case IndexLatitude: case IndexLongitude: return this->longitude().propertyByIndex(index.copyFrontRemoved());
return this->latitude().propertyByIndex(index.copyFrontRemoved()); case IndexAltitude: return this->getAltitude().propertyByIndex(index.copyFrontRemoved());
case IndexLongitude: case IndexHeading: return m_heading.propertyByIndex(index.copyFrontRemoved());
return this->longitude().propertyByIndex(index.copyFrontRemoved()); case IndexPitch: return m_pitch.propertyByIndex(index.copyFrontRemoved());
case IndexAltitude: case IndexBank: return m_bank.propertyByIndex(index.copyFrontRemoved());
return this->getAltitude().propertyByIndex(index.copyFrontRemoved()); case IndexGroundSpeed: return m_groundSpeed.propertyByIndex(index.copyFrontRemoved());
case IndexHeading: case IndexGroundElevation: return m_groundElevation.propertyByIndex(index.copyFrontRemoved());
return this->m_heading.propertyByIndex(index.copyFrontRemoved()); case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
case IndexPitch: case IndexIsOnGround: return CVariant::fromValue(m_isOnGround);
return this->m_pitch.propertyByIndex(index.copyFrontRemoved()); case IndexIsOnGroundString: return CVariant::fromValue(this->isOnGroundAsString());
case IndexBank: case IndexOnGroundReliability: return CVariant::fromValue(m_onGroundReliability);
return this->m_bank.propertyByIndex(index.copyFrontRemoved()); case IndexOnGroundReliabilityString: return CVariant::fromValue(this->getOnGroundReliabilityAsString());
case IndexGroundSpeed: default: return CValueObject::propertyByIndex(index);
return this->m_groundSpeed.propertyByIndex(index.copyFrontRemoved());
case IndexGroundElevation:
return this->m_groundElevation.propertyByIndex(index.copyFrontRemoved());
case IndexCallsign:
return this->m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
case IndexIsOnGround:
return CVariant::fromValue(m_isOnGround);
case IndexIsOnGroundString:
return CVariant::fromValue(this->isOnGroundAsString());
case IndexOnGroundReliability:
return CVariant::fromValue(m_onGroundReliability);
case IndexOnGroundReliabilityString:
return CVariant::fromValue(this->getOnGroundReliabilityAsString());
default:
return CValueObject::propertyByIndex(index);
} }
} }
@@ -142,33 +127,15 @@ namespace BlackMisc
const ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexPosition: case IndexPosition: m_position.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
this->m_position.setPropertyByIndex(index.copyFrontRemoved(), variant); case IndexPitch: m_pitch.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
break; case IndexBank: m_bank.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexPitch: case IndexGroundSpeed: m_groundSpeed.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
this->m_pitch.setPropertyByIndex(index.copyFrontRemoved(), variant); case IndexGroundElevation: m_groundElevation.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
break; case IndexCallsign: m_correspondingCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexBank: case IndexIsOnGround: m_isOnGround = variant.toInt(); break;
this->m_bank.setPropertyByIndex(index.copyFrontRemoved(), variant); case IndexOnGroundReliability: m_onGroundReliability = variant.toInt(); break;
break; default: CValueObject::setPropertyByIndex(index, variant); break;
case IndexGroundSpeed:
this->m_groundSpeed.setPropertyByIndex(index.copyFrontRemoved(), variant);
break;
case IndexGroundElevation:
this->m_groundElevation.setPropertyByIndex(index.copyFrontRemoved(), variant);
break;
case IndexCallsign:
this->m_correspondingCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant);
break;
case IndexIsOnGround:
this->m_isOnGround = variant.toInt();
break;
case IndexOnGroundReliability:
this->m_onGroundReliability = variant.toInt();
break;
default:
CValueObject::setPropertyByIndex(index, variant);
break;
} }
} }
@@ -179,28 +146,20 @@ namespace BlackMisc
const ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexPosition: case IndexPosition: return m_position.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPosition());
return this->m_position.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPosition()); case IndexAltitude: return this->getAltitude().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getAltitude());
case IndexAltitude: case IndexPitch: return m_pitch.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPitch());
return this->getAltitude().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getAltitude()); case IndexBank: return m_bank.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getBank());
case IndexPitch: case IndexGroundSpeed: return m_groundSpeed.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getGroundSpeed());
return this->m_pitch.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPitch()); case IndexGroundElevation: return m_groundElevation.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getGroundElevation());
case IndexBank: case IndexCallsign: return m_correspondingCallsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign());
return this->m_bank.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getBank());
case IndexGroundSpeed:
return this->m_groundSpeed.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getGroundSpeed());
case IndexGroundElevation:
return this->m_groundElevation.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getGroundElevation());
case IndexCallsign:
return this->m_correspondingCallsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign());
case IndexIsOnGround: case IndexIsOnGround:
case IndexIsOnGroundString: case IndexIsOnGroundString:
return Compare::compare(this->m_isOnGround, compareValue.m_isOnGround); return Compare::compare(m_isOnGround, compareValue.m_isOnGround);
case IndexOnGroundReliability: case IndexOnGroundReliability:
case IndexOnGroundReliabilityString: case IndexOnGroundReliabilityString:
return Compare::compare(this->m_onGroundReliability, compareValue.m_onGroundReliability); return Compare::compare(m_onGroundReliability, compareValue.m_onGroundReliability);
default: default: break;
break;
} }
const QString assertMsg("No comparison for index " + index.toQString()); const QString assertMsg("No comparison for index " + index.toQString());
BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(assertMsg)); BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(assertMsg));
@@ -262,8 +221,8 @@ namespace BlackMisc
void CAircraftSituation::setCallsign(const CCallsign &callsign) void CAircraftSituation::setCallsign(const CCallsign &callsign)
{ {
this->m_correspondingCallsign = callsign; m_correspondingCallsign = callsign;
this->m_correspondingCallsign.setTypeHint(CCallsign::Aircraft); m_correspondingCallsign.setTypeHint(CCallsign::Aircraft);
} }
} // namespace } // namespace
} // namespace } // namespace

View File

@@ -40,13 +40,13 @@ namespace BlackMisc
//! Value object encapsulating information of an aircraft's situation //! Value object encapsulating information of an aircraft's situation
class BLACKMISC_EXPORT CAircraftSituation : class BLACKMISC_EXPORT CAircraftSituation :
public CValueObject<CAircraftSituation>, public CValueObject<CAircraftSituation>,
public BlackMisc::Geo::ICoordinateGeodetic, public BlackMisc::ITimestampBased public Geo::ICoordinateGeodetic, public ITimestampBased
{ {
public: public:
//! Properties by index //! Properties by index
enum ColumnIndex enum ColumnIndex
{ {
IndexPosition = BlackMisc::CPropertyIndex::GlobalIndexCAircraftSituation, IndexPosition = CPropertyIndex::GlobalIndexCAircraftSituation,
IndexLatitude, IndexLatitude,
IndexLongitude, IndexLongitude,
IndexAltitude, IndexAltitude,
@@ -84,42 +84,42 @@ namespace BlackMisc
CAircraftSituation(); CAircraftSituation();
//! Comprehensive constructor //! Comprehensive constructor
CAircraftSituation(const BlackMisc::Geo::CCoordinateGeodetic &position, CAircraftSituation(const Geo::CCoordinateGeodetic &position,
const BlackMisc::Aviation::CHeading &heading = {}, const CHeading &heading = {},
const BlackMisc::PhysicalQuantities::CAngle &pitch = {}, const PhysicalQuantities::CAngle &pitch = {},
const BlackMisc::PhysicalQuantities::CAngle &bank = {}, const PhysicalQuantities::CAngle &bank = {},
const BlackMisc::PhysicalQuantities::CSpeed &gs = {}, const PhysicalQuantities::CSpeed &gs = {},
const BlackMisc::Aviation::CAltitude &groundElevation = { 0, nullptr }); const CAltitude &groundElevation = { 0, nullptr });
//! Comprehensive constructor //! Comprehensive constructor
CAircraftSituation(const BlackMisc::Aviation::CCallsign &correspondingCallsign, CAircraftSituation(const CCallsign &correspondingCallsign,
const BlackMisc::Geo::CCoordinateGeodetic &position, const Geo::CCoordinateGeodetic &position,
const BlackMisc::Aviation::CHeading &heading = {}, const CHeading &heading = {},
const BlackMisc::PhysicalQuantities::CAngle &pitch = {}, const PhysicalQuantities::CAngle &pitch = {},
const BlackMisc::PhysicalQuantities::CAngle &bank = {}, const PhysicalQuantities::CAngle &bank = {},
const BlackMisc::PhysicalQuantities::CSpeed &gs = {}, const PhysicalQuantities::CSpeed &gs = {},
const BlackMisc::Aviation::CAltitude &groundElevation = { 0, nullptr }); const CAltitude &groundElevation = { 0, nullptr });
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex //! \copydoc Mixin::Index::propertyByIndex
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; CVariant propertyByIndex(const CPropertyIndex &index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex //! \copydoc Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
//! Compare by index //! Compare by index
int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituation &compareValue) const; int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituation &compareValue) const;
//! Get position //! Get position
const BlackMisc::Geo::CCoordinateGeodetic &getPosition() const { return this->m_position; } const Geo::CCoordinateGeodetic &getPosition() const { return m_position; }
//! Set position //! Set position
void setPosition(const BlackMisc::Geo::CCoordinateGeodetic &position) { this->m_position = position; } void setPosition(const Geo::CCoordinateGeodetic &position) { m_position = position; }
//! \copydoc Geo::ICoordinateGeodetic::latitude() //! \copydoc Geo::ICoordinateGeodetic::latitude()
virtual BlackMisc::Geo::CLatitude latitude() const override { return this->m_position.latitude(); } virtual Geo::CLatitude latitude() const override { return m_position.latitude(); }
//! \copydoc Geo::ICoordinateGeodetic::longitude() //! \copydoc Geo::ICoordinateGeodetic::longitude()
virtual BlackMisc::Geo::CLongitude longitude() const override { return this->m_position.longitude(); } virtual Geo::CLongitude longitude() const override { return m_position.longitude(); }
//! On ground? //! On ground?
IsOnGround isOnGround() const { return static_cast<CAircraftSituation::IsOnGround>(m_isOnGround); } IsOnGround isOnGround() const { return static_cast<CAircraftSituation::IsOnGround>(m_isOnGround); }
@@ -149,81 +149,81 @@ namespace BlackMisc
QString getOnGroundInfo() const; QString getOnGroundInfo() const;
//! \copydoc Geo::ICoordinateGeodetic::geodeticHeight //! \copydoc Geo::ICoordinateGeodetic::geodeticHeight
const BlackMisc::Aviation::CAltitude &geodeticHeight() const override { return this->m_position.geodeticHeight(); } const CAltitude &geodeticHeight() const override { return m_position.geodeticHeight(); }
//! \copydoc Geo::ICoordinateGeodetic::normalVector //! \copydoc Geo::ICoordinateGeodetic::normalVector
virtual QVector3D normalVector() const override { return this->m_position.normalVector(); } virtual QVector3D normalVector() const override { return m_position.normalVector(); }
//! \copydoc Geo::ICoordinateGeodetic::normalVectorDouble //! \copydoc Geo::ICoordinateGeodetic::normalVectorDouble
virtual std::array<double, 3> normalVectorDouble() const override { return this->m_position.normalVectorDouble(); } virtual std::array<double, 3> normalVectorDouble() const override { return m_position.normalVectorDouble(); }
//! Elevation of the ground directly beneath //! Elevation of the ground directly beneath
const BlackMisc::Aviation::CAltitude &getGroundElevation() const { return this->m_groundElevation; } const CAltitude &getGroundElevation() const { return m_groundElevation; }
//! Is ground elevation value available //! Is ground elevation value available
bool hasGroundElevation() const; bool hasGroundElevation() const;
//! Elevation of the ground directly beneath //! Elevation of the ground directly beneath
void setGroundElevation(const BlackMisc::Aviation::CAltitude &elevation) { this->m_groundElevation = elevation; } void setGroundElevation(const CAltitude &elevation) { m_groundElevation = elevation; }
//! Height above ground. //! Height above ground.
BlackMisc::PhysicalQuantities::CLength getHeightAboveGround() const; PhysicalQuantities::CLength getHeightAboveGround() const;
//! Get heading //! Get heading
const BlackMisc::Aviation::CHeading &getHeading() const { return this->m_heading; } const CHeading &getHeading() const { return m_heading; }
//! Set heading //! Set heading
void setHeading(const BlackMisc::Aviation::CHeading &heading) { this->m_heading = heading; } void setHeading(const CHeading &heading) { m_heading = heading; }
//! Get altitude //! Get altitude
const BlackMisc::Aviation::CAltitude &getAltitude() const { return this->m_position.geodeticHeight(); } const CAltitude &getAltitude() const { return m_position.geodeticHeight(); }
//! Get altitude under consideration of ground elevation //! Get altitude under consideration of ground elevation
BlackMisc::Aviation::CAltitude getCorrectedAltitude() const; CAltitude getCorrectedAltitude() const;
//! Set altitude //! Set altitude
void setAltitude(const BlackMisc::Aviation::CAltitude &altitude) { this->m_position.setGeodeticHeight(altitude); } void setAltitude(const CAltitude &altitude) { m_position.setGeodeticHeight(altitude); }
//! Get pitch //! Get pitch
const BlackMisc::PhysicalQuantities::CAngle &getPitch() const { return this->m_pitch; } const PhysicalQuantities::CAngle &getPitch() const { return m_pitch; }
//! Set pitch //! Set pitch
void setPitch(const BlackMisc::PhysicalQuantities::CAngle &pitch) { this->m_pitch = pitch; } void setPitch(const PhysicalQuantities::CAngle &pitch) { m_pitch = pitch; }
//! Get bank (angle) //! Get bank (angle)
const BlackMisc::PhysicalQuantities::CAngle &getBank() const { return this->m_bank; } const PhysicalQuantities::CAngle &getBank() const { return m_bank; }
//! Set bank (angle) //! Set bank (angle)
void setBank(const BlackMisc::PhysicalQuantities::CAngle &bank) { this->m_bank = bank; } void setBank(const PhysicalQuantities::CAngle &bank) { m_bank = bank; }
//! Get ground speed //! Get ground speed
const BlackMisc::PhysicalQuantities::CSpeed &getGroundSpeed() const { return this->m_groundSpeed; } const PhysicalQuantities::CSpeed &getGroundSpeed() const { return m_groundSpeed; }
//! Set ground speed //! Set ground speed
void setGroundSpeed(const BlackMisc::PhysicalQuantities::CSpeed &groundspeed) { this->m_groundSpeed = groundspeed; } void setGroundSpeed(const PhysicalQuantities::CSpeed &groundspeed) { m_groundSpeed = groundspeed; }
//! Corresponding callsign //! Corresponding callsign
const BlackMisc::Aviation::CCallsign &getCallsign() const { return this->m_correspondingCallsign; } const CCallsign &getCallsign() const { return m_correspondingCallsign; }
//! Corresponding callsign //! Corresponding callsign
void setCallsign(const BlackMisc::Aviation::CCallsign &callsign); void setCallsign(const CCallsign &callsign);
//! Milliseconds to add to timestamp for interpolation //! Milliseconds to add to timestamp for interpolation
void setTimeOffsetMs(qint64 offset) { this->m_timeOffsetMs = offset; } void setTimeOffsetMs(qint64 offset) { m_timeOffsetMs = offset; }
//! Milliseconds to add to timestamp for interpolation //! Milliseconds to add to timestamp for interpolation
qint64 getTimeOffsetMs() const { return this->m_timeOffsetMs; } qint64 getTimeOffsetMs() const { return m_timeOffsetMs; }
//! Timestamp with offset added for interpolation //! Timestamp with offset added for interpolation
qint64 getAdjustedMSecsSinceEpoch() const { return this->getMSecsSinceEpoch() + this->getTimeOffsetMs(); } qint64 getAdjustedMSecsSinceEpoch() const { return this->getMSecsSinceEpoch() + this->getTimeOffsetMs(); }
//! Set flag indicating this is an interim position update //! Set flag indicating this is an interim position update
void setInterimFlag(bool flag) { this->m_isInterim = flag; } void setInterimFlag(bool flag) { m_isInterim = flag; }
//! Get flag indicating this is an interim position update //! Get flag indicating this is an interim position update
bool isInterim() const { return this->m_isInterim; } bool isInterim() const { return m_isInterim; }
//! \copydoc BlackMisc::Mixin::String::toQString //! \copydoc Mixin::String::toQString
QString convertToQString(bool i18n = false) const; QString convertToQString(bool i18n = false) const;
//! Enum to string //! Enum to string
@@ -234,12 +234,12 @@ namespace BlackMisc
private: private:
CCallsign m_correspondingCallsign; CCallsign m_correspondingCallsign;
BlackMisc::Geo::CCoordinateGeodetic m_position; Geo::CCoordinateGeodetic m_position;
BlackMisc::Aviation::CHeading m_heading; CHeading m_heading;
BlackMisc::PhysicalQuantities::CAngle m_pitch; PhysicalQuantities::CAngle m_pitch;
BlackMisc::PhysicalQuantities::CAngle m_bank; PhysicalQuantities::CAngle m_bank;
BlackMisc::PhysicalQuantities::CSpeed m_groundSpeed; PhysicalQuantities::CSpeed m_groundSpeed;
BlackMisc::Aviation::CAltitude m_groundElevation{0, BlackMisc::Aviation::CAltitude::MeanSeaLevel, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()}; CAltitude m_groundElevation{0, CAltitude::MeanSeaLevel, PhysicalQuantities::CLengthUnit::nullUnit()};
int m_isOnGround = static_cast<int>(CAircraftSituation::OnGroundSituationUnknown); int m_isOnGround = static_cast<int>(CAircraftSituation::OnGroundSituationUnknown);
int m_onGroundReliability = static_cast<int>(CAircraftSituation::OnGroundReliabilityNoSet); int m_onGroundReliability = static_cast<int>(CAircraftSituation::OnGroundReliabilityNoSet);
qint64 m_timeOffsetMs = 0; qint64 m_timeOffsetMs = 0;