X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FATC%2Fcommlist.hxx;h=1cb2f4855c72b6457d95c5f9014c287f587897f6;hb=4a79d82ba62fa4e5be759fa0fc4b20220e8da303;hp=033b90afa7a7e6ff50b10ee41e1f31bdc84a7a38;hpb=1154a0dae220ee6eecb773e1b1f81c1b164554cf;p=flightgear.git diff --git a/src/ATC/commlist.hxx b/src/ATC/commlist.hxx index 033b90afa..1cb2f4855 100644 --- a/src/ATC/commlist.hxx +++ b/src/ATC/commlist.hxx @@ -3,7 +3,7 @@ // Written by David Luff and Alexander Kappes, started Jan 2003. // Based on navlist.hxx by Curtis Olson, started April 2000. // -// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org +// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -17,7 +17,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /***************************************************************** * @@ -44,6 +44,7 @@ #include "ATC.hxx" #include "atis.hxx" +SG_USING_STD(list); SG_USING_STD(map); SG_USING_STD(vector); SG_USING_STD(string); @@ -67,7 +68,7 @@ public: ~FGCommList(); // load all comm frequencies and build the map - bool init( SGPath path ); + bool init( const SGPath& path ); // query the database for the specified frequency, lon and lat are // in degrees, elev is in meters. @@ -77,19 +78,30 @@ public: // The data found is written into the passed-in ATCData structure. bool FindByFreq( double lon, double lat, double elev, double freq, ATCData* ad, atc_type tp = INVALID ); - // query the database by location, lon and lat are - // in degrees, elev is in meters - // Returns the number of stations of the specified type that are in range, and pushes them into stations - // If atc_type is specifed, returns the number of all stations in range, and pushes them into stations + // query the database by location, lon and lat are in degrees, elev is in meters, range is in nautical miles. + // Returns the number of stations of the specified atc_type tp that are in range of the position defined by + // lon, lat and elev, and pushes them into stations. + // If no atc_type is specifed, returns the number of all stations in range, and pushes them into stations // ** stations is erased before use ** - int FindByPos( double lon, double lat, double elev, comm_list_type* stations, atc_type tp = INVALID ); + int FindByPos( double lon, double lat, double elev, double range, comm_list_type* stations, atc_type tp = INVALID ); + + // Returns the distance in meters to the closest station of a given type, + // with the details written into ATCData& ad. If no type is specifed simply + // returns the distance to the closest station of any type. + // Returns -9999 if no stations found within max_range in nautical miles (default 100 miles). + // Note that the search algorithm starts at 10 miles and multiplies by 10 thereafter, so if + // say 300 miles is specifed 10, then 100, then 1000 will be searched, breaking at first result + // and giving up after 1000. + // !!!Be warned that searching anything over 100 miles will pause the sim unacceptably!!! + // (The ability to search longer ranges should be used during init only). + double FindClosest( double lon, double lat, double elev, ATCData& ad, atc_type tp = INVALID, double max_range = 100.0 ); // Find by Airport code. - bool FindByCode( string ICAO, ATCData& ad, atc_type tp = INVALID ); + bool FindByCode( const string& ICAO, ATCData& ad, atc_type tp = INVALID ); - // Return the callsign for an ATIS transmission given transmission time and airpord id + // Return the callsign for an ATIS transmission given transmission time and airport id // This maybe should get moved somewhere else!! - int GetCallSign( string apt_id, int hours, int mins ); + int GetCallSign( const string& apt_id, int hours, int mins ); private: @@ -100,7 +112,7 @@ private: comm_map_type commlist_bck; // Load comms from a specified path (which must include the filename) - bool LoadComms(SGPath path); + bool LoadComms(const SGPath& path); //----------- This stuff is left over from atislist.[ch]xx and maybe should move somewhere else // Add structure and map for storing a log of atis transmissions