I did note the results were slow. It can take up to 5 - 10 seconds to generate the list.
I am looking for a list of ICAOs that branch out from one's current airport within a radius. The below method returns what I want, albeit a bit slow. A listing of ICAOs would be OK, but generating a job with a destination 5000 miles away wouldn't make much sense for most user's amount of time they have to spend in a flying session without being able to save their progress. So I am thinking more of regional jobs that could be completed in 30 minutes to a few hours dependent on the aircraft. Thus the concept of using a list of all ICAOs within x radius of the airport one is grounded at to use with the generation of the random job. Of course it could all be configurable by the user too.
I entertained using the apt.dat file or a custom xml file but wanted to try some of the built-in functions first.
gapalp
-------- Original Message --------
Subject: Re: [Flightgear-devel] airport list
From: James Turner <[email protected]>
Date: Thu, April 12, 2012 3:59 am
To: FlightGear developers discussions
<[email protected]>
On 11 Apr 2012, at 20:48, [email protected] wrote:
> pos = SGGeod::fromDeg(lonn->getDoubleValue(), latn->getDoubleValue());
> apt = FGAirport::findClosest(pos, maxRange, &filter);
> string id = apt->ident();
>
> The above results in id being the single nearest ICAO. Throw this in a loop and iterate the pos lonn/lat the amount of the loop iterator, put the results in an array, then choose a random ICAO from the array using rand(). Then you have a list of ICAOs N, S, E, and W from your current location. The longer the loop or the greater the iterator, the further away the ICAOs go. For example:
Uh, the findClosest (and related FGPositioned functions) use the spatial index, which is probably not what you want - since they're a bit slower.
What exactly *do* you want? The current query functions support querying by position or by ident (possibly a partial ident).
If you're looking for a flat list of all the airport IDs, that may not actually be exposed right now in C++, but would be trivial to add.
James
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________ Flightgear-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/flightgear-devel

