mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Q_ASSERT(altitude.getAltitudeType() == CAltitude::PressureAltitude);
|
||||
|
||||
@@ -293,6 +293,9 @@ namespace BlackMisc
|
||||
//! Set altitude
|
||||
void setAltitude(const CAltitude &altitude) { m_position.setGeodeticHeight(altitude); }
|
||||
|
||||
//! Add offset
|
||||
CAltitude addAltitudeOffset(const PhysicalQuantities::CLength &offset);
|
||||
|
||||
//! Get pressure altitude
|
||||
const CAltitude &getPressureAltitude() const { return m_pressureAltitude; }
|
||||
|
||||
|
||||
@@ -480,10 +480,17 @@ namespace BlackMisc
|
||||
|
||||
bool CRemoteAircraftProvider::testAddAltitudeOffsetToSituation(CAircraftSituation &situation) const
|
||||
{
|
||||
if (!this->hasTestAltitudeOffset(situation.getCallsign())) { return false; }
|
||||
const CCallsign cs(situation.getCallsign());
|
||||
// for global offset testing set "true"
|
||||
constexpr bool globalOffsetTest = false;
|
||||
|
||||
const CCallsign cs(situation.getCallsign());
|
||||
if (!globalOffsetTest && !this->hasTestAltitudeOffset(cs)) { return false; }
|
||||
CLength os;
|
||||
if (globalOffsetTest)
|
||||
{
|
||||
os = CLength(100, CLengthUnit::ft());
|
||||
}
|
||||
else
|
||||
{
|
||||
QReadLocker l(&m_lockSituations);
|
||||
os = m_testOffset.value(cs);
|
||||
|
||||
Reference in New Issue
Block a user