mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Ref T335, misc improvements in value objects
* allow to reset PBH for terrain probe * check for null altitude before converting * function isTerrainProbe for model/aircraft
This commit is contained in:
committed by
Roland Winklmeier
parent
916f2f6180
commit
651ead5b51
@@ -101,6 +101,7 @@ namespace BlackMisc
|
||||
void CAltitude::convertToPressureAltitude(const CPressure &seaLevelPressure)
|
||||
{
|
||||
if (m_altitudeType == PressureAltitude) { return; }
|
||||
if (this->isNull()) { return; }
|
||||
const CPressure deltaPressure = standardISASeaLevelPressure() - seaLevelPressure;
|
||||
const double deltaPressureV = deltaPressure.value(CPressureUnit::mbar());
|
||||
const double deltaAltitudeV = deltaPressureV * 30.0; // 30.0 ft per mbar
|
||||
@@ -111,6 +112,8 @@ namespace BlackMisc
|
||||
|
||||
CAltitude CAltitude::toPressureAltitude(const CPressure &seaLevelPressure) const
|
||||
{
|
||||
if (seaLevelPressure.isNull()) { return CAltitude::null(); }
|
||||
if (this->isNull()) { return CAltitude::null(); }
|
||||
CAltitude other(*this);
|
||||
other.convertToPressureAltitude(seaLevelPressure);
|
||||
return other;
|
||||
|
||||
Reference in New Issue
Block a user