1 // FGGround - a class to provide ground control at larger airports.
3 // Written by David Luff, started March 2002.
5 // Copyright (C) 2002 David C. Luff - david.luff@nottingham.ac.uk
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.
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.
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.
21 #ifndef _FG_GROUND_HXX
22 #define _FG_GROUND_HXX
32 //////////////////////////////////////////////////////
33 // Types for the logical network data structure
34 typedef enum arc_type {
39 typedef enum node_type {
51 typedef list<arc> arc_list_type;
52 typedef arc_list_type::iterator arc_list_itr;
53 typedef arc_list_type::const_iterator arc_list_const_itr;
62 typedef vector<node> node_array_type;
63 typedef node_array_type::iterator node_array_itr;
64 typedef node_array_type::const_iterator node_array_const_itr;
65 // end logical network types
66 ///////////////////////////////////////////////////////
68 // somewhere in the ATC/AI system we are going to have defined something like
69 // typedef struct plane_rec
70 // list <PlaneRec> plane_rec_list_type
72 // A more specialist plane rec to include ground information
73 typedef struct ground_rec {
78 bool cleared; // set true when the plane has been cleared to somewhere
79 bool incoming; //true for arrivals, false for departures
81 // Almost certainly need to add more here
84 typedef list<ground_rec*> ground_rec_list;
85 typedef ground_rec_list::iterator ground_rec_list_itr;
86 typedef ground_rec_list::const_iterator ground_rec_list_const_itr;
88 ///////////////////////////////////////////////////////////////////////////////
92 ///////////////////////////////////////////////////////////////////////////////
93 class FGGround : public FGATC {
97 // Need a data structure to hold details of the various active planes
98 // Need a data structure to hold details of the logical network
99 // including which gates are filled - or possibly another data structure
100 // with the positions of the inactive planes.
101 // Need a data structure to hold outstanding communications from aircraft.
102 // Possibly need a data structure to hold outstanding communications to aircraft.
105 node_array_type network;
107 // Planes currently active
108 ground_rec_list ground_traffic;
116 inline void SetDisplay() {display = true;}
117 inline void SetNoDisplay() {display = false;}
119 // Its possible that NewArrival and NewDeparture should simply be rolled into Request.
121 // Contact ground control on arrival, assumed to request any gate
122 void NewArrival(plane_rec plane);
124 // Contact ground control on departure, assumed to request currently active runway.
125 void NewDeparture(plane_rec plane);
127 // Contact ground control when the calling routine doesn't know if arrival
128 // or departure is appropriate.
129 void NewContact(plane_rec plane);
131 // Make a request of ground control.
132 void Request(ground_request request);
136 // Find the shortest route through the logical network between two points.
137 FindShortestRoute(point a, point b);
139 // Project a point in WGS84 lat/lon onto the local gnomonic.
140 ConvertWGS84ToXY(sgVec3 wgs84, point xy);
142 // Assign a gate or parking location to a new arrival
143 AssignGate(ground_rec &g);
145 // Generate the next clearance for an airplane
146 NextClearance(ground_rec &g);
150 #endif //_FG_GROUND_HXX