mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user