]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/ils.hxx
Changes contributed by Tony Peden to put wind data "on the bus".
[flightgear.git] / src / Navaids / ils.hxx
1 // ils.hxx -- navaid class
2 //
3 // Written by Curtis Olson, started April 2000.
4 //
5 // Copyright (C) 2000  Curtis L. Olson - curt@flightgear.org
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _FG_ILS_HXX
25 #define _FG_ILS_HXX
26
27
28 #include <simgear/compiler.h>
29 #include <simgear/math/fg_geodesy.hxx>
30 #include <simgear/misc/fgstream.hxx>
31
32 #ifdef FG_HAVE_STD_INCLUDES
33 #  include <istream>
34 #elif defined( FG_HAVE_NATIVE_SGI_COMPILERS )
35 #  include <iostream.h>
36 #elif defined( __BORLANDC__ )
37 #  include <iostream>
38 #else
39 #  include <istream.h>
40 #endif
41
42 #if ! defined( FG_HAVE_NATIVE_SGI_COMPILERS )
43 FG_USING_STD(istream);
44 #endif
45
46
47 #define FG_ILS_DEFAULT_RANGE 30
48
49 class FGILS {
50
51     char ilstype;
52     char ilstypename[6];
53     char aptcode[5];
54     char rwyno[4];
55     int  locfreq;
56     char locident[5];
57     double locheading;
58     double loclat;
59     double loclon;
60     double x, y, z;
61     double gselev;
62     double gsangle;
63     double gslat;
64     double gslon;
65     double dmelat;
66     double dmelon;
67     double omlat;
68     double omlon;
69     double mmlat;
70     double mmlon;
71     double imlat;
72     double imlon;
73
74 public:
75
76     inline FGILS(void) {}
77     inline ~FGILS(void) {}
78
79     inline char get_ilstype() const { return ilstype; }
80     inline char *get_ilstypename() { return ilstypename; }
81     inline char *get_aptcode() { return aptcode; }
82     inline char *get_rwyno() { return rwyno; }
83     inline int get_locfreq() const { return locfreq; }
84     inline char *get_locident() { return locident; }
85     inline double get_locheading() const { return locheading; }
86     inline double get_loclat() const { return loclat; }
87     inline double get_loclon() const { return loclon; }
88     inline double get_gselev() const { return gselev; }
89     inline double get_x() const { return x; }
90     inline double get_y() const { return y; }
91     inline double get_z() const { return z; }
92     inline double get_gsangle() const { return gsangle; }
93     inline double get_gslat() const { return gslat; }
94     inline double get_gslon() const { return gslon; }
95     inline double get_dmelat() const { return dmelat; }
96     inline double get_dmelon() const { return dmelon; }
97     inline double get_omlat() const { return omlat; }
98     inline double get_omlon() const { return omlon; }
99     inline double get_mmlat() const { return mmlat; }
100     inline double get_mmlon() const { return mmlon; }
101     inline double get_imlat() const { return imlat; }
102     inline double get_imlon() const { return imlon; }
103
104     friend istream& operator>> ( istream&, FGILS& );
105 };
106
107
108 inline istream&
109 operator >> ( istream& in, FGILS& i )
110 {
111     double f;
112     in >> i.ilstype >> i.ilstypename >> i.aptcode >> i.rwyno 
113        >> f >> i.locident >> i.locheading >> i.loclat >> i.loclon
114        >> i.gselev >> i.gsangle >> i.gslat >> i.gslon
115        >> i.dmelat >> i.dmelon
116        >> i.omlat >> i.omlon
117        >> i.mmlat >> i.mmlon
118        >> i.imlat >> i.imlon;
119         
120
121     i.locfreq = (int)(f*100.0 + 0.5);
122
123     // generate cartesian coordinates
124     Point3D geod( i.loclon * DEG_TO_RAD, i.loclat * DEG_TO_RAD, i.gselev );
125     Point3D cart = fgGeodToCart( geod );
126     i.x = cart.x();
127     i.y = cart.y();
128     i.z = cart.z();
129
130      // return in >> skipeol;
131     return in;
132 }
133
134
135 #endif // _FG_ILS_HXX