#include "ATCmgr.hxx"
#include "commlist.hxx"
-//#include "atislist.hxx"
-//#include "groundlist.hxx"
-//#include "towerlist.hxx"
-//#include "approachlist.hxx"
#include "ATCdisplay.hxx"
#include "ATCDialog.hxx"
#include "ATCutils.hxx"
elev = elev_node->getDoubleValue() * SG_FEET_TO_METER;
// search stations in range
- int num_app = current_commlist->FindByPos(lon, lat, elev, &approaches, APPROACH);
+ int num_app = current_commlist->FindByPos(lon, lat, elev, 100.0, &approaches, APPROACH);
if (num_app != 0) {
//cout << num_app << " approaches found in radiostack search !!!!" << endl;
return false;
}
-int FGCommList::FindByPos(double lon, double lat, double elev, comm_list_type* stations, atc_type tp)
+int FGCommList::FindByPos(double lon, double lat, double elev, double range, comm_list_type* stations, atc_type tp)
{
// number of relevant stations found within range
int found = 0;
SGBucket buck(lon, lat);
// get neigboring buckets
- int max_range = 100;
- int bx = (int)( max_range*SG_NM_TO_METER / buck.get_width_m() / 2);
- int by = (int)( max_range*SG_NM_TO_METER / buck.get_height_m() / 2 );
+ int bx = (int)( range*SG_NM_TO_METER / buck.get_width_m() / 2);
+ int by = (int)( range*SG_NM_TO_METER / buck.get_height_m() / 2 );
// loop over bucket range
- for ( int i=-bx; i<bx; i++) {
- for ( int j=-by; j<by; j++) {
+ for ( int i=-bx; i<=bx; i++) {
+ for ( int j=-by; j<=by; j++) {
buck = sgBucketOffset(lon, lat, i, j);
long int bucket = buck.gen_index();
comm_list_type Fstations = commlist_bck[bucket];
FGAirport a;
if ( dclFindAirportID( ICAO, &a ) ) {
comm_list_type stations;
- int found = FindByPos(a.longitude, a.latitude, a.elevation, &stations, tp);
+ int found = FindByPos(a.longitude, a.latitude, a.elevation, 10.0, &stations, tp);
if(found) {
comm_list_iterator itr = stations.begin();
while(itr != stations.end()) {
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
+ // in degrees, elev is in meters, range is in nautical miles.
// 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
+ // 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 );
// Find by Airport code.
bool FindByCode( 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 );