From ff9d6147c832c7091d6c2138e04262106e894097 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 1 Aug 2018 22:54:05 +0200 Subject: [PATCH] Ref T299, pitch bank heading info --- src/blackgui/models/aircraftsituationlistmodel.cpp | 1 + src/blackmisc/aviation/aircraftsituation.cpp | 14 +++++++++++++- src/blackmisc/aviation/aircraftsituation.h | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/blackgui/models/aircraftsituationlistmodel.cpp b/src/blackgui/models/aircraftsituationlistmodel.cpp index b2ff9e517..55ed38c37 100644 --- a/src/blackgui/models/aircraftsituationlistmodel.cpp +++ b/src/blackgui/models/aircraftsituationlistmodel.cpp @@ -36,6 +36,7 @@ namespace BlackGui m_columns.addColumn(CColumn("latitude", CAircraftSituation::IndexLatitude, new CLatLonFormatter())); m_columns.addColumn(CColumn("longitude", CAircraftSituation::IndexLongitude, new CLatLonFormatter())); m_columns.addColumn(CColumn("gs.", CAircraftSituation::IndexGroundSpeed, new CSpeedKtsFormatter())); + m_columns.addColumn(CColumn::standardString("PBH", "pitch bank heading", CAircraftSituation::IndexPBHInfo)); m_columns.addColumn(CColumn("on gnd.", "is on gnd.", CAircraftSituation::IndexIsOnGround, new CBoolIconFormatter("yes", "no"), true)); m_columns.addColumn(CColumn::standardString("reliability", CAircraftSituation::IndexOnGroundReliabilityString)); m_columns.addColumn(CColumn::standardString("gnd.elv.", CAircraftSituation::IndexGroundElevationPlusInfo)); diff --git a/src/blackmisc/aviation/aircraftsituation.cpp b/src/blackmisc/aviation/aircraftsituation.cpp index 5ec94fb68..ee6dbaf66 100644 --- a/src/blackmisc/aviation/aircraftsituation.cpp +++ b/src/blackmisc/aviation/aircraftsituation.cpp @@ -303,6 +303,7 @@ namespace BlackMisc case IndexAltitude: return this->getAltitude().propertyByIndex(index.copyFrontRemoved()); case IndexHeading: return m_heading.propertyByIndex(index.copyFrontRemoved()); case IndexPitch: return m_pitch.propertyByIndex(index.copyFrontRemoved()); + case IndexPBHInfo: return CVariant::fromValue(this->getPBHInfo()); case IndexBank: return m_bank.propertyByIndex(index.copyFrontRemoved()); case IndexCG: return m_cg.propertyByIndex(index.copyFrontRemoved()); case IndexSceneryOffset: return m_sceneryOffset.propertyByIndex(index.copyFrontRemoved()); @@ -357,6 +358,7 @@ namespace BlackMisc { case IndexPosition: return m_position.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPosition()); case IndexAltitude: return this->getAltitude().comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getAltitude()); + case IndexPBHInfo: // fall through case IndexPitch: return m_pitch.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPitch()); case IndexBank: return m_bank.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getBank()); case IndexCG: return m_cg.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCG()); @@ -381,7 +383,7 @@ namespace BlackMisc { const int c = Compare::compare(this->getGroundElevationInfo(), compareValue.getGroundElevationInfo()); if (c != 0) { return c; } - // fall thrue, compare flag + // fall through, compare flag } case IndexGroundElevationInfoTransferred: return Compare::compare(m_isElvInfoTransferred, compareValue.m_isElvInfoTransferred); case IndexCanLikelySkipNearGroundInterpolation: return Compare::compare(this->canLikelySkipNearGroundInterpolation(), compareValue.canLikelySkipNearGroundInterpolation()); @@ -960,6 +962,16 @@ namespace BlackMisc m_pressureAltitude = altitude; } + QString CAircraftSituation::getPBHInfo() const + { + static const QString pbh("P: %1 %2 B: %3 %4 H: %5 %6"); + return pbh.arg( + this->getPitch().valueRoundedWithUnit(CAngleUnit::deg(), 1, true), this->getPitch().valueRoundedWithUnit(CAngleUnit::rad(), 5, true), + this->getBank().valueRoundedWithUnit(CAngleUnit::deg(), 1, true), this->getBank().valueRoundedWithUnit(CAngleUnit::rad(), 5, true), + this->getHeading().valueRoundedWithUnit(CAngleUnit::deg(), 1, true), this->getHeading().valueRoundedWithUnit(CAngleUnit::rad(), 5, true) + ); + } + bool CAircraftSituation::isMoving() const { const double gsKmh = this->getGroundSpeed().value(CSpeedUnit::km_h()); diff --git a/src/blackmisc/aviation/aircraftsituation.h b/src/blackmisc/aviation/aircraftsituation.h index f565b109a..3e62b27e8 100644 --- a/src/blackmisc/aviation/aircraftsituation.h +++ b/src/blackmisc/aviation/aircraftsituation.h @@ -66,6 +66,7 @@ namespace BlackMisc IndexOnGroundReliability, IndexOnGroundReliabilityString, IndexPitch, + IndexPBHInfo, IndexGroundSpeed, IndexGroundElevationPlane, IndexGroundElevationInfo, @@ -409,6 +410,9 @@ namespace BlackMisc //! Set bank (angle) void setBank(const PhysicalQuantities::CAngle &bank) { m_bank = bank; } + //! Get PBH info (all together) + QString getPBHInfo() const; + //! Get ground speed const PhysicalQuantities::CSpeed &getGroundSpeed() const { return m_groundSpeed; }