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:
Klaus Basan
2018-05-07 11:40:59 +02:00
committed by Roland Winklmeier
parent 337f661499
commit 23c54938ea
8 changed files with 107 additions and 29 deletions

View File

@@ -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();