mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
Ref T231, utility functions
* corrected altitude also considering CG * 0 if CG is NULL
This commit is contained in:
@@ -214,11 +214,13 @@ namespace BlackMisc
|
||||
return this->getAltitude() - gh;
|
||||
}
|
||||
|
||||
CAltitude CAircraftSituation::getCorrectedAltitude() const
|
||||
CAltitude CAircraftSituation::getCorrectedAltitude(const CLength ¢erOfGravity) const
|
||||
{
|
||||
if (this->getGroundElevation().isNull()) { return this->getAltitude(); }
|
||||
if (this->getAltitude().getReferenceDatum() != CAltitude::MeanSeaLevel) { return this->getAltitude(); }
|
||||
if (this->getGroundElevation() < this->getAltitude()) { return this->getAltitude(); }
|
||||
CAltitude altPlusCG = this->getAltitude();
|
||||
if (!centerOfGravity.isNull()) { altPlusCG += centerOfGravity; }
|
||||
if (this->getGroundElevation().isNull()) { return altPlusCG; }
|
||||
if (this->getAltitude().getReferenceDatum() != CAltitude::MeanSeaLevel) { return altPlusCG; }
|
||||
if (this->getGroundElevation() < this->getAltitude()) { return altPlusCG; }
|
||||
return this->getGroundElevation();
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace BlackMisc
|
||||
const CAltitude &getAltitude() const { return m_position.geodeticHeight(); }
|
||||
|
||||
//! Get altitude under consideration of ground elevation
|
||||
CAltitude getCorrectedAltitude() const;
|
||||
CAltitude getCorrectedAltitude(const PhysicalQuantities::CLength ¢erOfGravity = {}) const;
|
||||
|
||||
//! Set altitude
|
||||
void setAltitude(const CAltitude &altitude) { m_position.setGeodeticHeight(altitude); }
|
||||
|
||||
Reference in New Issue
Block a user