]> git.mxchange.org Git - flightgear.git/commitdiff
adding changed files for previous commit.
authorDurk Talsma <durk@localhost.(none)>
Sun, 3 Apr 2011 15:58:16 +0000 (17:58 +0200)
committerDurk Talsma <durk@localhost.(none)>
Sun, 3 Apr 2011 15:58:16 +0000 (17:58 +0200)
src/AIModel/AIAircraft.cxx
src/ATC/CMakeLists.txt
src/ATC/Makefile.am
src/ATC/trafficcontrol.cxx
src/ATC/trafficcontrol.hxx
src/ATCDCL/ATCDialog.cxx
src/Airports/groundnetwork.cxx
src/Airports/groundnetwork.hxx
src/Main/fg_init.cxx

index d0e3197052a77fe3e332f6be6fa0cc6042e27157..6a4ce077b0a42bd6cccc0f0115cac7ce8bf33b87 100644 (file)
@@ -1088,12 +1088,12 @@ string FGAIAircraft::atGate() {
 void FGAIAircraft::handleATCRequests() {
     //TODO implement NullController for having no ATC to save the conditionals
     if (controller) {
-        controller->update(getID(),
-                           pos.getLatitudeDeg(),
-                           pos.getLongitudeDeg(),
-                           hdg,
-                           speed,
-                           altitude_ft, dt);
+        controller->updateAircraftInformation(getID(),
+                                              pos.getLatitudeDeg(),
+                                              pos.getLongitudeDeg(),
+                                              hdg,
+                                              speed,
+                                              altitude_ft, dt);
         processATC(controller->getInstruction(getID()));
     }
 }
index 60c18e9961530106024cfc2cab2a81e9274f23d0..d7822c9873e63b0c23ba120806658c1798e7896b 100644 (file)
@@ -2,6 +2,7 @@ include(FlightGearComponent)
 
 set(SOURCES
        atis_mgr.cxx
+       atc_mgr.cxx
        trafficcontrol.cxx
        )
        
index e3e52273733eb1f3572eaa67bff2936176d92235..fd5302aac30395eb14fff385c25efdd627be700d 100644 (file)
@@ -2,6 +2,8 @@ noinst_LIBRARIES = libATC.a
 
 libATC_a_SOURCES = \
        atis_mgr.cxx atis_mgr.hxx \
+       atcdialog.cxx atcdialog.hxx \
+       atc_mgr.cxx atc_mgr.hxx \
        trafficcontrol.cxx trafficcontrol.hxx 
 
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src
index 8079933b167d45a6542518ec292049c112a9f594..664929bfc764da04b97d296409f599e38637c19f 100644 (file)
@@ -27,6 +27,7 @@
 #include <algorithm>
 
 #include "trafficcontrol.hxx"
+#include "atc_mgr.hxx"
 #include <AIModel/AIAircraft.hxx>
 #include <AIModel/AIFlightPlan.hxx>
 #include <AIModel/performancedata.hxx>
@@ -447,9 +448,17 @@ bool FGATCInstruction::hasInstruction()
 
 FGATCController::FGATCController()
 {
+    cerr << "running FGATController constructor" << endl;
     dt_count = 0;
     available = true;
     lastTransmission = 0;
+    FGATCManager *mgr = (FGATCManager*) globals->get_subsystem("ATC");
+    mgr->addController(this);
+}
+
+FGATCController::~FGATCController()
+{
+     cerr << "running FGATController destructor" << endl;
 }
 
 string FGATCController::getGateName(FGAIAircraft * ref)
@@ -709,9 +718,9 @@ void FGTowerController::announcePosition(int id,
     }
 }
 
-void FGTowerController::update(int id, double lat, double lon,
-                               double heading, double speed, double alt,
-                               double dt)
+void FGTowerController::updateAircraftInformation(int id, double lat, double lon,
+                                                  double heading, double speed, double alt,
+                                                  double dt)
 {
     TrafficVectorIterator i = activeTraffic.begin();
     // Search whether the current id has an entry
@@ -978,9 +987,9 @@ void FGStartupController::signOff(int id)
     }
 }
 
-void FGStartupController::update(int id, double lat, double lon,
-                                 double heading, double speed, double alt,
-                                 double dt)
+void FGStartupController::updateAircraftInformation(int id, double lat, double lon,
+                                                    double heading, double speed, double alt,
+                                                    double dt)
 {
     TrafficVectorIterator i = activeTraffic.begin();
     // Search search if the current id has an entry
@@ -1160,9 +1169,9 @@ void FGApproachController::announcePosition(int id,
     }
 }
 
-void FGApproachController::update(int id, double lat, double lon,
-                                  double heading, double speed, double alt,
-                                  double dt)
+void FGApproachController::updateAircraftInformation(int id, double lat, double lon,
+                                                     double heading, double speed, double alt,
+                                                     double dt)
 {
     TrafficVectorIterator i = activeTraffic.begin();
     // Search search if the current id has an entry
index 7e83a72b476097808a23c9745046a93eab2d1a64..2550f7cb6adbee7d53820a2a0a6ed76a03197241 100644 (file)
@@ -31,6 +31,8 @@
 // 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>
 
 
 
@@ -257,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;
 
@@ -291,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);
@@ -319,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);
@@ -346,7 +348,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);
index f5f5ec935d3f337e7b1efe4ad1cb7b2e613d503b..a1c3c5e846bbf4a41503b3481ebd346b8b9265f4 100644 (file)
@@ -46,6 +46,7 @@ FGATCDialog *current_atcdialog;
 
 // For the command manager - maybe eventually this should go in the built in command list
 static bool do_ATC_dialog(const SGPropertyNode* arg) {
+        cerr << "Running ATCDCL do_ATC_dialog" << endl;
        current_atcdialog->PopupDialog();
        return(true);
 }
@@ -101,39 +102,39 @@ FGATCDialog::~FGATCDialog() {
 
 void FGATCDialog::Init() {
        // Add ATC-dialog to the command list
-       globals->get_commands()->addCommand("ATC-dialog", do_ATC_dialog);
+       //globals->get_commands()->addCommand("ATC-dialog", do_ATC_dialog);
        // Add ATC-freq-search to the command list
-       globals->get_commands()->addCommand("ATC-freq-search", do_ATC_freq_search);
+       //globals->get_commands()->addCommand("ATC-freq-search", do_ATC_freq_search);
 
        // initialize properties polled in Update()
-       globals->get_props()->setStringValue("/sim/atc/freq-airport", "");
-       globals->get_props()->setIntValue("/sim/atc/transmission-num", -1);
+       //globals->get_props()->setStringValue("/sim/atc/freq-airport", "");
+       //globals->get_props()->setIntValue("/sim/atc/transmission-num", -1);
 }
 
 void FGATCDialog::Update(double dt) {
-       static SGPropertyNode_ptr airport = globals->get_props()->getNode("/sim/atc/freq-airport", true);
-       string s = airport->getStringValue();
-       if (!s.empty()) {
-               airport->setStringValue("");
-               FreqDisplay(s);
-       }
-
-       static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
-       int n = trans_num->getIntValue();
-       if (n >= 0) {
-               trans_num->setIntValue(-1);
-               PopupCallback(n);
-       }
-
-       if(_callbackPending) {
-               if(_callbackTimer > _callbackWait) {
-                       _callbackPtr->ReceiveUserCallback(_callbackCode);
-                       _callbackPtr->NotifyTransmissionFinished(fgGetString("/sim/user/callsign"));
-                       _callbackPending = false;
-               } else {
-                       _callbackTimer += dt;
-               }
-       }
+       //static SGPropertyNode_ptr airport = globals->get_props()->getNode("/sim/atc/freq-airport", true);
+       //string s = airport->getStringValue();
+       //if (!s.empty()) {
+       //      airport->setStringValue("");
+       //      FreqDisplay(s);
+       //}
+
+       //static SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
+       //int n = trans_num->getIntValue();
+       //if (n >= 0) {
+       //      trans_num->setIntValue(-1);
+       //      PopupCallback(n);
+       //}
+
+       //if(_callbackPending) {
+       //      if(_callbackTimer > _callbackWait) {
+       //              _callbackPtr->ReceiveUserCallback(_callbackCode);
+       //              _callbackPtr->NotifyTransmissionFinished(fgGetString("/sim/user/callsign"));
+       //              _callbackPending = false;
+       //      } else {
+       //              _callbackTimer += dt;
+       //      }
+       //}
 }
 
 // Add an entry
index 2fb8127a5f675b4547b05f33b7ac420c29de6a92..3ba65015859e7a13d1d02197797223b9162c4c90 100644 (file)
@@ -510,9 +510,9 @@ void FGGroundNetwork::signOff(int id)
     }
 }
 
-void FGGroundNetwork::update(int id, double lat, double lon,
-                             double heading, double speed, double alt,
-                             double dt)
+void FGGroundNetwork::updateAircraftInformation(int id, double lat, double lon,
+                                                double heading, double speed, double alt,
+                                                double dt)
 {
     // Check whether aircraft are on hold due to a preceding pushback. If so, make sure to 
     // Transmit air-to-ground "Ready to taxi request:
index fe83d4df25cd51b4db5e2b4fcac2001b9836628d..06ed98b12710f1f92aa1137a2a60cb78ca129d2f 100644 (file)
@@ -269,7 +269,7 @@ public:
                                double lat, double lon, 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, double heading, double speed, double alt, double dt);
+  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);
 
index 9eb8ae7a96b576906e9bbae5b1e87e907acc3332..7d3e6ce2859a96c804ab3501dfd246bc73ce06dc 100644 (file)
@@ -77,6 +77,7 @@
 #include <ATCDCL/ATCmgr.hxx>
 #include <ATCDCL/commlist.hxx>
 #include <ATC/atis_mgr.hxx>
+#include <ATC/atc_mgr.hxx>
 
 #include <Autopilot/route_mgr.hxx>
 #include <Autopilot/autopilotgroup.hxx>
@@ -1384,6 +1385,10 @@ bool fgInitSubsystems() {
 
     ////////////////////////////////////////////////////////////////////
     // Initialise the ATC Manager
+    // Note that this is old stuff, but might be necessesary for the 
+    // current ATIS implementation. Therefore, leave it in here
+    // until the ATIS system is ported over to make use of the ATIS 
+    // sub system infrastructure.
     ////////////////////////////////////////////////////////////////////
 
     SG_LOG(SG_GENERAL, SG_INFO, "  ATC Manager");
@@ -1391,7 +1396,11 @@ bool fgInitSubsystems() {
     globals->get_ATC_mgr()->init(); 
 
     ////////////////////////////////////////////////////////////////////
-    // Initialise the ATIS Manager
+   // Initialize the ATC subsystem
+    ////////////////////////////////////////////////////////////////////
+    globals->add_subsystem("ATC", new FGATCManager, SGSubsystemMgr::POST_FDM);
+    ////////////////////////////////////////////////////////////////////
+    // Initialise the ATIS Subsystem
     ////////////////////////////////////////////////////////////////////
     globals->add_subsystem("atis", new FGAtisManager, SGSubsystemMgr::POST_FDM);