]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/newnavradio.cxx
Jean Pellotier: don't show markers for invalid targets in HUD
[flightgear.git] / src / Instrumentation / newnavradio.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 202fd24..bc54961
 #include <assert.h>
 #include <boost/foreach.hpp>
 
-#include <simgear/math/SGMath.hxx>
 #include <simgear/math/interpolater.hxx>
 #include <simgear/sg_inlines.h>
 #include <simgear/props/propertyObject.hxx>
 #include <simgear/misc/strutils.hxx>
+#include <simgear/sound/sample_group.hxx>
 
 #include <Main/fg_props.hxx>
 #include <Navaids/navlist.hxx>
@@ -149,7 +149,7 @@ public:
 
 protected:
   virtual double computeSignalQuality_norm( const SGGeod & aircraftPosition );
-  virtual FGNavList * getNavaidList() = 0;
+  virtual FGNavList::TypeFilter* getNavaidFilter() = 0;
 
   // General-purpose sawtooth function.  Graph looks like this:
   //         /\                                    .
@@ -259,7 +259,8 @@ double NavRadioComponent::getRange_nm( const SGGeod & aircraftPosition )
 
 void NavRadioComponent::search( double frequency, const SGGeod & aircraftPosition )
 {
-  if( NULL == (_navRecord = getNavaidList()->findByFreq(frequency, aircraftPosition )) ) {
+  _navRecord = FGNavList::findByFreq(frequency, aircraftPosition, getNavaidFilter() );
+  if( NULL == _navRecord ) {
     SG_LOG(SG_INSTR,SG_ALERT, "No " << _name << " available at " << frequency );
     _ident = "";
     return;
@@ -323,7 +324,7 @@ public:
   virtual double getRange_nm(const SGGeod & aircraftPosition);
 protected:
   virtual double computeSignalQuality_norm( const SGGeod & aircraftPosition );
-  virtual FGNavList * getNavaidList();
+  virtual FGNavList::TypeFilter* getNavaidFilter();
 
 private:
   double _totalTime;
@@ -393,9 +394,10 @@ double VOR::getRange_nm( const SGGeod & aircraftPosition )
   return _serviceVolume.adjustRange( _heightAboveStation_ft, _navRecord->get_range() );
 }
 
-FGNavList * VOR::getNavaidList()
+FGNavList::TypeFilter* VOR::getNavaidFilter()
 {
-  return globals->get_navlist();
+  static FGNavList::TypeFilter filter(FGPositioned::VOR);
+  return &filter;
 }
 
 double VOR::computeSignalQuality_norm( const SGGeod & aircraftPosition )
@@ -468,7 +470,7 @@ public:
 
 protected:
   virtual double computeSignalQuality_norm( const SGGeod & aircraftPosition );
-  virtual FGNavList * getNavaidList();
+  virtual FGNavList::TypeFilter* getNavaidFilter();
 
 private:
   class ServiceVolume {
@@ -532,9 +534,9 @@ LOC::~LOC()
 {
 }
 
-FGNavList * LOC::getNavaidList()
+FGNavList::TypeFilter* LOC::getNavaidFilter()
 {
-  return globals->get_loclist();
+  return FGNavList::locFilter();
 }
 
 void LOC::search( double frequency, const SGGeod & aircraftPosition )
@@ -618,8 +620,7 @@ public:
 
   virtual double getRange_nm(const SGGeod & aircraftPosition);
 protected:
-  virtual FGNavList * getNavaidList();
-
+  virtual FGNavList::TypeFilter* getNavaidFilter();
 private:
   class ServiceVolume {
   public:
@@ -687,9 +688,10 @@ GS::~GS()
 {
 }
 
-FGNavList * GS::getNavaidList()
+FGNavList::TypeFilter* GS::getNavaidFilter()
 {
-  return globals->get_gslist();
+  static FGNavList::TypeFilter filter(FGPositioned::GS);
+  return &filter;
 }
 
 double GS::getRange_nm(const SGGeod & aircraftPosition)