mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Ref T261, unify unit handling in situation altitude related values
* this is an optimization, it would work without that, but there are numerous calculations in interpolation which are faster and easier to debug in the same unit * PQ switch unit functions use "const &PQUnit"
This commit is contained in:
committed by
Roland Winklmeier
parent
337f661499
commit
23c54938ea
@@ -45,6 +45,13 @@ namespace BlackMisc
|
||||
this->setGeodeticHeight(newAlt);
|
||||
}
|
||||
|
||||
void CElevationPlane::switchAltitudeUnit(const CLengthUnit &unit)
|
||||
{
|
||||
if (unit.isNull() || this->getAltitudeUnit().isNull()) { return; }
|
||||
if (this->getAltitudeUnit() == unit) { return; }
|
||||
this->setGeodeticHeight(this->getAltitude().switchedUnit(unit));
|
||||
}
|
||||
|
||||
const CAltitude &CElevationPlane::getAltitudeIfWithinRadius(const ICoordinateGeodetic &coordinate) const
|
||||
{
|
||||
return (isWithinRange(coordinate)) ? geodeticHeight() : CAltitude::null();
|
||||
|
||||
@@ -51,12 +51,18 @@ namespace BlackMisc
|
||||
//! Add offset to altitude
|
||||
void addAltitudeOffset(const PhysicalQuantities::CLength &offset);
|
||||
|
||||
//! Switch altitude unit
|
||||
void switchAltitudeUnit(const PhysicalQuantities::CLengthUnit &unit);
|
||||
|
||||
//! Altitude when within radius, else null
|
||||
const Aviation::CAltitude &getAltitudeIfWithinRadius(const ICoordinateGeodetic &coordinate) const;
|
||||
|
||||
//! Altitude (synonym for geodetic height)
|
||||
const Aviation::CAltitude &getAltitude() const { return this->geodeticHeight(); }
|
||||
|
||||
//! Altitude (synonym for geodetic height) unit
|
||||
const PhysicalQuantities::CLengthUnit &getAltitudeUnit() const { return this->geodeticHeight().getUnit(); }
|
||||
|
||||
//! Altitude (synonym for geodetic height)
|
||||
Aviation::CAltitude getAltitudeInUnit(const PhysicalQuantities::CLengthUnit &unit) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user