mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
Ref T261, a global altitude offset can be enabled for testing
This commit is contained in:
committed by
Roland Winklmeier
parent
a2ab62a25a
commit
2d66fd470a
@@ -617,6 +617,14 @@ namespace BlackMisc
|
|||||||
return altCor;
|
return altCor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAltitude CAircraftSituation::addAltitudeOffset(const CLength &offset)
|
||||||
|
{
|
||||||
|
if (offset.isNull()) { return this->getAltitude(); }
|
||||||
|
const CAltitude alt = this->getAltitude().withOffset(offset);
|
||||||
|
this->setAltitude(alt);
|
||||||
|
return alt;
|
||||||
|
}
|
||||||
|
|
||||||
void CAircraftSituation::setPressureAltitude(const CAltitude &altitude)
|
void CAircraftSituation::setPressureAltitude(const CAltitude &altitude)
|
||||||
{
|
{
|
||||||
Q_ASSERT(altitude.getAltitudeType() == CAltitude::PressureAltitude);
|
Q_ASSERT(altitude.getAltitudeType() == CAltitude::PressureAltitude);
|
||||||
|
|||||||
@@ -293,6 +293,9 @@ namespace BlackMisc
|
|||||||
//! Set altitude
|
//! Set altitude
|
||||||
void setAltitude(const CAltitude &altitude) { m_position.setGeodeticHeight(altitude); }
|
void setAltitude(const CAltitude &altitude) { m_position.setGeodeticHeight(altitude); }
|
||||||
|
|
||||||
|
//! Add offset
|
||||||
|
CAltitude addAltitudeOffset(const PhysicalQuantities::CLength &offset);
|
||||||
|
|
||||||
//! Get pressure altitude
|
//! Get pressure altitude
|
||||||
const CAltitude &getPressureAltitude() const { return m_pressureAltitude; }
|
const CAltitude &getPressureAltitude() const { return m_pressureAltitude; }
|
||||||
|
|
||||||
|
|||||||
@@ -480,10 +480,17 @@ namespace BlackMisc
|
|||||||
|
|
||||||
bool CRemoteAircraftProvider::testAddAltitudeOffsetToSituation(CAircraftSituation &situation) const
|
bool CRemoteAircraftProvider::testAddAltitudeOffsetToSituation(CAircraftSituation &situation) const
|
||||||
{
|
{
|
||||||
if (!this->hasTestAltitudeOffset(situation.getCallsign())) { return false; }
|
// for global offset testing set "true"
|
||||||
const CCallsign cs(situation.getCallsign());
|
constexpr bool globalOffsetTest = false;
|
||||||
|
|
||||||
|
const CCallsign cs(situation.getCallsign());
|
||||||
|
if (!globalOffsetTest && !this->hasTestAltitudeOffset(cs)) { return false; }
|
||||||
CLength os;
|
CLength os;
|
||||||
|
if (globalOffsetTest)
|
||||||
|
{
|
||||||
|
os = CLength(100, CLengthUnit::ft());
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
QReadLocker l(&m_lockSituations);
|
QReadLocker l(&m_lockSituations);
|
||||||
os = m_testOffset.value(cs);
|
os = m_testOffset.value(cs);
|
||||||
|
|||||||
Reference in New Issue
Block a user