atc-tools 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/bin/fpv +3 -0
  3. data/doc/ATCTools.html +133 -0
  4. data/doc/ATCTools/Aircraft.html +309 -0
  5. data/doc/ATCTools/Airport.html +634 -0
  6. data/doc/ATCTools/FlightPlan.html +544 -0
  7. data/doc/ATCTools/FlightPlanValidator.html +265 -0
  8. data/doc/ATCTools/HeadingDiscoveryError.html +135 -0
  9. data/doc/ATCTools/HeadingError.html +135 -0
  10. data/doc/ATCTools/NameDiscoveryError.html +135 -0
  11. data/doc/ATCTools/NoAircraftSelectedError.html +135 -0
  12. data/doc/ATCTools/VRC.html +656 -0
  13. data/doc/Aircraft.html +127 -0
  14. data/doc/Airport.html +564 -0
  15. data/doc/FlightPlan.html +127 -0
  16. data/doc/HeadingError.html +127 -0
  17. data/doc/NameDiscoveryError.html +127 -0
  18. data/doc/created.rid +7 -0
  19. data/doc/images/add.png +0 -0
  20. data/doc/images/arrow_up.png +0 -0
  21. data/doc/images/brick.png +0 -0
  22. data/doc/images/brick_link.png +0 -0
  23. data/doc/images/bug.png +0 -0
  24. data/doc/images/bullet_black.png +0 -0
  25. data/doc/images/bullet_toggle_minus.png +0 -0
  26. data/doc/images/bullet_toggle_plus.png +0 -0
  27. data/doc/images/date.png +0 -0
  28. data/doc/images/delete.png +0 -0
  29. data/doc/images/find.png +0 -0
  30. data/doc/images/loadingAnimation.gif +0 -0
  31. data/doc/images/macFFBgHack.png +0 -0
  32. data/doc/images/package.png +0 -0
  33. data/doc/images/page_green.png +0 -0
  34. data/doc/images/page_white_text.png +0 -0
  35. data/doc/images/page_white_width.png +0 -0
  36. data/doc/images/plugin.png +0 -0
  37. data/doc/images/ruby.png +0 -0
  38. data/doc/images/tag_blue.png +0 -0
  39. data/doc/images/tag_green.png +0 -0
  40. data/doc/images/transparent.png +0 -0
  41. data/doc/images/wrench.png +0 -0
  42. data/doc/images/wrench_orange.png +0 -0
  43. data/doc/images/zoom.png +0 -0
  44. data/doc/index.html +87 -0
  45. data/doc/js/darkfish.js +155 -0
  46. data/doc/js/jquery.js +18 -0
  47. data/doc/js/navigation.js +142 -0
  48. data/doc/js/search.js +94 -0
  49. data/doc/js/search_index.js +1 -0
  50. data/doc/js/searcher.js +228 -0
  51. data/doc/rdoc.css +595 -0
  52. data/doc/table_of_contents.html +132 -0
  53. data/lib/atc-tools.rb +1 -0
  54. data/lib/atc-tools/aircraft.rb +36 -0
  55. data/lib/atc-tools/airport.rb +103 -0
  56. data/lib/atc-tools/flight_plan.rb +119 -0
  57. data/lib/atc-tools/script/flight_plan_validator.rb +65 -0
  58. data/lib/atc-tools/vrc.rb +165 -0
  59. data/license.txt +19 -0
  60. metadata +174 -0
@@ -0,0 +1,127 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class Aircraft - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/vrc-tools/aircraft.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+ <nav id="parent-class-section" class="section">
62
+ <h3 class="section-header">Parent</h3>
63
+
64
+ <p class="link">Object
65
+
66
+ </nav>
67
+
68
+
69
+
70
+
71
+ </div>
72
+
73
+ <div id="project-metadata">
74
+
75
+ <nav id="classindex-section" class="section project-section">
76
+ <h3 class="section-header">Class and Module Index</h3>
77
+
78
+ <ul class="link-list">
79
+
80
+ <li><a href="./Aircraft.html">Aircraft</a>
81
+
82
+ <li><a href="./Airport.html">Airport</a>
83
+
84
+ <li><a href="./FlightPlan.html">FlightPlan</a>
85
+
86
+ <li><a href="./HeadingError.html">HeadingError</a>
87
+
88
+ <li><a href="./NameDiscoveryError.html">NameDiscoveryError</a>
89
+
90
+ </ul>
91
+ </nav>
92
+
93
+ </div>
94
+ </nav>
95
+
96
+ <div id="documentation">
97
+ <h1 class="class">class Aircraft</h1>
98
+
99
+ <div id="description" class="description">
100
+
101
+ </div><!-- description -->
102
+
103
+
104
+
105
+
106
+ <section id="5Buntitled-5D" class="documentation-section">
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <!-- Methods -->
116
+
117
+ </section><!-- 5Buntitled-5D -->
118
+
119
+ </div><!-- documentation -->
120
+
121
+
122
+ <footer id="validator-badges">
123
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
124
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
125
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
126
+ </footer>
127
+
@@ -0,0 +1,564 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class Airport - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/vrc-tools/airport.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+ <nav id="parent-class-section" class="section">
62
+ <h3 class="section-header">Parent</h3>
63
+
64
+ <p class="link">Object
65
+
66
+ </nav>
67
+
68
+
69
+
70
+ <!-- Method Quickref -->
71
+ <nav id="method-list-section" class="section">
72
+ <h3 class="section-header">Methods</h3>
73
+
74
+ <ul class="link-list">
75
+
76
+ <li ><a href="#method-c-new">::new</a>
77
+
78
+ <li ><a href="#method-i-discover_name">#discover_name</a>
79
+
80
+ <li ><a href="#method-i-discover_variance">#discover_variance</a>
81
+
82
+ <li ><a href="#method-i-magnetic_heading_from">#magnetic_heading_from</a>
83
+
84
+ <li ><a href="#method-i-magnetic_heading_to">#magnetic_heading_to</a>
85
+
86
+ <li ><a href="#method-i-magnetic_to_true">#magnetic_to_true</a>
87
+
88
+ <li ><a href="#method-i-to_s">#to_s</a>
89
+
90
+ <li ><a href="#method-i-true_heading_from">#true_heading_from</a>
91
+
92
+ <li ><a href="#method-i-true_heading_to">#true_heading_to</a>
93
+
94
+ <li ><a href="#method-i-true_to_magnetic">#true_to_magnetic</a>
95
+
96
+ </ul>
97
+ </nav>
98
+
99
+ </div>
100
+
101
+ <div id="project-metadata">
102
+
103
+ <nav id="classindex-section" class="section project-section">
104
+ <h3 class="section-header">Class and Module Index</h3>
105
+
106
+ <ul class="link-list">
107
+
108
+ <li><a href="./Aircraft.html">Aircraft</a>
109
+
110
+ <li><a href="./Airport.html">Airport</a>
111
+
112
+ <li><a href="./FlightPlan.html">FlightPlan</a>
113
+
114
+ <li><a href="./HeadingError.html">HeadingError</a>
115
+
116
+ <li><a href="./NameDiscoveryError.html">NameDiscoveryError</a>
117
+
118
+ </ul>
119
+ </nav>
120
+
121
+ </div>
122
+ </nav>
123
+
124
+ <div id="documentation">
125
+ <h1 class="class">class Airport</h1>
126
+
127
+ <div id="description" class="description">
128
+
129
+ </div><!-- description -->
130
+
131
+
132
+
133
+
134
+ <section id="5Buntitled-5D" class="documentation-section">
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ <!-- Attributes -->
143
+ <section id="attribute-method-details" class="method-section section">
144
+ <h3 class="section-header">Attributes</h3>
145
+
146
+
147
+ <div id="attribute-i-code" class="method-detail">
148
+ <div class="method-heading attribute-method-heading">
149
+ <span class="method-name">code</span><span
150
+ class="attribute-access-type">[RW]</span>
151
+ </div>
152
+
153
+ <div class="method-description">
154
+
155
+ <p>Airport&#39;s ICAO code.</p>
156
+
157
+ </div>
158
+ </div>
159
+
160
+ <div id="attribute-i-name" class="method-detail">
161
+ <div class="method-heading attribute-method-heading">
162
+ <span class="method-name">name</span><span
163
+ class="attribute-access-type">[RW]</span>
164
+ </div>
165
+
166
+ <div class="method-description">
167
+
168
+ <p>Airport&#39;s full name.</p>
169
+
170
+ </div>
171
+ </div>
172
+
173
+ <div id="attribute-i-variance" class="method-detail">
174
+ <div class="method-heading attribute-method-heading">
175
+ <span class="method-name">variance</span><span
176
+ class="attribute-access-type">[RW]</span>
177
+ </div>
178
+
179
+ <div class="method-description">
180
+
181
+ <p>Airport&#39;s magnetic variance from true north.</p>
182
+
183
+ </div>
184
+ </div>
185
+
186
+ </section><!-- attribute-method-details -->
187
+
188
+
189
+ <!-- Methods -->
190
+
191
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
192
+ <h3 class="section-header">Public Class Methods</h3>
193
+
194
+
195
+ <div id="method-c-new" class="method-detail ">
196
+
197
+ <div class="method-heading">
198
+ <span class="method-name">new</span><span
199
+ class="method-args">(**kvargs)</span>
200
+
201
+ <span class="method-click-advice">click to toggle source</span>
202
+
203
+ </div>
204
+
205
+
206
+ <div class="method-description">
207
+
208
+ <p>Params: :code, :name, :variance</p>
209
+
210
+
211
+
212
+
213
+ <div class="method-source-code" id="new-source">
214
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 16</span>
215
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">kvargs</span>)
216
+ <span class="ruby-ivar">@code</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:code</span>, <span class="ruby-string">&#39;&#39;</span>
217
+ <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:name</span>, <span class="ruby-string">&#39;&#39;</span>
218
+ <span class="ruby-ivar">@variance</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:variance</span>, <span class="ruby-value">17.0</span> <span class="ruby-comment"># TODO: Detect this intelligently.</span>
219
+ <span class="ruby-keyword">end</span></pre>
220
+ </div><!-- new-source -->
221
+
222
+ </div>
223
+
224
+
225
+
226
+
227
+ </div><!-- new-method -->
228
+
229
+
230
+ </section><!-- public-class-method-details -->
231
+
232
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
233
+ <h3 class="section-header">Public Instance Methods</h3>
234
+
235
+
236
+ <div id="method-i-discover_name" class="method-detail ">
237
+
238
+ <div class="method-heading">
239
+ <span class="method-name">discover_name</span><span
240
+ class="method-args">()</span>
241
+
242
+ <span class="method-click-advice">click to toggle source</span>
243
+
244
+ </div>
245
+
246
+
247
+ <div class="method-description">
248
+
249
+ <p>Discover the airport&#39;s full name based on ICAO code.</p>
250
+
251
+
252
+
253
+
254
+ <div class="method-source-code" id="discover_name-source">
255
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 24</span>
256
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">discover_name</span>
257
+ <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span> <span class="ruby-node">&quot;http://www.airnav.com/airport/#{@code.to_s.downcase}&quot;</span>
258
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get</span> <span class="ruby-identifier">uri</span>
259
+
260
+ <span class="ruby-identifier">l</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">scan</span> <span class="ruby-regexp">%r{(?i:&lt;title&gt;)(?:AirNav:\s*\w*\s*-\s*)?(.*)(?i:&lt;/title&gt;)}</span>
261
+
262
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameDiscoveryError</span>, <span class="ruby-node">&quot;Could not discover name for #{@code.to_s.upcase}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
263
+
264
+ <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">l</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">first</span>
265
+ <span class="ruby-keyword">end</span></pre>
266
+ </div><!-- discover_name-source -->
267
+
268
+ </div>
269
+
270
+
271
+
272
+
273
+ </div><!-- discover_name-method -->
274
+
275
+
276
+ <div id="method-i-discover_variance" class="method-detail ">
277
+
278
+ <div class="method-heading">
279
+ <span class="method-name">discover_variance</span><span
280
+ class="method-args">()</span>
281
+
282
+ <span class="method-click-advice">click to toggle source</span>
283
+
284
+ </div>
285
+
286
+
287
+ <div class="method-description">
288
+
289
+ <p>Discover the airport&#39;s magnetic variance based on ICAO code.</p>
290
+
291
+
292
+
293
+
294
+ <div class="method-source-code" id="discover_variance-source">
295
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 38</span>
296
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">discover_variance</span>
297
+ <span class="ruby-keyword">end</span></pre>
298
+ </div><!-- discover_variance-source -->
299
+
300
+ </div>
301
+
302
+
303
+
304
+
305
+ </div><!-- discover_variance-method -->
306
+
307
+
308
+ <div id="method-i-magnetic_heading_from" class="method-detail ">
309
+
310
+ <div class="method-heading">
311
+ <span class="method-name">magnetic_heading_from</span><span
312
+ class="method-args">(departure)</span>
313
+
314
+ <span class="method-click-advice">click to toggle source</span>
315
+
316
+ </div>
317
+
318
+
319
+ <div class="method-description">
320
+
321
+ <p>Calculate the magnetic heading from the specified airport. Takes an ICAO
322
+ code or <a href="Airport.html">Airport</a> object.</p>
323
+
324
+
325
+
326
+
327
+ <div class="method-source-code" id="magnetic_heading_from-source">
328
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 68</span>
329
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">magnetic_heading_from</span>(<span class="ruby-identifier">departure</span>)
330
+ <span class="ruby-identifier">true_to_magnetic</span> <span class="ruby-identifier">true_heading_from</span>(<span class="ruby-identifier">departure</span>)
331
+ <span class="ruby-keyword">end</span></pre>
332
+ </div><!-- magnetic_heading_from-source -->
333
+
334
+ </div>
335
+
336
+
337
+
338
+
339
+ </div><!-- magnetic_heading_from-method -->
340
+
341
+
342
+ <div id="method-i-magnetic_heading_to" class="method-detail ">
343
+
344
+ <div class="method-heading">
345
+ <span class="method-name">magnetic_heading_to</span><span
346
+ class="method-args">(arrival)</span>
347
+
348
+ <span class="method-click-advice">click to toggle source</span>
349
+
350
+ </div>
351
+
352
+
353
+ <div class="method-description">
354
+
355
+ <p>Calculate the magnetic heading to the specified airport. Takes an ICAO code
356
+ or <a href="Airport.html">Airport</a> object.</p>
357
+
358
+
359
+
360
+
361
+ <div class="method-source-code" id="magnetic_heading_to-source">
362
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 62</span>
363
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">magnetic_heading_to</span>(<span class="ruby-identifier">arrival</span>)
364
+ <span class="ruby-identifier">true_to_magnetic</span> <span class="ruby-identifier">true_heading_to</span>(<span class="ruby-identifier">arrival</span>)
365
+ <span class="ruby-keyword">end</span></pre>
366
+ </div><!-- magnetic_heading_to-source -->
367
+
368
+ </div>
369
+
370
+
371
+
372
+
373
+ </div><!-- magnetic_heading_to-method -->
374
+
375
+
376
+ <div id="method-i-magnetic_to_true" class="method-detail ">
377
+
378
+ <div class="method-heading">
379
+ <span class="method-name">magnetic_to_true</span><span
380
+ class="method-args">(heading)</span>
381
+
382
+ <span class="method-click-advice">click to toggle source</span>
383
+
384
+ </div>
385
+
386
+
387
+ <div class="method-description">
388
+
389
+ <p>Convert a magnetic heading to true based on the airport&#39;s magnetic
390
+ variance.</p>
391
+
392
+
393
+
394
+
395
+ <div class="method-source-code" id="magnetic_to_true-source">
396
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 80</span>
397
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">magnetic_to_true</span>(<span class="ruby-identifier">heading</span>)
398
+ <span class="ruby-identifier">heading</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@variance</span>
399
+ <span class="ruby-keyword">end</span></pre>
400
+ </div><!-- magnetic_to_true-source -->
401
+
402
+ </div>
403
+
404
+
405
+
406
+
407
+ </div><!-- magnetic_to_true-method -->
408
+
409
+
410
+ <div id="method-i-to_s" class="method-detail ">
411
+
412
+ <div class="method-heading">
413
+ <span class="method-name">to_s</span><span
414
+ class="method-args">()</span>
415
+
416
+ <span class="method-click-advice">click to toggle source</span>
417
+
418
+ </div>
419
+
420
+
421
+ <div class="method-description">
422
+
423
+ <p>Print the <a href="Airport.html">Airport</a> ICAO code. Allows the object
424
+ to act as a direct replacement for string input.</p>
425
+
426
+
427
+
428
+
429
+ <div class="method-source-code" id="to_s-source">
430
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 86</span>
431
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
432
+ <span class="ruby-ivar">@code</span>
433
+ <span class="ruby-keyword">end</span></pre>
434
+ </div><!-- to_s-source -->
435
+
436
+ </div>
437
+
438
+
439
+
440
+
441
+ </div><!-- to_s-method -->
442
+
443
+
444
+ <div id="method-i-true_heading_from" class="method-detail ">
445
+
446
+ <div class="method-heading">
447
+ <span class="method-name">true_heading_from</span><span
448
+ class="method-args">(departure)</span>
449
+
450
+ <span class="method-click-advice">click to toggle source</span>
451
+
452
+ </div>
453
+
454
+
455
+ <div class="method-description">
456
+
457
+ <p>Calculate the true heading from the specified airport. Takes an ICAO code
458
+ or <a href="Airport.html">Airport</a> object.</p>
459
+
460
+
461
+
462
+
463
+ <div class="method-source-code" id="true_heading_from-source">
464
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 56</span>
465
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">true_heading_from</span>(<span class="ruby-identifier">departure</span>)
466
+ <span class="ruby-value">360.0</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">true_heading_to</span>(<span class="ruby-identifier">departure</span>)
467
+ <span class="ruby-keyword">end</span></pre>
468
+ </div><!-- true_heading_from-source -->
469
+
470
+ </div>
471
+
472
+
473
+
474
+
475
+ </div><!-- true_heading_from-method -->
476
+
477
+
478
+ <div id="method-i-true_heading_to" class="method-detail ">
479
+
480
+ <div class="method-heading">
481
+ <span class="method-name">true_heading_to</span><span
482
+ class="method-args">(arrival)</span>
483
+
484
+ <span class="method-click-advice">click to toggle source</span>
485
+
486
+ </div>
487
+
488
+
489
+ <div class="method-description">
490
+
491
+ <p>Calculate the true heading to the specified airport. Takes an ICAO code or
492
+ <a href="Airport.html">Airport</a> object.</p>
493
+
494
+
495
+
496
+
497
+ <div class="method-source-code" id="true_heading_to-source">
498
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 43</span>
499
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">true_heading_to</span>(<span class="ruby-identifier">arrival</span>)
500
+ <span class="ruby-identifier">heading_uri</span> = <span class="ruby-node">&quot;http://www6.landings.com/cgi-bin/nph-dist_apt?airport1=#{@code.downcase}&amp;airport2=#{arrival.to_s.strip.downcase}&quot;</span>
501
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get</span> <span class="ruby-constant">URI</span> <span class="ruby-identifier">heading_uri</span>
502
+ <span class="ruby-identifier">r</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">scan</span> <span class="ruby-regexp">/(?:heading:)\s*([\d\.]+)\s+/</span>
503
+
504
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">HeadingError</span>, <span class="ruby-node">&quot;Heading from #{@code.upcase} to @arrival.to_s.upcase not found.&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
505
+
506
+ <span class="ruby-identifier">true_hdg</span> = <span class="ruby-identifier">r</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_f</span>
507
+ <span class="ruby-keyword">end</span></pre>
508
+ </div><!-- true_heading_to-source -->
509
+
510
+ </div>
511
+
512
+
513
+
514
+
515
+ </div><!-- true_heading_to-method -->
516
+
517
+
518
+ <div id="method-i-true_to_magnetic" class="method-detail ">
519
+
520
+ <div class="method-heading">
521
+ <span class="method-name">true_to_magnetic</span><span
522
+ class="method-args">(heading)</span>
523
+
524
+ <span class="method-click-advice">click to toggle source</span>
525
+
526
+ </div>
527
+
528
+
529
+ <div class="method-description">
530
+
531
+ <p>Convert a true heading to magnetic based on the airport&#39;s magnetic
532
+ variance.</p>
533
+
534
+
535
+
536
+
537
+ <div class="method-source-code" id="true_to_magnetic-source">
538
+ <pre><span class="ruby-comment"># File lib/vrc-tools/airport.rb, line 74</span>
539
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">true_to_magnetic</span>(<span class="ruby-identifier">heading</span>)
540
+ <span class="ruby-identifier">heading</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@variance</span>
541
+ <span class="ruby-keyword">end</span></pre>
542
+ </div><!-- true_to_magnetic-source -->
543
+
544
+ </div>
545
+
546
+
547
+
548
+
549
+ </div><!-- true_to_magnetic-method -->
550
+
551
+
552
+ </section><!-- public-instance-method-details -->
553
+
554
+ </section><!-- 5Buntitled-5D -->
555
+
556
+ </div><!-- documentation -->
557
+
558
+
559
+ <footer id="validator-badges">
560
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
561
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
562
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
563
+ </footer>
564
+