1 #include <simgear/misc/sg_path.hxx>
6 #include "mkrbeacons.hxx"
9 const string FG_DATA_DIR("/usr/local/lib/FlightGear");
14 FGNavList *current_navlist = new FGNavList;
15 SGPath p_nav( FG_DATA_DIR + "/Navaids/default.nav" );
17 current_navlist->init( p_nav );
20 if ( (n = current_navlist->findByFreq( -93.2 * SG_DEGREES_TO_RADIANS,
21 45.14 * SG_DEGREES_TO_RADIANS,
22 3000, 117.30)) != NULL )
24 cout << "Found a vor station in range" << endl;
25 cout << " id = " << n->get_ident() << endl;
27 cout << "not picking up vor. :-(" << endl;
31 if ( (dcs = current_navlist->findByIdent( "DCS",
32 -3.3 * SG_DEGREES_TO_RADIANS,
33 55.9 * SG_DEGREES_TO_RADIANS))
36 cout << "Found DCS by ident" << endl;
37 if (dcs->get_freq() != 11520)
38 cout << "Frequency for DCS VOR is wrong (should be 115.20), it's "
39 << dcs->get_freq() << endl;
41 cout << "couldn't locate DCS (Dean-Cross) VOR" << endl;
44 // we have to init the marker beacon storage before we parse the ILS file
45 FGMarkerBeacons *current_beacons = new FGMarkerBeacons;
46 current_beacons->init();
48 FGILSList *current_ilslist = new FGILSList;
49 SGPath p_ils( FG_DATA_DIR + "/Navaids/default.ils" );
50 current_ilslist->init( p_ils );
51 FGILS *i = current_ilslist->findByFreq( -93.1 * SG_DEGREES_TO_RADIANS,
52 45.24 * SG_DEGREES_TO_RADIANS,
55 cout << "Found an ils station in range" << endl;
56 cout << " apt = " << i->get_aptcode() << endl;
57 cout << " rwy = " << i->get_rwyno() << endl;
59 cout << "not picking up ils. :-(" << endl;
62 FGFixList *current_fixlist = new FGFixList;
63 SGPath p_fix( FG_DATA_DIR + "/Navaids/default.fix" );
64 current_fixlist->init( p_fix );
67 // attempting to get the position relative to the OTR VOR; heading
68 // should be 108 degrees, distance 74nm (according to my SimCharts
70 if ( current_fixlist->query_and_offset( "DOGGA",
71 -0.103 * SG_DEGREES_TO_RADIANS,
72 53.698 * SG_DEGREES_TO_RADIANS,
73 3000, &fix, &heading, &dist) )
75 cout << "Found a matching fix" << endl;
76 cout << " id = " << fix.get_ident() << endl;
77 cout << " heading = " << heading << " dist = " << dist * SG_METER_TO_NM
80 cout << "did not find fix. :-(" << endl;