]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/navlist.cxx
Vivian Meazza:
[flightgear.git] / src / Navaids / navlist.cxx
index 80ba3c897155d0c2d7e03bb174c49d568645da53..84c3b430c763b9f9bf7e0fd1d0d571ff4bcd79e9 100644 (file)
 FGNavList::FGNavList( void ) {
 }
 
+FGTACANList::FGTACANList( void ){
+}
+
 
 // Destructor
 FGNavList::~FGNavList( void ) {
 }
 
+FGTACANList::~FGTACANList( void ){
+}
 
 // load the navaids and build the map
 bool FGNavList::init() {
@@ -53,6 +58,10 @@ bool FGNavList::init() {
     return true;
 }
 
+bool FGTACANList::init() {
+    
+    return true;      
+}
 
 // real add a marker beacon
 static void real_add( nav_map_type &navmap, const int master_index,
@@ -128,6 +137,11 @@ bool FGNavList::add( FGNavRecord *n ) {
     return true;
 }
 
+// add an entry to the lists
+bool FGTACANList::add( FGTACANRecord *c ) {
+    ident_channels[c->get_channel()].push_back(c);
+    return true;
+}
 
 // Query the database for the specified frequency.  It is assumed that
 // there will be multiple stations with matching frequencies so a
@@ -137,6 +151,7 @@ FGNavRecord *FGNavList::findByFreq( double freq, double lon, double lat, double
 {
     nav_list_type stations = navaids[(int)(freq*100.0 + 0.5)];
     Point3D aircraft = sgGeodToCart( Point3D(lon, lat, elev) );
+    SG_LOG( SG_INSTR, SG_DEBUG, "findbyFreq " << freq << " size " << stations.size()  );
 
     return findNavFromList( aircraft, stations );
 }
@@ -157,7 +172,7 @@ FGNavRecord *FGNavList::findByIdent( const char* ident,
 FGNavRecord *FGNavList::findByIdentAndFreq( const char* ident, const double freq )
 {
     nav_list_type stations = ident_navaids[ident];
-
+    SG_LOG( SG_INSTR, SG_DEBUG, "findByIdent " << ident<< " size " << stations.size()  );
     if ( freq > 0.0 ) {
         // sometimes there can be duplicated idents.  If a freq is
         // specified, use it to refine the search.
@@ -321,3 +336,28 @@ FGNavRecord *FGNavList::findClosest( double lon_rad, double lat_rad,
 
     return result;
 }
+
+// Given a TACAN Channel return the first matching frequency
+FGTACANRecord *FGTACANList::findByChannel( string channel )
+{
+    tacan_list_type stations = ident_channels[channel];
+    SG_LOG( SG_INSTR, SG_DEBUG, "findByChannel " << channel<< " size " << stations.size()  );
+    
+    if (stations.size()) {
+        return stations[0];
+    }    
+    return NULL;
+}
+
+// Given a frequency, return the first matching station.
+FGNavRecord *FGNavList::findStationByFreq( double freq )
+{
+    nav_list_type stations = navaids[(int)(freq*100.0 + 0.5)];
+   
+    SG_LOG( SG_INSTR, SG_DEBUG, "findStationByFreq " << freq << " size " << stations.size()  );
+    
+    if (stations.size()) {
+        return stations[0];
+    }    
+    return NULL;
+}