On 12 Apr 2012, at 14:54, gap...@gapalp.net wrote: > 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.
Aha. So what you actually want it all *sensible* airports within a certain NM cut-off. Where sensible means, likely to generate cargo - no grass/gravel strips, or, well, maybe, depending on the kind of cargo you're modelling - northern Canadian or remote Australian supply runs? You can generate what you need in a single call, possibly creating a new AirportFilter subclass to implement the size criteria. The call you need is: FGPositioned::findWithinRange Passing in your desired cutoff in *nautical miles*, and a suitable filter object. For a filter object, subclass FGAirport::AirportFilter or FGAirport::HardSurfaceFilter, and extend it to reject / pass airports you deem unsuitable for your cargo traffic. For examples of subclassing these, look at MapAirportFilter, MetarAirportFilter or AirportInfoFilter. Note that 'findWithinRange' is generally used in the simulator for ranges *less* than 1000nm, at which point the performance is 'fast enough' - if you start to increase the range to 2000nm, I don't know how it will perform - let me know! Any other questions, just ask. 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 Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel