From 2a50454b030980f8bb7370b6a5d8d12dd68c5b1c Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 4 Aug 2018 23:53:29 +0200 Subject: [PATCH] Ref T299, allow to force "pitch on ground" settings --- .../simulation/interpolationrenderingsetup.cpp | 12 +++++++++++- .../simulation/interpolationrenderingsetup.h | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/blackmisc/simulation/interpolationrenderingsetup.cpp b/src/blackmisc/simulation/interpolationrenderingsetup.cpp index 58b607c16..9487cd52e 100644 --- a/src/blackmisc/simulation/interpolationrenderingsetup.cpp +++ b/src/blackmisc/simulation/interpolationrenderingsetup.cpp @@ -35,6 +35,13 @@ namespace BlackMisc return true; } + bool CInterpolationAndRenderingSetupBase::setPitchOnGround(const CAngle &pitchOnGround) + { + if (pitchOnGround == m_pitchOnGround) { return false; } + m_pitchOnGround = pitchOnGround; + return true; + } + void CInterpolationAndRenderingSetupBase::consolidateWithClient(const CClient &client) { m_enabledAircraftParts &= client.hasAircraftPartsCapability(); @@ -101,6 +108,7 @@ namespace BlackMisc case IndexInterpolatorMode: return CVariant::fromValue(m_interpolatorMode); case IndexInterpolatorModeAsString: return CVariant::fromValue(this->getInterpolatorModeAsString()); case IndexFixSceneryOffset: return CVariant::fromValue(m_fixSceneryOffset); + case IndexPitchOnGround: return CVariant::fromValue(m_pitchOnGround); default: break; } BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index"); @@ -120,6 +128,7 @@ namespace BlackMisc case IndexInterpolatorMode: m_interpolatorMode = variant.toInt(); return; case IndexInterpolatorModeAsString: this->setInterpolatorMode(variant.toQString()); return; case IndexFixSceneryOffset: m_fixSceneryOffset = variant.toBool(); return; + case IndexPitchOnGround: m_pitchOnGround.setPropertyByIndex(index.copyFrontRemoved(), variant); return; default: break; } BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index"); @@ -135,7 +144,8 @@ namespace BlackMisc QStringLiteral(" | force VTOL interpolation: ") % boolToYesNo(m_forceVtolInterpolation) % QStringLiteral(" | enable parts: ") % boolToYesNo(m_enabledAircraftParts) % QStringLiteral(" | send gnd: ") % boolToYesNo(m_sendGndToSim) % - QStringLiteral(" | fix.scenery offset: ") % boolToYesNo(m_fixSceneryOffset); + QStringLiteral(" | fix.scenery offset: ") % boolToYesNo(m_fixSceneryOffset) % + QStringLiteral(" | pitch on gnd.: ") % m_pitchOnGround.valueRoundedWithUnit(CAngleUnit::deg(), 1, true); } bool CInterpolationAndRenderingSetupBase::canHandleIndex(int index) diff --git a/src/blackmisc/simulation/interpolationrenderingsetup.h b/src/blackmisc/simulation/interpolationrenderingsetup.h index 6e4bb04bd..07f9a20c2 100644 --- a/src/blackmisc/simulation/interpolationrenderingsetup.h +++ b/src/blackmisc/simulation/interpolationrenderingsetup.h @@ -14,6 +14,7 @@ #include "blackmisc/aviation/callsign.h" #include "blackmisc/pq/length.h" +#include "blackmisc/pq/angle.h" #include "blackmisc/blackmiscexport.h" #include "blackmisc/propertyindexlist.h" #include "blackmisc/valueobject.h" @@ -38,7 +39,8 @@ namespace BlackMisc IndexEnabledAircraftParts, IndexInterpolatorMode, IndexInterpolatorModeAsString, - IndexFixSceneryOffset + IndexFixSceneryOffset, + IndexPitchOnGround }; //! Interpolator type @@ -87,6 +89,12 @@ namespace BlackMisc //! Enable fix scenery offset if it has been detected void setFixingSceneryOffset(bool fix) { m_fixSceneryOffset = fix; } + //! Force a given pitch on ground + const PhysicalQuantities::CAngle &getPitchOnGround() const { return m_pitchOnGround; } + + //! Force a given pitch on ground + bool setPitchOnGround(const PhysicalQuantities::CAngle &pitchOnGround); + //! Consolidate with a network client void consolidateWithClient(const Network::CClient &client); @@ -128,6 +136,7 @@ namespace BlackMisc bool m_sendGndToSim = true; //!< Send the gnd.flag to simulator bool m_fixSceneryOffset = false; //!< Fix. scenery offset int m_interpolatorMode = static_cast(Spline); //!< interpolator mode (spline, ...) + PhysicalQuantities::CAngle m_pitchOnGround = PhysicalQuantities::CAngle::null(); //!< pitch angle on ground }; //! Value object for interpolator and rendering