mPosition.setElevationFt(mRunway->elevation());
}
- if (type() == ILS) {
+ if (type() == ILS || type() == LOC) {
mRunway->setILS(this);
}
void FGNavRecord::alignLocaliserWithRunway(double aThreshold)
{
// find the distance from the threshold to the localizer
- SGGeod runwayThreshold(mRunway->threshold());
- double dist, az1, az2;
- SGGeodesy::inverse(mPosition, runwayThreshold, az1, az2, dist);
+ double dist = SGGeodesy::distanceM(mPosition, mRunway->threshold());
// back project that distance along the runway center line
SGGeod newPos = mRunway->pointOnCenterline(dist);
SG_NORMALIZE_RANGE(hdg_diff, -180.0, 180.0);
if ( fabs(hdg_diff) <= aThreshold ) {
- mPosition = newPos;
+ mPosition = SGGeod::fromGeodFt(newPos, mPosition.getElevationFt());
set_multiuse( mRunway->headingDeg() );
} else {
- SG_LOG(SG_GENERAL, SG_WARN, "localizer:" << ident() << ", aligning with runway "
+ SG_LOG(SG_GENERAL, SG_DEBUG, "localizer:" << ident() << ", aligning with runway "
<< mRunway->ident() << " exceeded heading threshold");
}
}