1
0
Fork 0

Navradio: move glideslope angle to NavRecord

Simplifies logic in testing code
This commit is contained in:
James Turner 2018-12-10 16:09:42 +00:00
parent 9339fd2375
commit f14aa4e57f
3 changed files with 19 additions and 2 deletions

View file

@ -958,8 +958,7 @@ void FGNavRadio::updateNav()
SG_NORMALIZE_RANGE(target_radial, 0.0, 360.0);
if (_gs) {
int tmp = (int)(_gs->get_multiuse() / 1000.0);
target_gs = (double)tmp / 100.0;
target_gs = _gs->glideSlopeAngleDeg();
double gs_radial = fmod(_gs->get_multiuse(), 1000.0);
SG_NORMALIZE_RANGE(gs_radial, 0.0, 360.0);

View file

@ -124,6 +124,17 @@ void FGNavRecord::updateFromXML(const SGGeod& geod, double heading)
multiuse = heading;
}
double FGNavRecord::glideSlopeAngleDeg() const
{
if (type() != FGPositioned::GS) {
SG_LOG(SG_NAVAID, SG_DEV_WARN, "called glideSlopeAngleDeg on non-GS navaid:" << ident());
return 0.0;
}
const auto tmp = static_cast<int>(get_multiuse() / 1000.0);
return static_cast<double>(tmp) / 100.0;
}
//------------------------------------------------------------------------------
FGMobileNavRecord::FGMobileNavRecord( PositionedID aGuid,
Type type,

View file

@ -97,6 +97,13 @@ class FGNavRecord : public FGPositioned
*/
double localizerWidth() const;
/**
* extract the glide slope angle, in degrees, from the multiuse field
* Return 0.0 for non-GS navaids (including an ILS or LOC - you need
* to call this on the paired GS record.
*/
double glideSlopeAngleDeg() const;
void bindToNode(SGPropertyNode* nd) const;
void unbindFromNode(SGPropertyNode* nd) const;