]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/testnavs.cxx
Changes to keep the various autopilot properties from stepping on each
[flightgear.git] / src / Navaids / testnavs.cxx
1 #include <simgear/misc/sg_path.hxx>
2
3 #include "fixlist.hxx"
4 #include "ilslist.hxx"
5 #include "navlist.hxx"
6
7 int main() {
8     double heading, dist;
9
10     current_navlist = new FGNavList;
11     SGPath p_nav( "/home/curt/FlightGear/Navaids/default.nav" );
12     current_navlist->init( p_nav );
13     FGNav n;
14     if ( current_navlist->query( -93.2 * SG_DEGREES_TO_RADIANS,
15                                  45.14 * SG_DEGREES_TO_RADIANS,
16                                  3000, 117.30, &n) )
17     {
18         cout << "Found a vor station in range" << endl;
19         cout << " id = " << n.get_ident() << endl;
20     } else {
21         cout << "not picking up vor. :-(" << endl;
22     }
23
24     current_ilslist = new FGILSList;
25     SGPath p_ils( "/home/curt/FlightGear/Navaids/default.ils" );
26     current_ilslist->init( p_ils );
27     FGILS i;
28     if ( current_ilslist->query( -93.1 * SG_DEGREES_TO_RADIANS,
29                                  45.24 * SG_DEGREES_TO_RADIANS,
30                                  3000, 110.30, &i) )
31     {
32         cout << "Found an ils station in range" << endl;
33         cout << " apt = " << i.get_aptcode() << endl;
34         cout << " rwy = " << i.get_rwyno() << endl;
35     } else {
36         cout << "not picking up ils. :-(" << endl;
37     }
38
39     current_fixlist = new FGFixList;
40     SGPath p_fix( "/home/curt/FlightGear/Navaids/default.fix" );
41     current_fixlist->init( p_fix );
42     FGFix fix;
43     if ( current_fixlist->query( "SHELL", -82 * SG_DEGREES_TO_RADIANS,
44                                  41 * SG_DEGREES_TO_RADIANS, 3000,
45                                  &fix, &heading, &dist) )
46     {
47         cout << "Found a matching fix" << endl;
48         cout << " id = " << fix.get_ident() << endl;
49         cout << " heading = " << heading << " dist = " << dist << endl;
50     } else {
51         cout << "did not find fix. :-(" << endl;
52     }
53 }