1 #include <simgear/misc/sg_path.hxx>
6 #include "mkrbeacons.hxx"
9 const string FG_DATA_DIR("/usr/local/lib/FlightGear");
14 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 current_beacons = new FGMarkerBeacons;
46 current_beacons->init();
48 current_ilslist = new FGILSList;
49 SGPath p_ils( FG_DATA_DIR + "/Navaids/default.ils" );
50 current_ilslist->init( p_ils );
52 if ( current_ilslist->query( -93.1 * SG_DEGREES_TO_RADIANS,
53 45.24 * SG_DEGREES_TO_RADIANS,
56 cout << "Found an ils station in range" << endl;
57 cout << " apt = " << i.get_aptcode() << endl;
58 cout << " rwy = " << i.get_rwyno() << endl;
60 cout << "not picking up ils. :-(" << endl;
63 current_fixlist = new FGFixList;
64 SGPath p_fix( FG_DATA_DIR + "/Navaids/default.fix" );
65 current_fixlist->init( p_fix );
68 // attempting to get the position relative to the OTR VOR; heading
69 // should be 108 degrees, distance 74nm (according to my SimCharts
71 if ( current_fixlist->query_and_offset( "DOGGA",
72 -0.103 * SG_DEGREES_TO_RADIANS,
73 53.698 * SG_DEGREES_TO_RADIANS,
74 3000, &fix, &heading, &dist) )
76 cout << "Found a matching fix" << endl;
77 cout << " id = " << fix.get_ident() << endl;
78 cout << " heading = " << heading << " dist = " << dist * SG_METER_TO_NM
81 cout << "did not find fix. :-(" << endl;