From: <ga...@ga...> - 2012-04-12 13:54:40
|
<html><body><span style="font-family:Verdana; color:#000000; font-size:10pt;"><div>I did note the results were slow. It can take up to 5 - 10 seconds to generate the list. </div> <div> </div> <div>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.</div> <div> </div> <div>I entertained using the apt.dat file or a custom xml file but wanted to try some of the built-in functions first.<BR></div> <div><BR></div> <div>gapalp</div> <div><a href="mailto:ga...@ga...">ga...@ga...</a></div> <div> </div> <div> </div> <BLOCKQUOTE style="BORDER-LEFT: blue 2px solid; PADDING-LEFT: 8px; FONT-FAMILY: verdana; COLOR: black; MARGIN-LEFT: 8px; FONT-SIZE: 10pt" id=replyBlockquote webmail="1"> <DIV id=wmQuoteWrapper>-------- Original Message --------<BR>Subject: Re: [Flightgear-devel] airport list<BR>From: James Turner <<a href="mailto:zak...@ma...">zak...@ma...</a>><BR>Date: Thu, April 12, 2012 3:59 am<BR>To: FlightGear developers discussions<BR><<a href="mailto:fli...@li...">fli...@li...</a>><BR><BR><BR>On 11 Apr 2012, at 20:48, <a href="mailto:ga...@ga...">ga...@ga...</a> wrote:<BR><BR>> pos = SGGeod::fromDeg(lonn->getDoubleValue(), latn->getDoubleValue());<BR>> apt = FGAirport::findClosest(pos, maxRange, &filter);<BR>> string id = apt->ident();<BR>> <BR>> 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:<BR><BR>Uh, the findClosest (and related FGPositioned functions) use the spatial index, which is probably not what you want - since they're a bit slower.<BR><BR>What exactly *do* you want? The current query functions support querying by position or by ident (possibly a partial ident).<BR><BR>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.<BR><BR>James<BR><BR><BR>------------------------------------------------------------------------------<BR>For Developers, A Lot Can Happen In A Second.<BR>Boundary is the first to Know...and Tell You.<BR>Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!<BR><a href="http://p.sf.net/sfu/Boundary-d2dvs2">http://p.sf.net/sfu/Boundary-d2dvs2</a><BR>_______________________________________________<BR>Flightgear-devel mailing list<BR><a href="mailto:Fli...@li...">Fli...@li...</a><BR><a href="https://lists.sourceforge.net/lists/listinfo/flightgear-devel">https://lists.sourceforge.net/lists/listinfo/flightgear-devel</a><BR></DIV></BLOCKQUOTE></span></body></html> |