Navradio: move glideslope angle to NavRecord
Simplifies logic in testing code
This commit is contained in:
parent
9339fd2375
commit
f14aa4e57f
3 changed files with 19 additions and 2 deletions
|
@ -958,8 +958,7 @@ void FGNavRadio::updateNav()
|
||||||
SG_NORMALIZE_RANGE(target_radial, 0.0, 360.0);
|
SG_NORMALIZE_RANGE(target_radial, 0.0, 360.0);
|
||||||
|
|
||||||
if (_gs) {
|
if (_gs) {
|
||||||
int tmp = (int)(_gs->get_multiuse() / 1000.0);
|
target_gs = _gs->glideSlopeAngleDeg();
|
||||||
target_gs = (double)tmp / 100.0;
|
|
||||||
|
|
||||||
double gs_radial = fmod(_gs->get_multiuse(), 1000.0);
|
double gs_radial = fmod(_gs->get_multiuse(), 1000.0);
|
||||||
SG_NORMALIZE_RANGE(gs_radial, 0.0, 360.0);
|
SG_NORMALIZE_RANGE(gs_radial, 0.0, 360.0);
|
||||||
|
|
|
@ -124,6 +124,17 @@ void FGNavRecord::updateFromXML(const SGGeod& geod, double heading)
|
||||||
multiuse = 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,
|
FGMobileNavRecord::FGMobileNavRecord( PositionedID aGuid,
|
||||||
Type type,
|
Type type,
|
||||||
|
|
|
@ -97,6 +97,13 @@ class FGNavRecord : public FGPositioned
|
||||||
*/
|
*/
|
||||||
double localizerWidth() const;
|
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 bindToNode(SGPropertyNode* nd) const;
|
||||||
void unbindFromNode(SGPropertyNode* nd) const;
|
void unbindFromNode(SGPropertyNode* nd) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue