mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 10:47:01 +08:00
Differentiate between true and pressure altitude
Altitude can have different meanings in aviation. So far all our altitudes were true altitudes. But now we also require pressure altitude including a conversion method between the two. Maniphest Tasks: T223
This commit is contained in:
committed by
Klaus Basan
parent
718d5abf90
commit
51a90a9a71
@@ -16,8 +16,7 @@
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
using BlackMisc::PhysicalQuantities::CLength;
|
||||
using BlackMisc::PhysicalQuantities::CLengthUnit;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -62,6 +61,24 @@ namespace BlackMisc
|
||||
this->m_datum = MeanSeaLevel;
|
||||
}
|
||||
|
||||
void CAltitude::convertToPressureAltitude(const CPressure &seaLevelPressure)
|
||||
{
|
||||
if (m_altitudeType == PressureAltitude) { return; }
|
||||
static const CPressure standardPressure(1013.25, CPressureUnit::mbar());
|
||||
const CPressure delta = (standardPressure - seaLevelPressure);
|
||||
double deltaV = delta.value(CPressureUnit::mbar());
|
||||
deltaV *= 30.0;
|
||||
addValueSameUnit(deltaV);
|
||||
m_altitudeType = PressureAltitude;
|
||||
}
|
||||
|
||||
CAltitude CAltitude::toPressureAltitude(const CPressure &seaLevelPressure) const
|
||||
{
|
||||
CAltitude other(*this);
|
||||
other.convertToPressureAltitude(seaLevelPressure);
|
||||
return other;
|
||||
}
|
||||
|
||||
void CAltitude::parseFromString(const QString &value)
|
||||
{
|
||||
this->parseFromString(value, PhysicalQuantities::CPqString::SeparatorsCLocale);
|
||||
|
||||
Reference in New Issue
Block a user