Nasal library: Difference between revisions

Line 1,507: Line 1,507:
}}
}}


=== findNavaidsByFrequency()===
=== findNavaidsByFrequencyMHz()===
{{Nasal doc
{{Nasal doc
|syntax = findNavaidsByFrequency([pos, ]freq[, type]);
|syntax = findNavaidsByFrequencyMHz([pos, ]freq[, type]);
|source = {{flightgear file|src/Scripting/NasalPositioned.cxx|l=1572|t=Source}}
|source = {{flightgear file|src/Scripting/NasalPositioned.cxx|l=1572|t=Source}}
|text = Returns a vector conatining <code>navaid</code> ghost objects for navaids that match a given frequency, sorted from nearest to furthest.
|text = Returns a vector conatining <code>navaid</code> ghost objects for navaids that match a given frequency, sorted from nearest to furthest.
Line 1,517: Line 1,517:
:* A hash with ''lat'' and ''lon'' members
:* A hash with ''lat'' and ''lon'' members
:* A geo.Coord object
:* A geo.Coord object
:* Two numbers separated by a comma, as if the function is taking three arguments. Example: <code>findNavaidsByFrequency(lat, lon, freq, type);</code>.
:* Two numbers separated by a comma, as if the function is taking three arguments. Example: <code>findNavaidsByFrequencyMHz(lat, lon, freq, type);</code>.
|param2 = freq
|param2 = freq
|param2text = Frequency, in megahertz, of the navaid to search for.
|param2text = Frequency, in megahertz, of the navaid to search for.
|param3 = type
|param3 = type
|param3text = This will narrow the search to navaids of a certain type. Defaults to "all." For the full list of accepted type arguments, see {{flightgear file|src/Navaids/positioned.cxx|l=127}}.
|param3text = This will narrow the search to navaids of a certain type. Defaults to "all." For the full list of accepted type arguments, see {{flightgear file|src/Navaids/positioned.cxx|l=127}}.
|example1 = var navaids = findNavaidsByFrequency(10.955);
|example1 = var navaids = findNavaidsByFrequencyMHz(109.55);
foreach(var navaid; navaids){
foreach(var navaid; navaids){
     print("--");
     print("--");
Line 1,531: Line 1,531:
     print("Elevation (AMSL): ", navaid.elevation, " m");
     print("Elevation (AMSL): ", navaid.elevation, " m");
     print("Type: ", navaid.type);
     print("Type: ", navaid.type);
     print("Frequency: ", sprintf("%.3f", navaid.frequency / 1000), " Mhz");
     print("Frequency: ", sprintf("%.3f", navaid.frequency / 100), " Mhz");
     print("Range: ", navaid.range_nm, " nm");
     print("Range: ", navaid.range_nm, " nm");
     if(navaid.course) print("Course: ", navaid.course);
     if(navaid.course) print("Course: ", navaid.course);
29

edits