Ref T299, allow to force "pitch on ground" settings

This commit is contained in:
Klaus Basan
2018-08-04 23:53:29 +02:00
parent ba9c979769
commit 2a50454b03
2 changed files with 21 additions and 2 deletions

View File

@@ -35,6 +35,13 @@ namespace BlackMisc
return true; 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) void CInterpolationAndRenderingSetupBase::consolidateWithClient(const CClient &client)
{ {
m_enabledAircraftParts &= client.hasAircraftPartsCapability(); m_enabledAircraftParts &= client.hasAircraftPartsCapability();
@@ -101,6 +108,7 @@ namespace BlackMisc
case IndexInterpolatorMode: return CVariant::fromValue(m_interpolatorMode); case IndexInterpolatorMode: return CVariant::fromValue(m_interpolatorMode);
case IndexInterpolatorModeAsString: return CVariant::fromValue(this->getInterpolatorModeAsString()); case IndexInterpolatorModeAsString: return CVariant::fromValue(this->getInterpolatorModeAsString());
case IndexFixSceneryOffset: return CVariant::fromValue(m_fixSceneryOffset); case IndexFixSceneryOffset: return CVariant::fromValue(m_fixSceneryOffset);
case IndexPitchOnGround: return CVariant::fromValue(m_pitchOnGround);
default: break; default: break;
} }
BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index"); BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index");
@@ -120,6 +128,7 @@ namespace BlackMisc
case IndexInterpolatorMode: m_interpolatorMode = variant.toInt(); return; case IndexInterpolatorMode: m_interpolatorMode = variant.toInt(); return;
case IndexInterpolatorModeAsString: this->setInterpolatorMode(variant.toQString()); return; case IndexInterpolatorModeAsString: this->setInterpolatorMode(variant.toQString()); return;
case IndexFixSceneryOffset: m_fixSceneryOffset = variant.toBool(); return; case IndexFixSceneryOffset: m_fixSceneryOffset = variant.toBool(); return;
case IndexPitchOnGround: m_pitchOnGround.setPropertyByIndex(index.copyFrontRemoved(), variant); return;
default: break; default: break;
} }
BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index"); BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index");
@@ -135,7 +144,8 @@ namespace BlackMisc
QStringLiteral(" | force VTOL interpolation: ") % boolToYesNo(m_forceVtolInterpolation) % QStringLiteral(" | force VTOL interpolation: ") % boolToYesNo(m_forceVtolInterpolation) %
QStringLiteral(" | enable parts: ") % boolToYesNo(m_enabledAircraftParts) % QStringLiteral(" | enable parts: ") % boolToYesNo(m_enabledAircraftParts) %
QStringLiteral(" | send gnd: ") % boolToYesNo(m_sendGndToSim) % 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) bool CInterpolationAndRenderingSetupBase::canHandleIndex(int index)

View File

@@ -14,6 +14,7 @@
#include "blackmisc/aviation/callsign.h" #include "blackmisc/aviation/callsign.h"
#include "blackmisc/pq/length.h" #include "blackmisc/pq/length.h"
#include "blackmisc/pq/angle.h"
#include "blackmisc/blackmiscexport.h" #include "blackmisc/blackmiscexport.h"
#include "blackmisc/propertyindexlist.h" #include "blackmisc/propertyindexlist.h"
#include "blackmisc/valueobject.h" #include "blackmisc/valueobject.h"
@@ -38,7 +39,8 @@ namespace BlackMisc
IndexEnabledAircraftParts, IndexEnabledAircraftParts,
IndexInterpolatorMode, IndexInterpolatorMode,
IndexInterpolatorModeAsString, IndexInterpolatorModeAsString,
IndexFixSceneryOffset IndexFixSceneryOffset,
IndexPitchOnGround
}; };
//! Interpolator type //! Interpolator type
@@ -87,6 +89,12 @@ namespace BlackMisc
//! Enable fix scenery offset if it has been detected //! Enable fix scenery offset if it has been detected
void setFixingSceneryOffset(bool fix) { m_fixSceneryOffset = fix; } 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 //! Consolidate with a network client
void consolidateWithClient(const Network::CClient &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_sendGndToSim = true; //!< Send the gnd.flag to simulator
bool m_fixSceneryOffset = false; //!< Fix. scenery offset bool m_fixSceneryOffset = false; //!< Fix. scenery offset
int m_interpolatorMode = static_cast<int>(Spline); //!< interpolator mode (spline, ...) int m_interpolatorMode = static_cast<int>(Spline); //!< interpolator mode (spline, ...)
PhysicalQuantities::CAngle m_pitchOnGround = PhysicalQuantities::CAngle::null(); //!< pitch angle on ground
}; };
//! Value object for interpolator and rendering //! Value object for interpolator and rendering