X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FAirports%2Fdynamics.hxx;h=cb489bfa3db458163ef71ac3cb01d0d91eedb8f3;hb=b1854459b3100e4c51e3a5704caa4e2c3869228c;hp=60921821863438f422f2ad51e4c32d441d9dede3;hpb=9197057784f8f68e83fca30a234630dc3ccf4422;p=flightgear.git diff --git a/src/Airports/dynamics.hxx b/src/Airports/dynamics.hxx index 609218218..cb489bfa3 100644 --- a/src/Airports/dynamics.hxx +++ b/src/Airports/dynamics.hxx @@ -22,106 +22,129 @@ #ifndef _AIRPORT_DYNAMICS_HXX_ #define _AIRPORT_DYNAMICS_HXX_ - -#ifndef __cplusplus -# error This library requires C++ -#endif - -#include - #include #include "parking.hxx" #include "groundnetwork.hxx" #include "runwayprefs.hxx" -#include "sidstar.hxx" - -//typedef vector DoubleVec; -//typedef vector::iterator DoubleVecIterator; +// forward decls class FGAirport; - +class FGEnvironment; class FGAirportDynamics { private: - FGAirport* _ap; - - FGParkingVec parkings; - FGRunwayPreference rwyPrefs; - FGSidStar SIDs; - FGStartupController startupController; - FGGroundNetwork groundNetwork; - FGTowerController towerController; - FGApproachController approachController; - - time_t lastUpdate; - string prevTrafficType; - stringVec landing; - stringVec takeoff; - stringVec milActive, comActive, genActive, ulActive; - stringVec *currentlyActive; - intVec freqAwos; // - intVec freqUnicom; // - intVec freqClearance;// - intVec freqGround; // - intVec freqTower; // - intVec freqApproach; // - - string atisInformation; - - string chooseRunwayFallback(); - bool innerGetActiveRunway(const string &trafficType, int action, string &runway, double heading); - string chooseRwyByHeading(stringVec rwys, double heading); + FGAirport* _ap; + + FGParkingVec parkings; + FGRunwayPreference rwyPrefs; + FGStartupController startupController; + FGGroundNetwork groundNetwork; + FGTowerController towerController; + FGApproachController approachController; + + time_t lastUpdate; + std::string prevTrafficType; + stringVec landing; + stringVec takeoff; + stringVec milActive, comActive, genActive, ulActive; + stringVec *currentlyActive; + intVec freqAwos; // + intVec freqUnicom; // + intVec freqClearance;// + intVec freqGround; // + intVec freqTower; // + intVec freqApproach; // + + int atisSequenceIndex; + double atisSequenceTimeStamp; + + std::string chooseRunwayFallback(); + bool innerGetActiveRunway(const std::string &trafficType, int action, std::string &runway, double heading); + std::string chooseRwyByHeading(stringVec rwys, double heading); + + int innerGetAvailableParking(double radius, const std::string & flType, + const std::string & acType, const std::string & airline, + bool skipEmptyAirlineCode); public: - FGAirportDynamics(FGAirport* ap); - FGAirportDynamics(const FGAirportDynamics &other); - ~FGAirportDynamics(); - - void addAwosFreq (int val) { freqAwos.push_back(val); }; - void addUnicomFreq (int val) { freqUnicom.push_back(val); }; - void addClearanceFreq(int val) { freqClearance.push_back(val); }; - void addGroundFreq (int val) { freqGround.push_back(val); }; - void addTowerFreq (int val) { freqTower.push_back(val); }; - void addApproachFreq (int val) { freqApproach.push_back(val); }; - - void init(); - double getLongitude() const; - // Returns degrees - double getLatitude() const; - // Returns ft - double getElevation() const; - const string& getId() const; + FGAirportDynamics(FGAirport* ap); + ~FGAirportDynamics(); + + void addAwosFreq (int val) { + freqAwos.push_back(val); + }; + void addUnicomFreq (int val) { + freqUnicom.push_back(val); + }; + void addClearanceFreq(int val) { + freqClearance.push_back(val); + }; + void addGroundFreq (int val) { + freqGround.push_back(val); + }; + void addTowerFreq (int val) { + freqTower.push_back(val); + }; + void addApproachFreq (int val) { + freqApproach.push_back(val); + }; + + void init(); + + double getElevation() const; + const std::string getId() const; + + FGAirport* parent() const + { return _ap; } - void getActiveRunway(const string& trafficType, int action, string& runway, double heading); - - void addParking(FGParking& park); - bool getAvailableParking(double *lat, double *lon, - double *heading, int *gate, double rad, const string& fltype, - const string& acType, const string& airline); - void getParking (int id, double *lat, double* lon, double *heading); - FGParking *getParking(int i); - void releaseParking(int id); - string getParkingName(int i); - int getNrOfParkings() { return parkings.size(); }; - //FGAirport *getAddress() { return this; }; - //const string &getName() const { return _name;}; - // Returns degrees - - // Departure / Arrival procedures - FGSidStar * getSIDs() { return &SIDs; }; - FGAIFlightPlan * getSID(string activeRunway, double heading); - - - // ATC related functions. - FGStartupController *getStartupController() { return &startupController; }; - FGGroundNetwork *getGroundNetwork() { return &groundNetwork; }; - FGTowerController *getTowerController() { return &towerController; }; - FGApproachController *getApproachController() { return &approachController; }; - - const string& getAtisInformation() { return atisInformation; }; - int getGroundFrequency(unsigned leg); //{ return freqGround.size() ? freqGround[0] : 0; }; - - void setRwyUse(const FGRunwayPreference& ref); + void getActiveRunway(const string& trafficType, int action, string& runway, double heading); + + void addParking(FGParking& park); + + /** + * retrieve an available parking by GateID, or -1 if no suitable + * parking location could be found. + */ + int getAvailableParking(double radius, const std::string& fltype, + const std::string& acType, const std::string& airline); + + FGParking *getParking(int i); + void releaseParking(int id); + std::string getParkingName(int i); + int getNrOfParkings() { + return parkings.size(); + }; + + /** + * Find a parking gate index by name. Note names are often not unique + * in our data, so will return the first match. + */ + int findParkingByName(const std::string& name) const; + + // ATC related functions. + FGStartupController *getStartupController() { + return &startupController; + }; + FGGroundNetwork *getGroundNetwork() { + return &groundNetwork; + }; + FGTowerController *getTowerController() { + return &towerController; + }; + FGApproachController *getApproachController() { + return &approachController; + }; + + int getGroundFrequency(unsigned leg); + int getTowerFrequency (unsigned nr); + + /// get current ATIS sequence letter + const std::string getAtisSequence(); + + /// get the current ATIS sequence number, updating it if necessary + int updateAtisSequence(int interval, bool forceUpdate); + + void setRwyUse(const FGRunwayPreference& ref); };