1 // runwayprefs.hxx - A number of classes to configure runway
2 // assignments by the AI code
4 // Written by Durk Talsma, started January 2005.
6 // Copyright (C) 2004 Durk Talsma.
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef _RUNWAYPREFS_HXX_
25 #define _RUNWAYPREFS_HXX_
31 #include <simgear/compiler.h>
36 typedef vector<time_t> timeVec;
37 typedef vector<time_t>::const_iterator timeVecConstIterator;
39 typedef vector<string> stringVec;
40 typedef vector<string>::iterator stringVecIterator;
41 typedef vector<string>::const_iterator stringVecConstIterator;
45 /***************************************************************************/
50 stringVec scheduleNames;
54 ScheduleTime() : tailWind(0), crssWind(0) {};
55 ScheduleTime(const ScheduleTime &other);
56 ScheduleTime &operator= (const ScheduleTime &other);
57 string getName(time_t dayStart);
60 void addStartTime(time_t time) { start.push_back(time); };
61 void addEndTime (time_t time) { end. push_back(time); };
62 void addScheduleName(const string& sched) { scheduleNames.push_back(sched); };
63 void setTailWind(double wnd) { tailWind = wnd; };
64 void setCrossWind(double wnd) { tailWind = wnd; };
66 double getTailWind() { return tailWind; };
67 double getCrossWind() { return crssWind; };
70 //typedef vector<ScheduleTime> ScheduleTimes;
71 /*****************************************************************************/
77 stringVec preferredRunways;
80 RunwayList(const RunwayList &other);
81 RunwayList& operator= (const RunwayList &other);
83 void set(const string&, const string&);
86 string getType() { return type; };
87 stringVec *getRwyList() { return &preferredRunways; };
88 string getRwyList(int j) { return preferredRunways[j]; };
91 typedef vector<RunwayList> RunwayListVec;
92 typedef vector<RunwayList>::iterator RunwayListVectorIterator;
93 typedef vector<RunwayList>::const_iterator RunwayListVecConstIterator;
96 /*****************************************************************************/
102 RunwayListVec rwyList;
104 //stringVec runwayNames;
110 RunwayGroup(const RunwayGroup &other);
111 RunwayGroup &operator= (const RunwayGroup &other);
113 void setName(const string& nm) { name = nm; };
114 void add(const RunwayList& list) { rwyList.push_back(list);};
115 void setActive(const string& aptId, double windSpeed, double windHeading, double maxTail, double maxCross, stringVec *curr);
117 int getNrActiveRunways() { return nrActive;};
118 void getActive(int i, string& name, string& type);
120 string getName() { return name; };
121 void clear() { rwyList.clear(); };
122 //void add(string, string);
125 typedef vector<RunwayGroup> PreferenceList;
126 typedef vector<RunwayGroup>::iterator PreferenceListIterator;
127 typedef vector<RunwayGroup>::const_iterator PreferenceListConstIterator;
129 /******************************************************************************/
131 class FGRunwayPreference {
135 ScheduleTime comTimes; // Commercial Traffic;
136 ScheduleTime genTimes; // General Aviation;
137 ScheduleTime milTimes; // Military Traffic;
139 PreferenceList preferences;
144 FGRunwayPreference(FGAirport* ap);
145 FGRunwayPreference(const FGRunwayPreference &other);
147 FGRunwayPreference & operator= (const FGRunwayPreference &other);
149 ScheduleTime *getSchedule(const char *trafficType);
150 RunwayGroup *getGroup(const string& groupName);
154 bool available() { return initialized; };
155 void setInitialized(bool state) { initialized = state; };
157 void setMilTimes(ScheduleTime& t) { milTimes = t; };
158 void setGenTimes(ScheduleTime& t) { genTimes = t; };
159 void setComTimes(ScheduleTime& t) { comTimes = t; };
161 void addRunwayGroup(RunwayGroup& g) { preferences.push_back(g); };