]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/navrecord.cxx
Merge branch 'jmt/cleanup' into next
[flightgear.git] / src / Navaids / navrecord.cxx
index 73edc243f737ee8bb3c6c23f295b6a4d28ca6167..6bb71a54c9d2e40e3506b4e17e451b910e80fd94 100644 (file)
@@ -101,7 +101,7 @@ void FGNavRecord::initAirportRelation()
     mPosition.setElevationFt(mRunway->elevation());
   }
   
-  if (type() == ILS) {
+  if (type() == ILS || type() == LOC) {
     mRunway->setILS(this);
   }
   
@@ -161,9 +161,7 @@ void FGNavRecord::processSceneryILS(SGPropertyNode* aILSNode)
 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);
@@ -172,10 +170,10 @@ void FGNavRecord::alignLocaliserWithRunway(double aThreshold)
   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");
   }
 }