]> git.mxchange.org Git - flightgear.git/blob - src/Airports/runways.hxx
Patch from Julian Foad:
[flightgear.git] / src / Airports / runways.hxx
1 // runways.hxx -- a simple class to manage airport runway info
2 //
3 // Written by Curtis Olson, started August 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 _RUNWAYS_HXX
25 #define _RUNWAYS_HXX
26
27
28 #ifndef __cplusplus                                                          
29 # error This library requires C++
30 #endif                                   
31
32
33 #ifdef HAVE_CONFIG_H
34 #  include <config.h>
35 #endif
36
37 #include <simgear/compiler.h>
38
39 #include STL_STRING
40 #include <vector>
41
42 // Forward declarations.
43 class c4_Storage;
44 class c4_View;
45
46 SG_USING_STD(string);
47 SG_USING_STD(vector);
48
49
50 class FGRunway {
51
52 public:
53
54     string id;
55     string rwy_no;
56
57     double lon;
58     double lat;
59     double heading;
60     double length;
61     double width;
62     
63     string surface_flags;
64     string end1_flags;
65     string end2_flags;
66
67 public:
68
69     FGRunway() {}
70     ~FGRunway() {}
71
72 };
73
74 class FGRunways {
75
76 private:
77
78     c4_Storage *storage;
79     c4_View *vRunway;
80     int next_index;
81
82 public:
83
84     // Constructor
85     FGRunways( const string& file );
86
87     // Destructor
88     ~FGRunways();
89
90     // search for the specified apt id.
91     // Returns true if successful, otherwise returns false.
92     // On success, runway data is returned thru "runway" pointer.
93     // "runway" is not changed if "apt" is not found.
94     bool search( const string& aptid, FGRunway* runway );
95     bool search( const string& aptid, const string& rwyno, FGRunway* runway );
96
97     // DCL - search for runway closest to desired heading in degrees
98     bool search( const string& aptid, const int hdg, FGRunway* runway );
99
100     // Return the runway number of the runway closest to a given heading
101     string search( const string& aptid, const int tgt_hdg );
102
103     FGRunway search( const string& aptid );
104     bool next( FGRunway* runway );
105     FGRunway next();
106 };
107
108
109 class FGRunwaysUtil {
110 public:
111     typedef vector< FGRunway > container;
112     typedef container::iterator iterator;
113     typedef container::const_iterator const_iterator;
114
115 private:
116     container runways;
117
118 public:
119
120     // Constructor
121     FGRunwaysUtil();
122
123     // Destructor
124     ~FGRunwaysUtil();
125
126     // load the data
127     int load( const string& file );
128
129     // save the data in metakit format
130     bool dump_mk4( const string& file );
131
132     // search for the specified id.
133     // Returns true if successful, otherwise returns false.
134     // On success, runway data is returned thru "runway" pointer.
135     // "runway" is not changed if "id" is not found.
136     // bool search( const string& id, FGRunway* runway ) const;
137     // FGRunway search( const string& id ) const;
138 };
139
140
141 #endif // _RUNWAYS_HXX