]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/trafficcontrol.hxx
adding changed files for previous commit.
[flightgear.git] / src / ATC / trafficcontrol.hxx
index d069a5b84120af9e5fa2773b4f13383c0b3f7dde..2550f7cb6adbee7d53820a2a0a6ed76a03197241 100644 (file)
 
 
 #include <simgear/compiler.h>
+// There is probably a better include than sg_geodesy to get the SG_NM_TO_METER...
+#include <simgear/math/sg_geodesy.hxx>
 #include <simgear/debug/logstream.hxx>
+#include <simgear/structure/SGReferenced.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
 
 
 
@@ -185,6 +189,9 @@ public:
 typedef vector<FGTrafficRecord> TrafficVector;
 typedef vector<FGTrafficRecord>::iterator TrafficVectorIterator;
 
+typedef vector<time_t> TimeVector;
+typedef vector<time_t>::iterator TimeVectorIterator;
+
 
 /***********************************************************************
  * Active runway, a utility class to keep track of which aircraft has
@@ -195,11 +202,18 @@ class ActiveRunway
 private:
   string rwy;
   int currentlyCleared;
+  double distanceToFinal;
+  TimeVector estimatedArrivalTimes;
 public:
-  ActiveRunway(string r, int cc) { rwy = r; currentlyCleared = cc; };
+  ActiveRunway(string r, int cc) { rwy = r; currentlyCleared = cc; distanceToFinal = 6.0 * SG_NM_TO_METER; };
   
   string getRunwayName() { return rwy; };
   int    getCleared   () { return currentlyCleared; };
+  double getApproachDistance() { return distanceToFinal; };
+  //time_t getEstApproachTime() { return estimatedArrival; };
+
+  //void setEstApproachTime(time_t time) { estimatedArrival = time; };
+  time_t requestTimeSlot(time_t eta);
 };
 
 typedef vector<ActiveRunway> ActiveRunwayVec;
@@ -207,7 +221,7 @@ typedef vector<ActiveRunway>::iterator ActiveRunwayVecIterator;
 
 /**
  * class FGATCController
- * NOTE: this class serves as an abstraction layer for all sorts of ATC controller. 
+ * NOTE: this class serves as an abstraction layer for all sorts of ATC controllers
  *************************************************************************************/
 class FGATCController
 {
@@ -245,14 +259,14 @@ public:
       ATC_AIR_TO_GROUND,
       ATC_GROUND_TO_AIR } AtcMsgDir;
   FGATCController();
-  virtual ~FGATCController() {};
+  virtual ~FGATCController();
   virtual void announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute,
-                               double lat, double lon,
-                               double hdg, double spd, double alt, double radius, int leg,
-                               FGAIAircraft *aircraft) = 0;
+                                double lat, double lon,
+                                double hdg, double spd, double alt, double radius, int leg,
+                                FGAIAircraft *aircraft) = 0;
   virtual void             signOff(int id) = 0;
-  virtual void             update(int id, double lat, double lon, 
-                                 double heading, double speed, double alt, double dt) = 0;
+  virtual void             updateAircraftInformation(int id, double lat, double lon, 
+                                                     double heading, double speed, double alt, double dt) = 0;
   virtual bool             hasInstruction(int id) = 0;
   virtual FGATCInstruction getInstruction(int id) = 0;
 
@@ -279,7 +293,7 @@ public:
                                double hdg, double spd, double alt, double radius, int leg,
                                FGAIAircraft *aircraft);
   virtual void             signOff(int id);
-  virtual void             update(int id, double lat, double lon, 
+  virtual void             updateAircraftInformation(int id, double lat, double lon, 
                                  double heading, double speed, double alt, double dt);
   virtual bool             hasInstruction(int id);
   virtual FGATCInstruction getInstruction(int id);
@@ -307,7 +321,7 @@ public:
                                double hdg, double spd, double alt, double radius, int leg,
                                FGAIAircraft *aircraft);
   virtual void             signOff(int id);
-  virtual void             update(int id, double lat, double lon, 
+  virtual void             updateAircraftInformation(int id, double lat, double lon, 
                                  double heading, double speed, double alt, double dt);
   virtual bool             hasInstruction(int id);
   virtual FGATCInstruction getInstruction(int id);
@@ -317,4 +331,33 @@ public:
 
 }; 
 
+/******************************************************************************
+ * class FGTowerControl
+ *****************************************************************************/
+class FGApproachController : public FGATCController
+{
+private:
+  TrafficVector activeTraffic;
+  ActiveRunwayVec activeRunways;
+  
+public:
+  FGApproachController();
+  virtual ~FGApproachController() {};
+  virtual void announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute,
+                               double lat, double lon,
+                               double hdg, double spd, double alt, double radius, int leg,
+                               FGAIAircraft *aircraft);
+  virtual void             signOff(int id);
+  virtual void             updateAircraftInformation(int id, double lat, double lon, 
+                                 double heading, double speed, double alt, double dt);
+  virtual bool             hasInstruction(int id);
+  virtual FGATCInstruction getInstruction(int id);
+
+  ActiveRunway* getRunway(string name);
+
+  bool hasActiveTraffic() { return activeTraffic.size() != 0; };
+  TrafficVector &getActiveTraffic() { return activeTraffic; };
+};
+
+
 #endif // _TRAFFIC_CONTROL_HXX