| 1 | // GroundController.hxx - forked from groundnetwork.cxx |
| 2 | // |
| 3 | // Written by Durk Talsma, started June 2005. |
| 4 | // |
| 5 | // Copyright (C) 2004 Durk Talsma. |
| 6 | // |
| 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. |
| 11 | // |
| 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. |
| 16 | // |
| 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | // |
| 21 | // $Id$ |
| 22 | |
| 23 | #ifndef ATC_GROUND_CONTROLLER_HXX |
| 24 | #define ATC_GROUND_CONTROLLER_HXX |
| 25 | |
| 26 | #include <simgear/compiler.h> |
| 27 | |
| 28 | #include <string> |
| 29 | |
| 30 | #include <ATC/trafficcontrol.hxx> |
| 31 | #include <ATC/TowerController.hxx> |
| 32 | |
| 33 | class FGAirportDynamics; |
| 34 | |
| 35 | |
| 36 | /************************************************************************************** |
| 37 | * class FGGroundController |
| 38 | *************************************************************************************/ |
| 39 | class FGGroundController : public FGATCController |
| 40 | { |
| 41 | private: |
| 42 | |
| 43 | bool hasNetwork; |
| 44 | bool networkInitialized; |
| 45 | int count; |
| 46 | int version; |
| 47 | |
| 48 | FGTowerController *towerController; |
| 49 | /**Returns the frequency to be used. */ |
| 50 | int getFrequency(); |
| 51 | |
| 52 | |
| 53 | void checkSpeedAdjustment(int id, double lat, double lon, |
| 54 | double heading, double speed, double alt); |
| 55 | void checkHoldPosition(int id, double lat, double lon, |
| 56 | double heading, double speed, double alt); |
| 57 | |
| 58 | |
| 59 | void updateStartupTraffic(TrafficVectorIterator i, int& priority, time_t now); |
| 60 | bool updateActiveTraffic(TrafficVectorIterator i, int& priority, time_t now); |
| 61 | public: |
| 62 | FGGroundController(FGAirportDynamics *par); |
| 63 | ~FGGroundController(); |
| 64 | |
| 65 | void setVersion (int v) { version = v;}; |
| 66 | int getVersion() { return version; }; |
| 67 | |
| 68 | bool exists() { |
| 69 | return hasNetwork; |
| 70 | }; |
| 71 | void setTowerController(FGTowerController *twrCtrlr) { |
| 72 | towerController = twrCtrlr; |
| 73 | }; |
| 74 | |
| 75 | |
| 76 | virtual void announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute, |
| 77 | double lat, double lon, double hdg, double spd, double alt, |
| 78 | double radius, int leg, FGAIAircraft *aircraft); |
| 79 | virtual void updateAircraftInformation(int id, SGGeod geod, double heading, double speed, double alt, double dt); |
| 80 | |
| 81 | bool checkForCircularWaits(int id); |
| 82 | virtual void render(bool); |
| 83 | virtual std::string getName(); |
| 84 | virtual void update(double dt); |
| 85 | |
| 86 | void addVersion(int v) {version = v; }; |
| 87 | }; |
| 88 | |
| 89 | |
| 90 | #endif |