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_
27 #include "airports_fwd.hxx"
29 #include <simgear/compiler.h>
32 typedef std::vector<time_t> timeVec;
33 typedef std::vector<time_t>::const_iterator timeVecConstIterator;
35 typedef std::vector<std::string> stringVec;
36 typedef std::vector<std::string>::iterator stringVecIterator;
37 typedef std::vector<std::string>::const_iterator stringVecConstIterator;
40 /***************************************************************************/
45 stringVec scheduleNames;
49 ScheduleTime() : tailWind(0), crssWind(0) {};
50 ScheduleTime(const ScheduleTime &other);
51 ScheduleTime &operator= (const ScheduleTime &other);
52 std::string getName(time_t dayStart);
55 void addStartTime(time_t time) { start.push_back(time); };
56 void addEndTime (time_t time) { end. push_back(time); };
57 void addScheduleName(const std::string& sched) { scheduleNames.push_back(sched); };
58 void setTailWind(double wnd) { tailWind = wnd; };
59 void setCrossWind(double wnd) { tailWind = wnd; };
61 double getTailWind() { return tailWind; };
62 double getCrossWind() { return crssWind; };
65 //typedef vector<ScheduleTime> ScheduleTimes;
66 /*****************************************************************************/
72 stringVec preferredRunways;
75 RunwayList(const RunwayList &other);
76 RunwayList& operator= (const RunwayList &other);
78 void set(const std::string&, const std::string&);
81 std::string getType() { return type; };
82 stringVec *getRwyList() { return &preferredRunways; };
83 std::string getRwyList(int j) { return preferredRunways[j]; };
86 /*****************************************************************************/
92 RunwayListVec rwyList;
94 //stringVec runwayNames;
100 RunwayGroup(const RunwayGroup &other);
101 RunwayGroup &operator= (const RunwayGroup &other);
103 void setName(const std::string& nm) { name = nm; };
104 void add(const RunwayList& list) { rwyList.push_back(list);};
105 void setActive(const FGAirport* airport, double windSpeed, double windHeading, double maxTail, double maxCross, stringVec *curr);
107 int getNrActiveRunways() { return nrActive;};
108 void getActive(int i, std::string& name, std::string& type);
110 std::string getName() { return name; };
111 void clear() { rwyList.clear(); };
112 //void add(string, string);
115 /******************************************************************************/
117 class FGRunwayPreference {
121 ScheduleTime comTimes; // Commercial Traffic;
122 ScheduleTime genTimes; // General Aviation;
123 ScheduleTime milTimes; // Military Traffic;
124 ScheduleTime ulTimes; // Ultralight Traffic
126 PreferenceList preferences;
131 FGRunwayPreference(FGAirport* ap);
132 FGRunwayPreference(const FGRunwayPreference &other);
134 FGRunwayPreference & operator= (const FGRunwayPreference &other);
136 ScheduleTime *getSchedule(const char *trafficType);
137 RunwayGroup *getGroup(const std::string& groupName);
141 bool available() { return initialized; };
142 void setInitialized(bool state) { initialized = state; };
144 void setMilTimes(ScheduleTime& t) { milTimes = t; };
145 void setGenTimes(ScheduleTime& t) { genTimes = t; };
146 void setComTimes(ScheduleTime& t) { comTimes = t; };
147 void setULTimes (ScheduleTime& t) { ulTimes = t; };
149 void addRunwayGroup(RunwayGroup& g) { preferences.push_back(g); };