]> git.mxchange.org Git - simgear.git/blob - simgear/route/waytest.cxx
- new FSF addresses
[simgear.git] / simgear / route / waytest.cxx
1 #include <simgear/compiler.h>
2 #include <simgear/constants.h>
3
4 #include STL_IOSTREAM
5
6 #include "waypoint.hxx"
7
8 SG_USING_STD(cout);
9 SG_USING_STD(endl);
10
11 int main() {
12     SGWayPoint a1(-93.216923, 44.880547, 0.0, SGWayPoint::WGS84, "KMSP");
13     SGWayPoint a2(-93.216923, 44.880547, 0.0, SGWayPoint::SPHERICAL, "KMSP");
14
15     // KMSN (Madison)
16     double cur_lon = -89.336939;
17     double cur_lat = 43.139541;
18     double cur_alt = 0.0;
19
20     double course, distance;
21
22     a1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
23     cout << "Course to " << a1.get_id() << " is " << course << endl;
24     cout << "Distance to " << a1.get_id() << " is " << distance * SG_METER_TO_NM
25          << endl;
26
27     a2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
28     cout << "Course to " << a2.get_id() << " is " << course << endl;
29     cout << "Distance to " << a2.get_id() << " is " << distance * SG_METER_TO_NM
30          << endl;
31     cout << endl;
32
33     SGWayPoint b1(-88.237037, 43.041038, 0.0, SGWayPoint::WGS84, "KUES");
34     SGWayPoint b2(-88.237037, 43.041038, 0.0, SGWayPoint::SPHERICAL, "KUES");
35
36     b1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
37     cout << "Course to " << b1.get_id() << " is " << course << endl;
38     cout << "Distance to " << b1.get_id() << " is " << distance * SG_METER_TO_NM
39          << endl;
40
41     b2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
42     cout << "Course to " << b2.get_id() << " is " << course << endl;
43     cout << "Distance to " << b2.get_id() << " is " << distance * SG_METER_TO_NM
44          << endl;
45     cout << endl;
46
47     cur_lon = 10;
48     cur_lat = 10;
49
50     SGWayPoint c1(-20, 10, 0, SGWayPoint::CARTESIAN, "Due East");
51     c1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
52     cout << "Course to " << c1.get_id() << " is " << course << endl;
53     cout << "Distance to " << c1.get_id() << " is " << distance << endl;
54    
55     SGWayPoint c2(20, 20, 0, SGWayPoint::CARTESIAN, "Due SW");
56     c2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
57     cout << "Course to " << c2.get_id() << " is " << course << endl;
58     cout << "Distance to " << c2.get_id() << " is " << distance << endl;
59    
60     SGWayPoint c3(20, 0, 0, SGWayPoint::CARTESIAN, "Due NW");
61     c3.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance );
62     cout << "Course to " << c3.get_id() << " is " << course << endl;
63     cout << "Distance to " << c3.get_id() << " is " << distance << endl;
64    
65     return 0;
66 }