mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T683, own aircraft provider CG update
This commit is contained in:
committed by
Mat Sutcliffe
parent
dc790cee8d
commit
e1b0375d68
@@ -290,6 +290,15 @@ namespace BlackCore
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateOwnCG(const CLength &cg)
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
const bool changed = (m_ownAircraft.getModel().getCG() != cg);
|
||||
if (!changed) { return false; }
|
||||
m_ownAircraft.setCG(cg);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateOwnPosition(const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::Aviation::CAltitude &altitude, const CAltitude &pressureAltitude)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << position << altitude; }
|
||||
|
||||
@@ -110,6 +110,10 @@ namespace BlackCore
|
||||
//! \ingroup ownaircraftprovider
|
||||
virtual bool updateOwnParts(const BlackMisc::Aviation::CAircraftParts &parts) override;
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::IOwnAircraftProvider::updateOwnParts
|
||||
//! \ingroup ownaircraftprovider
|
||||
virtual bool updateOwnCG(const BlackMisc::PhysicalQuantities::CLength &cg) override;
|
||||
|
||||
//! \copydoc BlackMisc::IProvider::asQObject
|
||||
virtual QObject *asQObject() override { return this; }
|
||||
|
||||
|
||||
@@ -105,6 +105,12 @@ namespace BlackMisc
|
||||
return this->provider()->updateOwnParts(parts);
|
||||
}
|
||||
|
||||
bool COwnAircraftAware::updateOwnCG(const CLength &cg)
|
||||
{
|
||||
Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
|
||||
return this->provider()->updateOwnCG(cg);
|
||||
}
|
||||
|
||||
bool COwnAircraftAware::updateOwnCallsign(const CCallsign &callsign)
|
||||
{
|
||||
Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
|
||||
|
||||
@@ -92,6 +92,9 @@ namespace BlackMisc
|
||||
//! Update own parts
|
||||
virtual bool updateOwnParts(const Aviation::CAircraftParts &parts) = 0;
|
||||
|
||||
//! Update own aircraft's CG (aka vertical offset)
|
||||
virtual bool updateOwnCG(const PhysicalQuantities::CLength &cg) = 0;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// cockpit / aircraft related updates, which can come from multiple sources
|
||||
// and are subject of roundtrips -> originator
|
||||
@@ -168,6 +171,9 @@ namespace BlackMisc
|
||||
//! \copydoc IOwnAircraftProvider::updateOwnParts
|
||||
bool updateOwnParts(const Aviation::CAircraftParts &parts);
|
||||
|
||||
//! \copydoc IOwnAircraftProvider::updateOwnCG
|
||||
bool updateOwnCG(const PhysicalQuantities::CLength &cg);
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
COwnAircraftAware(IOwnAircraftProvider *ownAircraftProvider) : IProviderAware(ownAircraftProvider) { Q_ASSERT(ownAircraftProvider); }
|
||||
|
||||
@@ -113,6 +113,12 @@ namespace BlackMisc
|
||||
return true;
|
||||
}
|
||||
|
||||
bool COwnAircraftProviderDummy::updateOwnCG(const CLength &cg)
|
||||
{
|
||||
QWriteLocker l(&m_lock);
|
||||
return m_ownAircraft.setCG(cg);
|
||||
}
|
||||
|
||||
bool COwnAircraftProviderDummy::updateOwnCallsign(const CCallsign &callsign)
|
||||
{
|
||||
QWriteLocker l(&m_lock);
|
||||
|
||||
@@ -102,6 +102,9 @@ namespace BlackMisc
|
||||
//! \copydoc IOwnAircraftProvider::updateOwnParts
|
||||
virtual bool updateOwnParts(const BlackMisc::Aviation::CAircraftParts &parts) override;
|
||||
|
||||
//! \copydoc IOwnAircraftProvider::updateOwnCG
|
||||
virtual bool updateOwnCG(const BlackMisc::PhysicalQuantities::CLength &cg) override;
|
||||
|
||||
private:
|
||||
BlackMisc::Simulation::CSimulatedAircraft m_ownAircraft;
|
||||
mutable QReadWriteLock m_lock; //!< lock for m_ownAircraft
|
||||
|
||||
Reference in New Issue
Block a user