atc-tools 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3602725c8298247e099c14114440fc513f7336c
4
- data.tar.gz: 04d7dd9baff676f4df466fadc1b810922806ca55
3
+ metadata.gz: 6ce0be091c80b540d74acd8ea12ed054137421e5
4
+ data.tar.gz: ea2a91d44a6653870287569f0e2373b5dbdcfd8e
5
5
  SHA512:
6
- metadata.gz: a014a92afe577fffc128fbe9ab072fffca59b6806ad7b0f202c399fd0690c505de6f6f11bf437d2886317c5234a368bce0d958cda09d778c836880079ef73194
7
- data.tar.gz: b44bb60a41f0df0d046094a95b7030b5aba93bf98f302e838f0f7a04dcd4af2e06be03c456006185dab60ea5e8b2e3f8b3d440d3803237e942b670352b558e28
6
+ metadata.gz: 4612f2a2fe3744a3763205e999a3e5743992b01184315d1615d5173fc9cfdfd1f6085c94cb8715b9edc8e2990bdb0e765a8f0850e2e3563b7bb18eb5d8c17c0f
7
+ data.tar.gz: 382a9f4fd5852e3530478bf2bb2892060202ea34a8e3185547d4691abbd3e041faece0dbce2c403000382049ebca67427ec61b04f4231524bf3fede03751c15d
@@ -433,9 +433,11 @@ variance.</p>
433
433
 
434
434
 
435
435
  <div class="method-source-code" id="magnetic_to_true-source">
436
- <pre><span class="ruby-comment"># File lib/atc-tools/airport.rb, line 95</span>
436
+ <pre><span class="ruby-comment"># File lib/atc-tools/airport.rb, line 97</span>
437
437
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">magnetic_to_true</span>(<span class="ruby-identifier">heading</span>)
438
- <span class="ruby-identifier">heading</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@variance</span>
438
+ <span class="ruby-identifier">value</span> = <span class="ruby-identifier">heading</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@variance</span>
439
+ <span class="ruby-identifier">value</span> <span class="ruby-operator">-=</span> <span class="ruby-value">360.0</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">360.0</span>
440
+ <span class="ruby-identifier">value</span>
439
441
  <span class="ruby-keyword">end</span></pre>
440
442
  </div><!-- magnetic_to_true-source -->
441
443
 
@@ -501,7 +503,7 @@ to act as a direct replacement for string input.</p>
501
503
 
502
504
 
503
505
  <div class="method-source-code" id="to_s-source">
504
- <pre><span class="ruby-comment"># File lib/atc-tools/airport.rb, line 101</span>
506
+ <pre><span class="ruby-comment"># File lib/atc-tools/airport.rb, line 105</span>
505
507
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
506
508
  <span class="ruby-ivar">@code</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
507
509
  <span class="ruby-keyword">end</span></pre>
@@ -611,7 +613,9 @@ variance.</p>
611
613
  <div class="method-source-code" id="true_to_magnetic-source">
612
614
  <pre><span class="ruby-comment"># File lib/atc-tools/airport.rb, line 89</span>
613
615
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">true_to_magnetic</span>(<span class="ruby-identifier">heading</span>)
614
- <span class="ruby-identifier">heading</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@variance</span>
616
+ <span class="ruby-identifier">value</span> = <span class="ruby-identifier">heading</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@variance</span>
617
+ <span class="ruby-identifier">value</span> <span class="ruby-operator">+=</span> <span class="ruby-value">360.0</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>
618
+ <span class="ruby-identifier">value</span>
615
619
  <span class="ruby-keyword">end</span></pre>
616
620
  </div><!-- true_to_magnetic-source -->
617
621
 
@@ -77,6 +77,8 @@
77
77
 
78
78
  <li ><a href="#method-i-altitude_valid-3F">#altitude_valid?</a>
79
79
 
80
+ <li ><a href="#method-i-cruise-3D">#cruise=</a>
81
+
80
82
  <li ><a href="#method-i-heading">#heading</a>
81
83
 
82
84
  <li ><a href="#method-i-to_s">#to_s</a>
@@ -197,7 +199,7 @@
197
199
  <div id="attribute-i-cruise" class="method-detail">
198
200
  <div class="method-heading attribute-method-heading">
199
201
  <span class="method-name">cruise</span><span
200
- class="attribute-access-type">[RW]</span>
202
+ class="attribute-access-type">[R]</span>
201
203
  </div>
202
204
 
203
205
  <div class="method-description">
@@ -377,13 +379,16 @@
377
379
  <span class="ruby-ivar">@heading</span> = <span class="ruby-ivar">@depart</span>.<span class="ruby-identifier">magnetic_heading_to</span> <span class="ruby-ivar">@arrive</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@heading</span>
378
380
 
379
381
  <span class="ruby-comment"># Strip the zeros off of the altitude for even/odd comparison.</span>
380
- <span class="ruby-identifier">cruise_stripped</span> = <span class="ruby-ivar">@cruise</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/0/</span>, <span class="ruby-string">&#39;&#39;</span>).<span class="ruby-identifier">to_i</span>
382
+ <span class="ruby-identifier">len</span> = <span class="ruby-value">0</span>
383
+ <span class="ruby-identifier">len</span> = <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@cruise</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">5</span>
384
+ <span class="ruby-identifier">cruise_stripped</span> = <span class="ruby-ivar">@cruise</span>.<span class="ruby-identifier">to_s</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">len</span>].<span class="ruby-identifier">to_i</span>
385
+
381
386
  <span class="ruby-identifier">is_north_east</span> = (<span class="ruby-ivar">@heading</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">180</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@heading</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">360</span>)
382
387
 
383
388
  <span class="ruby-identifier">rules</span> = <span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">upcase</span>.<span class="ruby-identifier">to_sym</span>
384
389
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">rules</span>
385
390
  <span class="ruby-keyword">when</span> <span class="ruby-value">:IFR</span>
386
- <span class="ruby-identifier">above_fl410</span> = <span class="ruby-identifier">cruise_stripped</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">41</span>
391
+ <span class="ruby-identifier">above_fl410</span> = <span class="ruby-ivar">@cruise</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">/</span> <span class="ruby-value">100</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">410</span>
387
392
 
388
393
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">above_fl410</span>
389
394
  <span class="ruby-identifier">east_alt</span> = [<span class="ruby-value">45</span>, <span class="ruby-value">49</span>, <span class="ruby-value">53</span>, <span class="ruby-value">57</span>, <span class="ruby-value">61</span>]
@@ -414,6 +419,46 @@
414
419
  </div><!-- altitude_valid-3F-method -->
415
420
 
416
421
 
422
+ <div id="method-i-cruise-3D" class="method-detail ">
423
+
424
+ <div class="method-heading">
425
+ <span class="method-name">cruise=</span><span
426
+ class="method-args">(value)</span>
427
+
428
+ <span class="method-click-advice">click to toggle source</span>
429
+
430
+ </div>
431
+
432
+
433
+ <div class="method-description">
434
+
435
+ <p>Cruising altitude. Can accept a standard cruising altitude (33000) or
436
+ flight level (FL370).</p>
437
+
438
+
439
+
440
+
441
+ <div class="method-source-code" id="cruise-3D-source">
442
+ <pre><span class="ruby-comment"># File lib/atc-tools/flight_plan.rb, line 98</span>
443
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">cruise=</span>(<span class="ruby-identifier">value</span>)
444
+ <span class="ruby-comment"># Strip letters from the cruising altitude.</span>
445
+ <span class="ruby-identifier">v</span> = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/[a-zA-Z]/</span>, <span class="ruby-string">&#39;&#39;</span>).<span class="ruby-identifier">to_i</span>
446
+
447
+ <span class="ruby-comment"># Append two zeros if the altitude is a flight level (three digits).</span>
448
+ <span class="ruby-identifier">v</span> <span class="ruby-operator">*=</span> <span class="ruby-value">100</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1000</span>
449
+
450
+ <span class="ruby-ivar">@cruise</span> = <span class="ruby-identifier">v</span>
451
+ <span class="ruby-keyword">end</span></pre>
452
+ </div><!-- cruise-3D-source -->
453
+
454
+ </div>
455
+
456
+
457
+
458
+
459
+ </div><!-- cruise-3D-method -->
460
+
461
+
417
462
  <div id="method-i-heading" class="method-detail ">
418
463
 
419
464
  <div class="method-heading">
@@ -467,7 +512,7 @@
467
512
 
468
513
 
469
514
  <div class="method-source-code" id="to_s-source">
470
- <pre><span class="ruby-comment"># File lib/atc-tools/flight_plan.rb, line 98</span>
515
+ <pre><span class="ruby-comment"># File lib/atc-tools/flight_plan.rb, line 113</span>
471
516
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
472
517
  <span class="ruby-identifier">data</span> = <span class="ruby-value">&lt;&lt;EOS
473
518
  Callsign: #{@callsign}
@@ -516,7 +561,7 @@ EOS</span>
516
561
 
517
562
 
518
563
  <div class="method-source-code" id="validate-source">
519
- <pre><span class="ruby-comment"># File lib/atc-tools/flight_plan.rb, line 94</span>
564
+ <pre><span class="ruby-comment"># File lib/atc-tools/flight_plan.rb, line 109</span>
520
565
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">validate</span>
521
566
  <span class="ruby-keyword">end</span></pre>
522
567
  </div><!-- validate-source -->
@@ -573,7 +573,7 @@ no aircraft is selected.</p>
573
573
  <span class="ruby-comment"># ---------------</span>
574
574
  <span class="ruby-comment"># TODO: Implement</span>
575
575
  <span class="ruby-comment"># ---------------</span>
576
- <span class="ruby-identifier">result</span> = <span class="ruby-node">&quot;Aircraft type code &#39;#{&#39;xxx&#39;}&#39; not found in database.&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">empty?</span>
576
+ <span class="ruby-identifier">result</span> = <span class="ruby-string">&quot;Aircraft type code not found in database.&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">empty?</span>
577
577
 
578
578
  <span class="ruby-comment"># File.delete @aclog_path</span>
579
579
  <span class="ruby-keyword">end</span>
@@ -1,7 +1,7 @@
1
- Sat, 26 Oct 2013 14:37:04 -0700
1
+ Sun, 27 Oct 2013 02:17:13 -0700
2
2
  lib/atc-tools.rb Thu, 26 Sep 2013 19:45:13 -0700
3
3
  lib/atc-tools/aircraft.rb Fri, 27 Sep 2013 20:48:21 -0700
4
- lib/atc-tools/airport.rb Sat, 26 Oct 2013 14:31:09 -0700
5
- lib/atc-tools/flight_plan.rb Fri, 27 Sep 2013 20:47:34 -0700
4
+ lib/atc-tools/airport.rb Sun, 27 Oct 2013 00:26:06 -0700
5
+ lib/atc-tools/flight_plan.rb Sun, 27 Oct 2013 02:13:57 -0700
6
6
  lib/atc-tools/script/flight_plan_validator.rb Fri, 27 Sep 2013 23:04:46 -0700
7
- lib/atc-tools/vrc.rb Fri, 27 Sep 2013 20:46:09 -0700
7
+ lib/atc-tools/vrc.rb Sat, 26 Oct 2013 14:42:44 -0700
@@ -1 +1 @@
1
- var search_data = {"index":{"searchIndex":["atctools","aircraft","airport","flightplan","flightplanvalidator","headingdiscoveryerror","namediscoveryerror","noaircraftselectederror","vrc","activate_terminal_window!()","activate_vrc_window!()","aircraft_selected?()","altitude_valid?()","command_line()","discover_name()","discover_variance()","execute_command()","execute_command!()","flight_plan()","flight_plan_title()","heading()","magnetic_heading_from()","magnetic_heading_to()","magnetic_to_true()","name()","new()","new()","new()","new()","run()","selected_aircraft()","selected_aircraft_info!()","selected_flight_plan!()","to_s()","to_s()","to_s()","true_heading_from()","true_heading_to()","true_to_magnetic()","validate()"],"longSearchIndex":["atctools","atctools::aircraft","atctools::airport","atctools::flightplan","atctools::flightplanvalidator","atctools::headingdiscoveryerror","atctools::namediscoveryerror","atctools::noaircraftselectederror","atctools::vrc","atctools::vrc#activate_terminal_window!()","atctools::vrc#activate_vrc_window!()","atctools::vrc#aircraft_selected?()","atctools::flightplan#altitude_valid?()","atctools::vrc#command_line()","atctools::airport#discover_name()","atctools::airport#discover_variance()","atctools::vrc#execute_command()","atctools::vrc#execute_command!()","atctools::flightplanvalidator::flight_plan()","atctools::vrc#flight_plan_title()","atctools::flightplan#heading()","atctools::airport#magnetic_heading_from()","atctools::airport#magnetic_heading_to()","atctools::airport#magnetic_to_true()","atctools::airport#name()","atctools::aircraft::new()","atctools::airport::new()","atctools::flightplan::new()","atctools::vrc::new()","atctools::flightplanvalidator::run()","atctools::vrc#selected_aircraft()","atctools::vrc#selected_aircraft_info!()","atctools::vrc#selected_flight_plan!()","atctools::aircraft#to_s()","atctools::airport#to_s()","atctools::flightplan#to_s()","atctools::airport#true_heading_from()","atctools::airport#true_heading_to()","atctools::airport#true_to_magnetic()","atctools::flightplan#validate()"],"info":[["ATCTools","","ATCTools.html","",""],["ATCTools::Aircraft","","ATCTools/Aircraft.html","",""],["ATCTools::Airport","","ATCTools/Airport.html","",""],["ATCTools::FlightPlan","","ATCTools/FlightPlan.html","",""],["ATCTools::FlightPlanValidator","","ATCTools/FlightPlanValidator.html","","<p>Script that extracts a flight plan from VRC.\n"],["ATCTools::HeadingDiscoveryError","","ATCTools/HeadingDiscoveryError.html","",""],["ATCTools::NameDiscoveryError","","ATCTools/NameDiscoveryError.html","",""],["ATCTools::NoAircraftSelectedError","","ATCTools/NoAircraftSelectedError.html","",""],["ATCTools::VRC","","ATCTools/VRC.html","","<p>A class for interfacing with the Virtual Radar Client application.\nwww1.metacraft.com/VRC/\n<p>Methods with …\n"],["activate_terminal_window!","ATCTools::VRC","ATCTools/VRC.html#method-i-activate_terminal_window-21","()","<p>Activate the terminal (command line) window, bringing it to the foreground.\n"],["activate_vrc_window!","ATCTools::VRC","ATCTools/VRC.html#method-i-activate_vrc_window-21","()","<p>Activate the VRC window, bringing it to the foreground.\n"],["aircraft_selected?","ATCTools::VRC","ATCTools/VRC.html#method-i-aircraft_selected-3F","()","<p>True if an aircraft is selected.\n"],["altitude_valid?","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-altitude_valid-3F","()","<p>Validate the cruising altitude given the arrival airport and flight rules.\n"],["command_line","ATCTools::VRC","ATCTools/VRC.html#method-i-command_line","()","<p>Extract the text from the command line.\n"],["discover_name","ATCTools::Airport","ATCTools/Airport.html#method-i-discover_name","()","<p>Discover the airport&#39;s full name based on ICAO code.\n"],["discover_variance","ATCTools::Airport","ATCTools/Airport.html#method-i-discover_variance","()","<p>Discover the airport&#39;s magnetic variance based on ICAO code.\n"],["execute_command","ATCTools::VRC","ATCTools/VRC.html#method-i-execute_command","(cmd)","<p>Execute a command in the VRC client. Preserves partially-entered commands\nin the text box.\n"],["execute_command!","ATCTools::VRC","ATCTools/VRC.html#method-i-execute_command-21","(cmd)","<p>Execute a command in the VRC client, overwriting any partially-entered\ncommand in the text box.\n"],["flight_plan","ATCTools::FlightPlanValidator","ATCTools/FlightPlanValidator.html#method-c-flight_plan","()","<p>The last flight plan returned.\n"],["flight_plan_title","ATCTools::VRC","ATCTools/VRC.html#method-i-flight_plan_title","()","<p>Title of the VRC flight plan window. This includes the pilot&#39;s callsign\nand real name.\n"],["heading","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-heading","()","<p>Magnetic heading from the departure to arrival airport.\n"],["magnetic_heading_from","ATCTools::Airport","ATCTools/Airport.html#method-i-magnetic_heading_from","(departure)","<p>Calculate the magnetic heading from the specified airport. Takes an ICAO\ncode or Airport object.\n"],["magnetic_heading_to","ATCTools::Airport","ATCTools/Airport.html#method-i-magnetic_heading_to","(arrival)","<p>Calculate the magnetic heading to the specified airport. Takes an ICAO code\nor Airport object.\n"],["magnetic_to_true","ATCTools::Airport","ATCTools/Airport.html#method-i-magnetic_to_true","(heading)","<p>Convert a magnetic heading to true based on the airport&#39;s magnetic\nvariance.\n"],["name","ATCTools::Airport","ATCTools/Airport.html#method-i-name","()","<p>Airport&#39;s full name.\n"],["new","ATCTools::Aircraft","ATCTools/Aircraft.html#method-c-new","(aircraft_code = nil, **kvargs)","<p>Params:\n\n<pre>:info, :model, :code, :equipment\n-- See instance variables for descriptions.</pre>\n"],["new","ATCTools::Airport","ATCTools/Airport.html#method-c-new","(code = nil, **kvargs)","<p>Params: :code, :name, :variance\n"],["new","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-c-new","(**kvargs)","<p>Params:\n\n<pre>:callsign, :aircraft, :rules, :depart, :arrive, :alternate, :cruse,\n:squawk, :route, :remarks, ...</pre>\n"],["new","ATCTools::VRC","ATCTools/VRC.html#method-c-new","(**kvargs)","<p>Params:\n\n<pre>:aclog_path - Location of the VRC log dump for the aircraft info query.</pre>\n"],["run","ATCTools::FlightPlanValidator","ATCTools/FlightPlanValidator.html#method-c-run","()","<p>Note: Executing this script will call commands in the VRC client and will\ninterfere with the user.\n"],["selected_aircraft","ATCTools::VRC","ATCTools/VRC.html#method-i-selected_aircraft","()","<p>Extracts the callsign of the selected aircraft. Returns an empty string if\nno aircraft is selected.\n"],["selected_aircraft_info!","ATCTools::VRC","ATCTools/VRC.html#method-i-selected_aircraft_info-21","()","<p>Extracts the aircraft info for the selected aircraft.\n"],["selected_flight_plan!","ATCTools::VRC","ATCTools/VRC.html#method-i-selected_flight_plan-21","()","<p>Extracts the flight plan of the selected aircraft.\n"],["to_s","ATCTools::Aircraft","ATCTools/Aircraft.html#method-i-to_s","()","<p>Returns @raw.\n"],["to_s","ATCTools::Airport","ATCTools/Airport.html#method-i-to_s","()","<p>Print the Airport ICAO code. Allows the object to act as a direct\nreplacement for string input.\n"],["to_s","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-to_s","()","<p>Returns a human-readable version of the flight plan.\n"],["true_heading_from","ATCTools::Airport","ATCTools/Airport.html#method-i-true_heading_from","(departure)","<p>Calculate the true heading from the specified airport. Takes an ICAO code\nor Airport object.\n"],["true_heading_to","ATCTools::Airport","ATCTools/Airport.html#method-i-true_heading_to","(arrival)","<p>Calculate the true heading to the specified airport. Takes an ICAO code or\nAirport object.\n"],["true_to_magnetic","ATCTools::Airport","ATCTools/Airport.html#method-i-true_to_magnetic","(heading)","<p>Convert a true heading to magnetic based on the airport&#39;s magnetic\nvariance.\n"],["validate","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-validate","()","<p>Validate the flight plan.\n"]]}}
1
+ var search_data = {"index":{"searchIndex":["atctools","aircraft","airport","flightplan","flightplanvalidator","headingdiscoveryerror","namediscoveryerror","noaircraftselectederror","vrc","activate_terminal_window!()","activate_vrc_window!()","aircraft_selected?()","altitude_valid?()","command_line()","cruise=()","discover_name()","discover_variance()","execute_command()","execute_command!()","flight_plan()","flight_plan_title()","heading()","magnetic_heading_from()","magnetic_heading_to()","magnetic_to_true()","name()","new()","new()","new()","new()","run()","selected_aircraft()","selected_aircraft_info!()","selected_flight_plan!()","to_s()","to_s()","to_s()","true_heading_from()","true_heading_to()","true_to_magnetic()","validate()"],"longSearchIndex":["atctools","atctools::aircraft","atctools::airport","atctools::flightplan","atctools::flightplanvalidator","atctools::headingdiscoveryerror","atctools::namediscoveryerror","atctools::noaircraftselectederror","atctools::vrc","atctools::vrc#activate_terminal_window!()","atctools::vrc#activate_vrc_window!()","atctools::vrc#aircraft_selected?()","atctools::flightplan#altitude_valid?()","atctools::vrc#command_line()","atctools::flightplan#cruise=()","atctools::airport#discover_name()","atctools::airport#discover_variance()","atctools::vrc#execute_command()","atctools::vrc#execute_command!()","atctools::flightplanvalidator::flight_plan()","atctools::vrc#flight_plan_title()","atctools::flightplan#heading()","atctools::airport#magnetic_heading_from()","atctools::airport#magnetic_heading_to()","atctools::airport#magnetic_to_true()","atctools::airport#name()","atctools::aircraft::new()","atctools::airport::new()","atctools::flightplan::new()","atctools::vrc::new()","atctools::flightplanvalidator::run()","atctools::vrc#selected_aircraft()","atctools::vrc#selected_aircraft_info!()","atctools::vrc#selected_flight_plan!()","atctools::aircraft#to_s()","atctools::airport#to_s()","atctools::flightplan#to_s()","atctools::airport#true_heading_from()","atctools::airport#true_heading_to()","atctools::airport#true_to_magnetic()","atctools::flightplan#validate()"],"info":[["ATCTools","","ATCTools.html","",""],["ATCTools::Aircraft","","ATCTools/Aircraft.html","",""],["ATCTools::Airport","","ATCTools/Airport.html","",""],["ATCTools::FlightPlan","","ATCTools/FlightPlan.html","",""],["ATCTools::FlightPlanValidator","","ATCTools/FlightPlanValidator.html","","<p>Script that extracts a flight plan from VRC.\n"],["ATCTools::HeadingDiscoveryError","","ATCTools/HeadingDiscoveryError.html","",""],["ATCTools::NameDiscoveryError","","ATCTools/NameDiscoveryError.html","",""],["ATCTools::NoAircraftSelectedError","","ATCTools/NoAircraftSelectedError.html","",""],["ATCTools::VRC","","ATCTools/VRC.html","","<p>A class for interfacing with the Virtual Radar Client application.\nwww1.metacraft.com/VRC/\n<p>Methods with …\n"],["activate_terminal_window!","ATCTools::VRC","ATCTools/VRC.html#method-i-activate_terminal_window-21","()","<p>Activate the terminal (command line) window, bringing it to the foreground.\n"],["activate_vrc_window!","ATCTools::VRC","ATCTools/VRC.html#method-i-activate_vrc_window-21","()","<p>Activate the VRC window, bringing it to the foreground.\n"],["aircraft_selected?","ATCTools::VRC","ATCTools/VRC.html#method-i-aircraft_selected-3F","()","<p>True if an aircraft is selected.\n"],["altitude_valid?","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-altitude_valid-3F","()","<p>Validate the cruising altitude given the arrival airport and flight rules.\n"],["command_line","ATCTools::VRC","ATCTools/VRC.html#method-i-command_line","()","<p>Extract the text from the command line.\n"],["cruise=","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-cruise-3D","(value)","<p>Cruising altitude. Can accept a standard cruising altitude (33000) or\nflight level (FL370).\n"],["discover_name","ATCTools::Airport","ATCTools/Airport.html#method-i-discover_name","()","<p>Discover the airport&#39;s full name based on ICAO code.\n"],["discover_variance","ATCTools::Airport","ATCTools/Airport.html#method-i-discover_variance","()","<p>Discover the airport&#39;s magnetic variance based on ICAO code.\n"],["execute_command","ATCTools::VRC","ATCTools/VRC.html#method-i-execute_command","(cmd)","<p>Execute a command in the VRC client. Preserves partially-entered commands\nin the text box.\n"],["execute_command!","ATCTools::VRC","ATCTools/VRC.html#method-i-execute_command-21","(cmd)","<p>Execute a command in the VRC client, overwriting any partially-entered\ncommand in the text box.\n"],["flight_plan","ATCTools::FlightPlanValidator","ATCTools/FlightPlanValidator.html#method-c-flight_plan","()","<p>The last flight plan returned.\n"],["flight_plan_title","ATCTools::VRC","ATCTools/VRC.html#method-i-flight_plan_title","()","<p>Title of the VRC flight plan window. This includes the pilot&#39;s callsign\nand real name.\n"],["heading","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-heading","()","<p>Magnetic heading from the departure to arrival airport.\n"],["magnetic_heading_from","ATCTools::Airport","ATCTools/Airport.html#method-i-magnetic_heading_from","(departure)","<p>Calculate the magnetic heading from the specified airport. Takes an ICAO\ncode or Airport object.\n"],["magnetic_heading_to","ATCTools::Airport","ATCTools/Airport.html#method-i-magnetic_heading_to","(arrival)","<p>Calculate the magnetic heading to the specified airport. Takes an ICAO code\nor Airport object.\n"],["magnetic_to_true","ATCTools::Airport","ATCTools/Airport.html#method-i-magnetic_to_true","(heading)","<p>Convert a magnetic heading to true based on the airport&#39;s magnetic\nvariance.\n"],["name","ATCTools::Airport","ATCTools/Airport.html#method-i-name","()","<p>Airport&#39;s full name.\n"],["new","ATCTools::Aircraft","ATCTools/Aircraft.html#method-c-new","(aircraft_code = nil, **kvargs)","<p>Params:\n\n<pre>:info, :model, :code, :equipment\n-- See instance variables for descriptions.</pre>\n"],["new","ATCTools::Airport","ATCTools/Airport.html#method-c-new","(code = nil, **kvargs)","<p>Params: :code, :name, :variance\n"],["new","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-c-new","(**kvargs)","<p>Params:\n\n<pre>:callsign, :aircraft, :rules, :depart, :arrive, :alternate, :cruse,\n:squawk, :route, :remarks, ...</pre>\n"],["new","ATCTools::VRC","ATCTools/VRC.html#method-c-new","(**kvargs)","<p>Params:\n\n<pre>:aclog_path - Location of the VRC log dump for the aircraft info query.</pre>\n"],["run","ATCTools::FlightPlanValidator","ATCTools/FlightPlanValidator.html#method-c-run","()","<p>Note: Executing this script will call commands in the VRC client and will\ninterfere with the user.\n"],["selected_aircraft","ATCTools::VRC","ATCTools/VRC.html#method-i-selected_aircraft","()","<p>Extracts the callsign of the selected aircraft. Returns an empty string if\nno aircraft is selected.\n"],["selected_aircraft_info!","ATCTools::VRC","ATCTools/VRC.html#method-i-selected_aircraft_info-21","()","<p>Extracts the aircraft info for the selected aircraft.\n"],["selected_flight_plan!","ATCTools::VRC","ATCTools/VRC.html#method-i-selected_flight_plan-21","()","<p>Extracts the flight plan of the selected aircraft.\n"],["to_s","ATCTools::Aircraft","ATCTools/Aircraft.html#method-i-to_s","()","<p>Returns @raw.\n"],["to_s","ATCTools::Airport","ATCTools/Airport.html#method-i-to_s","()","<p>Print the Airport ICAO code. Allows the object to act as a direct\nreplacement for string input.\n"],["to_s","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-to_s","()","<p>Returns a human-readable version of the flight plan.\n"],["true_heading_from","ATCTools::Airport","ATCTools/Airport.html#method-i-true_heading_from","(departure)","<p>Calculate the true heading from the specified airport. Takes an ICAO code\nor Airport object.\n"],["true_heading_to","ATCTools::Airport","ATCTools/Airport.html#method-i-true_heading_to","(arrival)","<p>Calculate the true heading to the specified airport. Takes an ICAO code or\nAirport object.\n"],["true_to_magnetic","ATCTools::Airport","ATCTools/Airport.html#method-i-true_to_magnetic","(heading)","<p>Convert a true heading to magnetic based on the airport&#39;s magnetic\nvariance.\n"],["validate","ATCTools::FlightPlan","ATCTools/FlightPlan.html#method-i-validate","()","<p>Validate the flight plan.\n"]]}}
@@ -81,6 +81,8 @@
81
81
 
82
82
  <li class="method"><a href="ATCTools/VRC.html#method-i-command_line">#command_line &mdash; ATCTools::VRC</a>
83
83
 
84
+ <li class="method"><a href="ATCTools/FlightPlan.html#method-i-cruise-3D">#cruise= &mdash; ATCTools::FlightPlan</a>
85
+
84
86
  <li class="method"><a href="ATCTools/Airport.html#method-i-discover_name">#discover_name &mdash; ATCTools::Airport</a>
85
87
 
86
88
  <li class="method"><a href="ATCTools/Airport.html#method-i-discover_variance">#discover_variance &mdash; ATCTools::Airport</a>
@@ -107,12 +109,12 @@
107
109
 
108
110
  <li class="method"><a href="ATCTools/VRC.html#method-i-selected_flight_plan-21">#selected_flight_plan! &mdash; ATCTools::VRC</a>
109
111
 
112
+ <li class="method"><a href="ATCTools/Airport.html#method-i-to_s">#to_s &mdash; ATCTools::Airport</a>
113
+
110
114
  <li class="method"><a href="ATCTools/FlightPlan.html#method-i-to_s">#to_s &mdash; ATCTools::FlightPlan</a>
111
115
 
112
116
  <li class="method"><a href="ATCTools/Aircraft.html#method-i-to_s">#to_s &mdash; ATCTools::Aircraft</a>
113
117
 
114
- <li class="method"><a href="ATCTools/Airport.html#method-i-to_s">#to_s &mdash; ATCTools::Airport</a>
115
-
116
118
  <li class="method"><a href="ATCTools/Airport.html#method-i-true_heading_from">#true_heading_from &mdash; ATCTools::Airport</a>
117
119
 
118
120
  <li class="method"><a href="ATCTools/Airport.html#method-i-true_heading_to">#true_heading_to &mdash; ATCTools::Airport</a>
@@ -87,13 +87,17 @@ module ATCTools
87
87
  # Convert a true heading to magnetic based on the airport's
88
88
  # magnetic variance.
89
89
  def true_to_magnetic(heading)
90
- heading - @variance
90
+ value = heading - @variance
91
+ value += 360.0 if value < 0
92
+ value
91
93
  end
92
94
 
93
95
  # Convert a magnetic heading to true based on the airport's
94
96
  # magnetic variance.
95
97
  def magnetic_to_true(heading)
96
- heading + @variance
98
+ value = heading + @variance
99
+ value -= 360.0 if value > 360.0
100
+ value
97
101
  end
98
102
 
99
103
  # Print the Airport ICAO code.
@@ -16,7 +16,7 @@ module ATCTools
16
16
  # Alternate airport.
17
17
  attr_accessor :alternate
18
18
  # Cruising altitude.
19
- attr_accessor :cruise
19
+ attr_reader :cruise
20
20
  # Squawk code.
21
21
  attr_accessor :squawk
22
22
  # Flight route.
@@ -62,13 +62,16 @@ module ATCTools
62
62
  @heading = @depart.magnetic_heading_to @arrive unless @heading
63
63
 
64
64
  # Strip the zeros off of the altitude for even/odd comparison.
65
- cruise_stripped = @cruise.to_s.gsub(/0/, '').to_i
65
+ len = 0
66
+ len = 1 if @cruise.to_s.length >= 5
67
+ cruise_stripped = @cruise.to_s[0..len].to_i
68
+
66
69
  is_north_east = (@heading < 180 || @heading >= 360)
67
70
 
68
71
  rules = @rules.upcase.to_sym
69
72
  case rules
70
73
  when :IFR
71
- above_fl410 = cruise_stripped > 41
74
+ above_fl410 = @cruise.to_i / 100 > 410
72
75
 
73
76
  if above_fl410
74
77
  east_alt = [45, 49, 53, 57, 61]
@@ -90,6 +93,18 @@ module ATCTools
90
93
  false
91
94
  end
92
95
 
96
+ # Cruising altitude.
97
+ # Can accept a standard cruising altitude (33000) or flight level (FL370).
98
+ def cruise=(value)
99
+ # Strip letters from the cruising altitude.
100
+ v = value.to_s.gsub(/[a-zA-Z]/, '').to_i
101
+
102
+ # Append two zeros if the altitude is a flight level (three digits).
103
+ v *= 100 if v < 1000
104
+
105
+ @cruise = v
106
+ end
107
+
93
108
  # Validate the flight plan.
94
109
  def validate
95
110
  end
@@ -122,7 +122,7 @@ module ATCTools
122
122
  # ---------------
123
123
  # TODO: Implement
124
124
  # ---------------
125
- result = "Aircraft type code '#{'xxx'}' not found in database." if result.empty?
125
+ result = "Aircraft type code not found in database." if result.empty?
126
126
 
127
127
  # File.delete @aclog_path
128
128
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atc-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McLain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-26 00:00:00.000000000 Z
11
+ date: 2013-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rautomation