]> git.mxchange.org Git - flightgear.git/blob - src/Navaids/mkrbeacons.hxx
FG_ to SG_ namespace changes.
[flightgear.git] / src / Navaids / mkrbeacons.hxx
1 // mkrbeacons.hxx -- marker beacon management class
2 //
3 // Written by Curtis Olson, started March 2001.
4 //
5 // Copyright (C) 2001  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_MKRBEACON_HXX
25 #define _FG_MKRBEACON_HXX
26
27
28 #include <simgear/compiler.h>
29 #include <simgear/misc/fgpath.hxx>
30
31 #include <map>
32 #include <vector>
33
34 #include "nav.hxx"
35
36 SG_USING_STD(map);
37 SG_USING_STD(vector);
38
39
40 class FGBeacon {
41
42 public:
43
44     enum fgMkrBeacType {
45         NOBEACON = 0,
46         INNER,
47         MIDDLE,
48         OUTER   
49     };
50
51 private:
52
53     double lon;
54     double lat;
55     double elev;
56     fgMkrBeacType type;
57
58     double x, y, z;
59
60 public:
61
62     FGBeacon();
63     FGBeacon( double _lon, double _lat, double _elev, fgMkrBeacType _type );
64     ~FGBeacon();
65
66     inline double get_elev() const { return elev; }
67     inline fgMkrBeacType get_type() const { return type; }
68     inline double get_x() const { return x; }
69     inline double get_y() const { return y; }
70     inline double get_z() const { return z; }
71    
72 };
73
74
75 class FGMarkerBeacons {
76
77     // convenience types
78     typedef vector < FGBeacon > beacon_list_type;
79     typedef beacon_list_type::iterator beacon_list_iterator;
80     typedef beacon_list_type::const_iterator beacon_list_const_iterator;
81
82     typedef map < int, beacon_list_type > beacon_map_type;
83     typedef beacon_map_type::iterator beacon_map_iterator;
84     typedef beacon_map_type::const_iterator beacon_map_const_iterator;
85
86     beacon_map_type beacon_map;
87
88     // real add a marker beacon
89     bool FGMarkerBeacons::real_add( const int master_index, const FGBeacon& b );
90
91 public:
92
93     FGMarkerBeacons();
94     ~FGMarkerBeacons();
95
96     // initialize the structures
97     bool init();
98
99     // add a marker beacon
100     bool add( double lon, double lat, double elev,
101               FGBeacon::fgMkrBeacType type );
102
103     // returns marker beacon type if we are over a marker beacon, NOBEACON
104     // otherwise
105     FGBeacon::fgMkrBeacType query( double lon, double lat, double elev );
106 };
107
108
109 extern FGMarkerBeacons *current_beacons;
110
111
112 #endif // _FG_MKRBEACON_HXX