aixm 0.3.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +72 -6
  4. data/README.md +191 -53
  5. data/exe/ckmid +11 -0
  6. data/exe/mkmid +11 -0
  7. data/lib/aixm/association.rb +367 -0
  8. data/lib/aixm/classes.rb +44 -0
  9. data/lib/aixm/component/fato.rb +44 -52
  10. data/lib/aixm/component/frequency.rb +13 -14
  11. data/lib/aixm/component/geometry/arc.rb +2 -2
  12. data/lib/aixm/component/geometry/border.rb +14 -5
  13. data/lib/aixm/component/geometry/circle.rb +8 -2
  14. data/lib/aixm/component/geometry/point.rb +10 -3
  15. data/lib/aixm/component/geometry/rhumb_line.rb +54 -0
  16. data/lib/aixm/component/geometry.rb +38 -38
  17. data/lib/aixm/component/helipad.rb +29 -37
  18. data/lib/aixm/component/layer.rb +28 -19
  19. data/lib/aixm/component/lighting.rb +11 -12
  20. data/lib/aixm/component/runway.rb +46 -53
  21. data/lib/aixm/{feature → component}/service.rb +36 -35
  22. data/lib/aixm/component/surface.rb +3 -3
  23. data/lib/aixm/component/timetable.rb +5 -3
  24. data/lib/aixm/component/{vertical_limits.rb → vertical_limit.rb} +12 -6
  25. data/lib/aixm/config.rb +6 -3
  26. data/lib/aixm/document.rb +31 -49
  27. data/lib/aixm/executables.rb +85 -0
  28. data/lib/aixm/f.rb +28 -0
  29. data/lib/aixm/feature/address.rb +20 -15
  30. data/lib/aixm/feature/airport.rb +113 -129
  31. data/lib/aixm/feature/airspace.rb +54 -23
  32. data/lib/aixm/feature/navigational_aid/designated_point.rb +12 -14
  33. data/lib/aixm/feature/navigational_aid/dme.rb +10 -11
  34. data/lib/aixm/feature/navigational_aid/marker.rb +6 -2
  35. data/lib/aixm/feature/navigational_aid/ndb.rb +6 -2
  36. data/lib/aixm/feature/navigational_aid/tacan.rb +6 -2
  37. data/lib/aixm/feature/navigational_aid/vor.rb +22 -14
  38. data/lib/aixm/feature/navigational_aid.rb +7 -9
  39. data/lib/aixm/feature/obstacle.rb +22 -20
  40. data/lib/aixm/feature/obstacle_group.rb +30 -30
  41. data/lib/aixm/feature/organisation.rb +20 -4
  42. data/lib/aixm/feature/unit.rb +35 -45
  43. data/lib/aixm/feature.rb +13 -3
  44. data/lib/aixm/memoize.rb +89 -0
  45. data/lib/aixm/object.rb +9 -0
  46. data/lib/aixm/payload_hash.rb +114 -0
  47. data/lib/aixm/refinements.rb +34 -50
  48. data/lib/aixm/shortcuts.rb +6 -43
  49. data/lib/aixm/version.rb +1 -1
  50. data/lib/aixm/xy.rb +9 -1
  51. data/lib/aixm.rb +18 -7
  52. data/schemas/ofmx/{0 → 0.1}/OFMX-CSV-Obstacle.json +0 -0
  53. data/schemas/ofmx/{0 → 0.1}/OFMX-CSV.json +0 -0
  54. data/schemas/ofmx/{0 → 0.1}/OFMX-DataTypes.xsd +52 -2
  55. data/schemas/ofmx/{0 → 0.1}/OFMX-Features.xsd +225 -14
  56. data/schemas/ofmx/{0 → 0.1}/OFMX-Snapshot.xsd +0 -5
  57. data.tar.gz.sig +0 -0
  58. metadata +116 -164
  59. metadata.gz.sig +0 -0
  60. data/.gitignore +0 -6
  61. data/.ruby-version +0 -1
  62. data/.travis.yml +0 -8
  63. data/.yardopts +0 -3
  64. data/Guardfile +0 -8
  65. data/aixm.gemspec +0 -35
  66. data/gems.rb +0 -3
  67. data/lib/aixm/component.rb +0 -6
  68. data/rakefile.rb +0 -22
  69. data/spec/factory.rb +0 -559
  70. data/spec/lib/aixm/a_spec.rb +0 -203
  71. data/spec/lib/aixm/component/fato_spec.rb +0 -260
  72. data/spec/lib/aixm/component/frequency_spec.rb +0 -75
  73. data/spec/lib/aixm/component/geometry/arc_spec.rb +0 -75
  74. data/spec/lib/aixm/component/geometry/border_spec.rb +0 -33
  75. data/spec/lib/aixm/component/geometry/circle_spec.rb +0 -70
  76. data/spec/lib/aixm/component/geometry/point_spec.rb +0 -39
  77. data/spec/lib/aixm/component/geometry_spec.rb +0 -321
  78. data/spec/lib/aixm/component/helipad_spec.rb +0 -187
  79. data/spec/lib/aixm/component/layer_spec.rb +0 -137
  80. data/spec/lib/aixm/component/lighting_spec.rb +0 -88
  81. data/spec/lib/aixm/component/runway_spec.rb +0 -472
  82. data/spec/lib/aixm/component/surface_spec.rb +0 -124
  83. data/spec/lib/aixm/component/timetable_spec.rb +0 -49
  84. data/spec/lib/aixm/component/vertical_limits_spec.rb +0 -97
  85. data/spec/lib/aixm/config_spec.rb +0 -41
  86. data/spec/lib/aixm/d_spec.rb +0 -150
  87. data/spec/lib/aixm/document_spec.rb +0 -1875
  88. data/spec/lib/aixm/errors_spec.rb +0 -14
  89. data/spec/lib/aixm/f_spec.rb +0 -85
  90. data/spec/lib/aixm/feature/address_spec.rb +0 -55
  91. data/spec/lib/aixm/feature/airport_spec.rb +0 -770
  92. data/spec/lib/aixm/feature/airspace_spec.rb +0 -390
  93. data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +0 -98
  94. data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +0 -92
  95. data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +0 -79
  96. data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +0 -89
  97. data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +0 -88
  98. data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +0 -245
  99. data/spec/lib/aixm/feature/navigational_aid_spec.rb +0 -52
  100. data/spec/lib/aixm/feature/obstacle_group_spec.rb +0 -326
  101. data/spec/lib/aixm/feature/obstacle_spec.rb +0 -279
  102. data/spec/lib/aixm/feature/organisation_spec.rb +0 -77
  103. data/spec/lib/aixm/feature/service_spec.rb +0 -59
  104. data/spec/lib/aixm/feature/unit_spec.rb +0 -230
  105. data/spec/lib/aixm/feature_spec.rb +0 -38
  106. data/spec/lib/aixm/p_spec.rb +0 -189
  107. data/spec/lib/aixm/refinements_spec.rb +0 -381
  108. data/spec/lib/aixm/version_spec.rb +0 -7
  109. data/spec/lib/aixm/w_spec.rb +0 -150
  110. data/spec/lib/aixm/xy_spec.rb +0 -180
  111. data/spec/lib/aixm/z_spec.rb +0 -94
  112. data/spec/macros/marking.rb +0 -12
  113. data/spec/macros/organisation.rb +0 -11
  114. data/spec/macros/remarks.rb +0 -12
  115. data/spec/macros/timetable.rb +0 -11
  116. data/spec/macros/xy.rb +0 -11
  117. data/spec/macros/z_qnh.rb +0 -11
  118. data/spec/sounds/failure.mp3 +0 -0
  119. data/spec/sounds/success.mp3 +0 -0
  120. data/spec/spec_helper.rb +0 -55
@@ -1,70 +0,0 @@
1
- require_relative '../../../../spec_helper'
2
-
3
- describe AIXM::Component::Geometry::Circle do
4
- subject do
5
- AIXM.circle(
6
- center_xy: AIXM.xy(lat: 12.12345678, long: -23.12345678),
7
- radius: AIXM.d(15, :km)
8
- )
9
- end
10
-
11
- describe :center_xy= do
12
- it "fails on invalid values" do
13
- [nil, 123].wont_be_written_to subject, :center_xy
14
- end
15
-
16
- it "accepts valid values" do
17
- [AIXM::Factory.xy].must_be_written_to subject, :center_xy
18
- end
19
- end
20
-
21
- describe :radius= do
22
- it "fails on invalid values" do
23
- [nil, 0, 2, AIXM.d(0, :m)].wont_be_written_to subject, :radius
24
- end
25
- end
26
-
27
- describe :north_xy do
28
- it "must calculate approximation of northmost point on the circumference" do
29
- subject.send(:north_xy).must_equal AIXM.xy(lat: 12.25835483455868, long: -23.12345678)
30
- end
31
- end
32
-
33
- describe :to_xml do
34
- it "builds correct AIXM for circles not near the equator" do
35
- subject = AIXM.circle(
36
- center_xy: AIXM.xy(lat: 11.1, long: 22.2),
37
- radius: AIXM.d(25, :km)
38
- )
39
- AIXM.aixm!
40
- subject.to_xml.must_equal <<~END
41
- <Avx>
42
- <codeType>CWA</codeType>
43
- <geoLat>111929.39N</geoLat>
44
- <geoLong>0221200.00E</geoLong>
45
- <codeDatum>WGE</codeDatum>
46
- <geoLatArc>110600.00N</geoLatArc>
47
- <geoLongArc>0221200.00E</geoLongArc>
48
- </Avx>
49
- END
50
- end
51
-
52
- it "builds correct AIXM for circles near the equator" do
53
- subject = AIXM.circle(
54
- center_xy: AIXM.xy(lat: -0.0005, long: -22.2),
55
- radius: AIXM.d(50, :km)
56
- )
57
- AIXM.aixm!
58
- subject.to_xml.must_equal <<~END
59
- <Avx>
60
- <codeType>CWA</codeType>
61
- <geoLat>002656.98N</geoLat>
62
- <geoLong>0221200.00W</geoLong>
63
- <codeDatum>WGE</codeDatum>
64
- <geoLatArc>000001.80S</geoLatArc>
65
- <geoLongArc>0221200.00W</geoLongArc>
66
- </Avx>
67
- END
68
- end
69
- end
70
- end
@@ -1,39 +0,0 @@
1
- require_relative '../../../../spec_helper'
2
-
3
- describe AIXM::Component::Geometry::Point do
4
- subject do
5
- AIXM.point(xy: AIXM.xy(lat: 11.1, long: 22.2))
6
- end
7
-
8
- describe :xy= do
9
- macro :xy
10
- end
11
-
12
- describe :to_xml do
13
- it "builds correct AIXM for N/E points" do
14
- subject = AIXM.point(xy: AIXM.xy(lat: 11.1, long: 22.2))
15
- AIXM.aixm!
16
- subject.to_xml.must_equal <<~END
17
- <Avx>
18
- <codeType>GRC</codeType>
19
- <geoLat>110600.00N</geoLat>
20
- <geoLong>0221200.00E</geoLong>
21
- <codeDatum>WGE</codeDatum>
22
- </Avx>
23
- END
24
- end
25
-
26
- it "builds correct AIXM for S/W points" do
27
- subject = AIXM.point(xy: AIXM.xy(lat: -11.1, long: -22.2))
28
- AIXM.aixm!
29
- subject.to_xml.must_equal <<~END
30
- <Avx>
31
- <codeType>GRC</codeType>
32
- <geoLat>110600.00S</geoLat>
33
- <geoLong>0221200.00W</geoLong>
34
- <codeDatum>WGE</codeDatum>
35
- </Avx>
36
- END
37
- end
38
- end
39
- end
@@ -1,321 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Geometry do
4
- context "singularity" do
5
- subject do
6
- AIXM.geometry
7
- end
8
-
9
- it "must fail checks" do
10
- subject.wont_be :point?
11
- subject.wont_be :circle?
12
- subject.wont_be :polygon?
13
- subject.wont_be :closed?
14
- end
15
-
16
- it "must fail to build AIXM" do
17
- -> { subject.to_xml }.must_raise AIXM::GeometryError
18
- end
19
- end
20
-
21
- context "point" do
22
- subject do
23
- AIXM.geometry.tap do |geometry|
24
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
25
- end
26
- end
27
-
28
- it "must pass checks" do
29
- subject.must_be :point?
30
- subject.wont_be :circle?
31
- subject.wont_be :polygon?
32
- subject.must_be :closed?
33
- end
34
-
35
- it "must return elements" do
36
- subject.segments.count.must_equal 1
37
- end
38
-
39
- it "builds valid AIXM" do
40
- AIXM.aixm!
41
- subject.to_xml.must_equal <<~END
42
- <Avx>
43
- <codeType>GRC</codeType>
44
- <geoLat>110000.00N</geoLat>
45
- <geoLong>0220000.00E</geoLong>
46
- <codeDatum>WGE</codeDatum>
47
- </Avx>
48
- END
49
- end
50
- end
51
-
52
- context "line" do
53
- subject do
54
- AIXM.geometry.tap do |geometry|
55
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
56
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
57
- end
58
- end
59
-
60
- it "must fail checks" do
61
- subject.wont_be :point?
62
- subject.wont_be :circle?
63
- subject.wont_be :polygon?
64
- subject.wont_be :closed?
65
- end
66
-
67
- it "must fail to build AIXM" do
68
- -> { subject.to_xml }.must_raise AIXM::GeometryError
69
- end
70
- end
71
-
72
- context "closed polygon" do
73
- subject do
74
- AIXM.geometry.tap do |geometry|
75
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
76
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
77
- geometry << AIXM.point(xy: AIXM.xy(lat: 33, long: 44))
78
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
79
- end
80
- end
81
-
82
- it "must pass checks" do
83
- subject.wont_be :point?
84
- subject.wont_be :circle?
85
- subject.must_be :polygon?
86
- subject.must_be :closed?
87
- end
88
-
89
- it "must return elements" do
90
- subject.segments.count.must_equal 4
91
- end
92
-
93
- it "builds valid AIXM" do
94
- AIXM.aixm!
95
- subject.to_xml.must_equal <<~END
96
- <Avx>
97
- <codeType>GRC</codeType>
98
- <geoLat>110000.00N</geoLat>
99
- <geoLong>0220000.00E</geoLong>
100
- <codeDatum>WGE</codeDatum>
101
- </Avx>
102
- <Avx>
103
- <codeType>GRC</codeType>
104
- <geoLat>220000.00N</geoLat>
105
- <geoLong>0330000.00E</geoLong>
106
- <codeDatum>WGE</codeDatum>
107
- </Avx>
108
- <Avx>
109
- <codeType>GRC</codeType>
110
- <geoLat>330000.00N</geoLat>
111
- <geoLong>0440000.00E</geoLong>
112
- <codeDatum>WGE</codeDatum>
113
- </Avx>
114
- <Avx>
115
- <codeType>GRC</codeType>
116
- <geoLat>110000.00N</geoLat>
117
- <geoLong>0220000.00E</geoLong>
118
- <codeDatum>WGE</codeDatum>
119
- </Avx>
120
- END
121
- end
122
- end
123
-
124
- context "unclosed polygon" do
125
- subject do
126
- AIXM.geometry.tap do |geometry|
127
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
128
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
129
- geometry << AIXM.point(xy: AIXM.xy(lat: 33, long: 44))
130
- end
131
- end
132
-
133
- it "must fail checks" do
134
- subject.wont_be :point?
135
- subject.wont_be :circle?
136
- subject.wont_be :polygon?
137
- subject.wont_be :closed?
138
- end
139
-
140
- it "must fail to build AIXM" do
141
- -> { subject.to_xml }.must_raise AIXM::GeometryError
142
- end
143
- end
144
-
145
- context "closed arc" do
146
- subject do
147
- AIXM.geometry.tap do |geometry|
148
- geometry << AIXM.arc(xy: AIXM.xy(lat: 11, long: 22), center_xy: AIXM.xy(lat: 10, long: 20), clockwise: true)
149
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
150
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
151
- end
152
- end
153
-
154
- it "must pass checks" do
155
- subject.wont_be :point?
156
- subject.wont_be :circle?
157
- subject.must_be :polygon?
158
- subject.must_be :closed?
159
- end
160
-
161
- it "builds valid AIXM" do
162
- AIXM.aixm!
163
- subject.to_xml.must_equal <<~END
164
- <Avx>
165
- <codeType>CWA</codeType>
166
- <geoLat>110000.00N</geoLat>
167
- <geoLong>0220000.00E</geoLong>
168
- <codeDatum>WGE</codeDatum>
169
- <geoLatArc>100000.00N</geoLatArc>
170
- <geoLongArc>0200000.00E</geoLongArc>
171
- </Avx>
172
- <Avx>
173
- <codeType>GRC</codeType>
174
- <geoLat>220000.00N</geoLat>
175
- <geoLong>0330000.00E</geoLong>
176
- <codeDatum>WGE</codeDatum>
177
- </Avx>
178
- <Avx>
179
- <codeType>GRC</codeType>
180
- <geoLat>110000.00N</geoLat>
181
- <geoLong>0220000.00E</geoLong>
182
- <codeDatum>WGE</codeDatum>
183
- </Avx>
184
- END
185
- end
186
- end
187
-
188
- context "unclosed arc" do
189
- subject do
190
- AIXM.geometry.tap do |geometry|
191
- geometry << AIXM.arc(xy: AIXM.xy(lat: 11, long: 22), center_xy: AIXM.xy(lat: 10, long: 20), clockwise: true)
192
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
193
- end
194
- end
195
-
196
- it "must fail checks" do
197
- subject.wont_be :point?
198
- subject.wont_be :circle?
199
- subject.wont_be :polygon?
200
- subject.wont_be :closed?
201
- end
202
-
203
- it "must fail to build AIXM" do
204
- -> { subject.to_xml }.must_raise AIXM::GeometryError
205
- end
206
- end
207
-
208
- context "closed border" do
209
- subject do
210
- AIXM.geometry.tap do |geometry|
211
- geometry << AIXM.border(xy: AIXM.xy(lat: 11, long: 22), name: 'foobar')
212
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
213
- geometry << AIXM.point(xy: AIXM.xy(lat: 11, long: 22))
214
- end
215
- end
216
-
217
- it "must pass checks" do
218
- subject.wont_be :point?
219
- subject.wont_be :circle?
220
- subject.must_be :polygon?
221
- subject.must_be :closed?
222
- end
223
-
224
- it "builds valid AIXM" do
225
- AIXM.aixm!
226
- subject.to_xml.must_equal <<~END
227
- <Avx>
228
- <GbrUid>
229
- <txtName>foobar</txtName>
230
- </GbrUid>
231
- <codeType>FNT</codeType>
232
- <geoLat>110000.00N</geoLat>
233
- <geoLong>0220000.00E</geoLong>
234
- <codeDatum>WGE</codeDatum>
235
- </Avx>
236
- <Avx>
237
- <codeType>GRC</codeType>
238
- <geoLat>220000.00N</geoLat>
239
- <geoLong>0330000.00E</geoLong>
240
- <codeDatum>WGE</codeDatum>
241
- </Avx>
242
- <Avx>
243
- <codeType>GRC</codeType>
244
- <geoLat>110000.00N</geoLat>
245
- <geoLong>0220000.00E</geoLong>
246
- <codeDatum>WGE</codeDatum>
247
- </Avx>
248
- END
249
- end
250
- end
251
-
252
- context "unclosed border" do
253
- subject do
254
- AIXM.geometry.tap do |geometry|
255
- geometry << AIXM.border(xy: AIXM.xy(lat: 11, long: 22), name: 'foobar')
256
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
257
- end
258
- end
259
-
260
- it "must fail checks" do
261
- subject.wont_be :point?
262
- subject.wont_be :circle?
263
- subject.wont_be :polygon?
264
- subject.wont_be :closed?
265
- end
266
-
267
- it "must fail to build AIXM" do
268
- -> { subject.to_xml }.must_raise AIXM::GeometryError
269
- end
270
- end
271
-
272
- context "circle" do
273
- subject do
274
- AIXM.geometry.tap do |geometry|
275
- geometry << AIXM.circle(center_xy: AIXM.xy(lat: 11, long: 22), radius: AIXM.d(10, :km))
276
- end
277
- end
278
-
279
- it "must pass checks" do
280
- subject.wont_be :point?
281
- subject.must_be :circle?
282
- subject.wont_be :polygon?
283
- subject.must_be :closed?
284
- end
285
-
286
- it "builds valid AIXM" do
287
- AIXM.aixm!
288
- subject.to_xml.must_equal <<~END
289
- <Avx>
290
- <codeType>CWA</codeType>
291
- <geoLat>110523.76N</geoLat>
292
- <geoLong>0220000.00E</geoLong>
293
- <codeDatum>WGE</codeDatum>
294
- <geoLatArc>110000.00N</geoLatArc>
295
- <geoLongArc>0220000.00E</geoLongArc>
296
- </Avx>
297
- END
298
- end
299
- end
300
-
301
- context "circle with additional elements" do
302
- subject do
303
- AIXM.geometry.tap do |geometry|
304
- geometry << AIXM.circle(center_xy: AIXM.xy(lat: 11, long: 22), radius: AIXM.d(10, :km))
305
- geometry << AIXM.point(xy: AIXM.xy(lat: 22, long: 33))
306
- end
307
- end
308
-
309
- it "must fail checks when additional elements are present" do
310
- subject.wont_be :point?
311
- subject.wont_be :circle?
312
- subject.wont_be :polygon?
313
- subject.wont_be :closed?
314
- end
315
-
316
- it "must fail to build AIXM" do
317
- -> { subject.to_xml }.must_raise AIXM::GeometryError
318
- end
319
- end
320
-
321
- end
@@ -1,187 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Helipad do
4
- subject do
5
- AIXM::Factory.airport.helipads.first
6
- end
7
-
8
- describe :name= do
9
- it "fails on invalid values" do
10
- [nil, :foobar, 123].wont_be_written_to subject, :name
11
- end
12
-
13
- it "upcases and transcodes valid values" do
14
- subject.tap { |s| s.name = 'h1' }.name.must_equal 'H1'
15
- end
16
- end
17
-
18
- describe :xy= do
19
- macro :xy
20
-
21
- it "fails on nil value" do
22
- [nil].wont_be_written_to subject, :xy
23
- end
24
- end
25
-
26
- describe :z= do
27
- macro :z_qnh
28
- end
29
-
30
- describe :length= do
31
- it "fails on invalid values" do
32
- [:foobar, 0, 1, AIXM.d(0, :m)].wont_be_written_to subject, :length
33
- end
34
-
35
- it "accepts nil value" do
36
- [nil].must_be_written_to subject, :length
37
- end
38
- end
39
-
40
- describe :width= do
41
- it "fails on invalid values" do
42
- [:foobar, 0, 1, AIXM.d(0, :m)].wont_be_written_to subject, :width
43
- end
44
-
45
- it "accepts nil value" do
46
- [nil].must_be_written_to subject, :width
47
- end
48
- end
49
-
50
- describe :marking= do
51
- macro :marking
52
- end
53
-
54
- describe :fato= do
55
- it "fails on invalid values" do
56
- [:foobar, 0].wont_be_written_to subject, :fato
57
- end
58
-
59
- it "accepts valid values" do
60
- [nil, AIXM::Factory.fato].must_be_written_to subject, :fato
61
- end
62
- end
63
-
64
- describe :helicopter_class= do
65
- it "fails on invalid values" do
66
- [:foobar, 123].wont_be_written_to subject, :helicopter_class
67
- end
68
-
69
- it "accepts nil value" do
70
- [nil].must_be_written_to subject, :helicopter_class
71
- end
72
-
73
- it "looks up valid values" do
74
- subject.tap { |s| s.helicopter_class = 1 }.helicopter_class.must_equal :'1'
75
- subject.tap { |s| s.helicopter_class = :OTHER }.helicopter_class.must_equal :other
76
- end
77
- end
78
-
79
- describe :status= do
80
- it "fails on invalid values" do
81
- [:foobar, 123].wont_be_written_to subject, :status
82
- end
83
-
84
- it "accepts nil value" do
85
- [nil].must_be_written_to subject, :status
86
- end
87
-
88
- it "looks up valid values" do
89
- subject.tap { |s| s.status = :closed }.status.must_equal :closed
90
- subject.tap { |s| s.status = :SPOWER }.status.must_equal :secondary_power
91
- end
92
- end
93
-
94
- describe :remarks= do
95
- macro :remarks
96
- end
97
-
98
- describe :xml= do
99
- it "builds correct complete OFMX" do
100
- AIXM.ofmx!
101
- subject.to_xml.must_equal <<~END
102
- <Tla>
103
- <TlaUid>
104
- <AhpUid>
105
- <codeId>LFNT</codeId>
106
- </AhpUid>
107
- <txtDesig>H1</txtDesig>
108
- </TlaUid>
109
- <FtoUid>
110
- <AhpUid>
111
- <codeId>LFNT</codeId>
112
- </AhpUid>
113
- <txtDesig>H1</txtDesig>
114
- </FtoUid>
115
- <geoLat>43.99915000N</geoLat>
116
- <geoLong>004.75154444E</geoLong>
117
- <codeDatum>WGE</codeDatum>
118
- <valElev>141</valElev>
119
- <uomDistVer>FT</uomDistVer>
120
- <valLen>20</valLen>
121
- <valWid>20</valWid>
122
- <uomDim>M</uomDim>
123
- <codeComposition>CONC</codeComposition>
124
- <codePreparation>PAVED</codePreparation>
125
- <codeCondSfc>FAIR</codeCondSfc>
126
- <valPcnClass>30</valPcnClass>
127
- <codePcnPavementType>F</codePcnPavementType>
128
- <codePcnPavementSubgrade>A</codePcnPavementSubgrade>
129
- <codePcnMaxTirePressure>W</codePcnMaxTirePressure>
130
- <codePcnEvalMethod>U</codePcnEvalMethod>
131
- <txtPcnNote>Cracks near the center</txtPcnNote>
132
- <valSiwlWeight>1500</valSiwlWeight>
133
- <uomSiwlWeight>KG</uomSiwlWeight>
134
- <valSiwlTirePressure>0.5</valSiwlTirePressure>
135
- <uomSiwlTirePressure>MPA</uomSiwlTirePressure>
136
- <valAuwWeight>8</valAuwWeight>
137
- <uomAuwWeight>T</uomAuwWeight>
138
- <codeClassHel>1</codeClassHel>
139
- <txtMarking>Continuous white lines</txtMarking>
140
- <codeSts>OTHER</codeSts>
141
- <txtRmk>Authorizaton by AD operator required</txtRmk>
142
- </Tla>
143
- <Tls>
144
- <TlsUid>
145
- <TlaUid>
146
- <AhpUid>
147
- <codeId>LFNT</codeId>
148
- </AhpUid>
149
- <txtDesig>H1</txtDesig>
150
- </TlaUid>
151
- <codePsn>AIM</codePsn>
152
- </TlsUid>
153
- <txtDescr>omnidirectional</txtDescr>
154
- <codeIntst>LIM</codeIntst>
155
- <codeColour>GRN</codeColour>
156
- <txtRmk>lighting remarks</txtRmk>
157
- </Tls>
158
- END
159
- end
160
-
161
- it "builds correct minimal OFMX" do
162
- AIXM.ofmx!
163
- %i(z length width helicopter_class marking status remarks).each { |a| subject.send(:"#{a}=", nil) }
164
- %i(composition preparation condition pcn siwl_weight siwl_tire_pressure auw_weight remarks).each { |a| subject.surface.send(:"#{a}=", nil) }
165
- subject.instance_eval { @lightings.clear }
166
- subject.to_xml.must_equal <<~END
167
- <Tla>
168
- <TlaUid>
169
- <AhpUid>
170
- <codeId>LFNT</codeId>
171
- </AhpUid>
172
- <txtDesig>H1</txtDesig>
173
- </TlaUid>
174
- <FtoUid>
175
- <AhpUid>
176
- <codeId>LFNT</codeId>
177
- </AhpUid>
178
- <txtDesig>H1</txtDesig>
179
- </FtoUid>
180
- <geoLat>43.99915000N</geoLat>
181
- <geoLong>004.75154444E</geoLong>
182
- <codeDatum>WGE</codeDatum>
183
- </Tla>
184
- END
185
- end
186
- end
187
- end