aixm 0.3.8 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +1 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +33 -3
  5. data/README.md +166 -56
  6. data/exe/ckmid +14 -0
  7. data/exe/mkmid +14 -0
  8. data/lib/aixm.rb +16 -6
  9. data/lib/aixm/association.rb +369 -0
  10. data/lib/aixm/classes.rb +43 -0
  11. data/lib/aixm/component/fato.rb +45 -53
  12. data/lib/aixm/component/frequency.rb +11 -12
  13. data/lib/aixm/component/geometry.rb +36 -38
  14. data/lib/aixm/component/geometry/arc.rb +2 -2
  15. data/lib/aixm/component/geometry/border.rb +6 -3
  16. data/lib/aixm/component/geometry/circle.rb +8 -2
  17. data/lib/aixm/component/geometry/point.rb +8 -2
  18. data/lib/aixm/component/helipad.rb +30 -38
  19. data/lib/aixm/component/layer.rb +28 -19
  20. data/lib/aixm/component/lighting.rb +12 -13
  21. data/lib/aixm/component/runway.rb +44 -48
  22. data/lib/aixm/{feature → component}/service.rb +37 -36
  23. data/lib/aixm/component/surface.rb +3 -3
  24. data/lib/aixm/component/timetable.rb +2 -2
  25. data/lib/aixm/component/{vertical_limits.rb → vertical_limit.rb} +12 -6
  26. data/lib/aixm/config.rb +2 -1
  27. data/lib/aixm/document.rb +27 -50
  28. data/lib/aixm/executables.rb +85 -0
  29. data/lib/aixm/feature.rb +13 -3
  30. data/lib/aixm/feature/address.rb +12 -13
  31. data/lib/aixm/feature/airport.rb +103 -128
  32. data/lib/aixm/feature/airspace.rb +44 -17
  33. data/lib/aixm/feature/navigational_aid.rb +7 -9
  34. data/lib/aixm/feature/navigational_aid/designated_point.rb +13 -15
  35. data/lib/aixm/feature/navigational_aid/dme.rb +11 -12
  36. data/lib/aixm/feature/navigational_aid/marker.rb +7 -3
  37. data/lib/aixm/feature/navigational_aid/ndb.rb +7 -3
  38. data/lib/aixm/feature/navigational_aid/tacan.rb +7 -3
  39. data/lib/aixm/feature/navigational_aid/vor.rb +23 -15
  40. data/lib/aixm/feature/obstacle.rb +29 -43
  41. data/lib/aixm/feature/obstacle_group.rb +37 -34
  42. data/lib/aixm/feature/organisation.rb +21 -5
  43. data/lib/aixm/feature/unit.rb +36 -46
  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 +29 -76
  48. data/lib/aixm/shortcuts.rb +5 -42
  49. data/lib/aixm/version.rb +1 -1
  50. data/lib/aixm/xy.rb +1 -1
  51. data/schemas/ofmx/0/OFMX-Features.xsd +152 -20
  52. data/schemas/ofmx/0/OFMX-Snapshot.xsd +0 -5
  53. metadata +107 -156
  54. metadata.gz.sig +2 -0
  55. data/.github/workflows/test.yml +0 -26
  56. data/.gitignore +0 -6
  57. data/.ruby-version +0 -1
  58. data/.yardopts +0 -3
  59. data/Guardfile +0 -8
  60. data/aixm.gemspec +0 -35
  61. data/gems.rb +0 -3
  62. data/lib/aixm/component.rb +0 -6
  63. data/rakefile.rb +0 -36
  64. data/spec/factory.rb +0 -559
  65. data/spec/lib/aixm/a_spec.rb +0 -203
  66. data/spec/lib/aixm/component/fato_spec.rb +0 -267
  67. data/spec/lib/aixm/component/frequency_spec.rb +0 -74
  68. data/spec/lib/aixm/component/geometry/arc_spec.rb +0 -73
  69. data/spec/lib/aixm/component/geometry/border_spec.rb +0 -38
  70. data/spec/lib/aixm/component/geometry/circle_spec.rb +0 -68
  71. data/spec/lib/aixm/component/geometry/point_spec.rb +0 -37
  72. data/spec/lib/aixm/component/geometry_spec.rb +0 -316
  73. data/spec/lib/aixm/component/helipad_spec.rb +0 -193
  74. data/spec/lib/aixm/component/layer_spec.rb +0 -135
  75. data/spec/lib/aixm/component/lighting_spec.rb +0 -94
  76. data/spec/lib/aixm/component/runway_spec.rb +0 -479
  77. data/spec/lib/aixm/component/surface_spec.rb +0 -124
  78. data/spec/lib/aixm/component/timetable_spec.rb +0 -47
  79. data/spec/lib/aixm/component/vertical_limits_spec.rb +0 -94
  80. data/spec/lib/aixm/config_spec.rb +0 -41
  81. data/spec/lib/aixm/d_spec.rb +0 -150
  82. data/spec/lib/aixm/document_spec.rb +0 -1884
  83. data/spec/lib/aixm/errors_spec.rb +0 -14
  84. data/spec/lib/aixm/f_spec.rb +0 -85
  85. data/spec/lib/aixm/feature/address_spec.rb +0 -60
  86. data/spec/lib/aixm/feature/airport_spec.rb +0 -776
  87. data/spec/lib/aixm/feature/airspace_spec.rb +0 -394
  88. data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +0 -103
  89. data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +0 -98
  90. data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +0 -85
  91. data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +0 -95
  92. data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +0 -94
  93. data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +0 -251
  94. data/spec/lib/aixm/feature/navigational_aid_spec.rb +0 -52
  95. data/spec/lib/aixm/feature/obstacle_group_spec.rb +0 -330
  96. data/spec/lib/aixm/feature/obstacle_spec.rb +0 -284
  97. data/spec/lib/aixm/feature/organisation_spec.rb +0 -83
  98. data/spec/lib/aixm/feature/service_spec.rb +0 -59
  99. data/spec/lib/aixm/feature/unit_spec.rb +0 -238
  100. data/spec/lib/aixm/feature_spec.rb +0 -38
  101. data/spec/lib/aixm/p_spec.rb +0 -189
  102. data/spec/lib/aixm/refinements_spec.rb +0 -430
  103. data/spec/lib/aixm/version_spec.rb +0 -7
  104. data/spec/lib/aixm/w_spec.rb +0 -150
  105. data/spec/lib/aixm/xy_spec.rb +0 -180
  106. data/spec/lib/aixm/z_spec.rb +0 -94
  107. data/spec/macros/marking.rb +0 -12
  108. data/spec/macros/organisation.rb +0 -11
  109. data/spec/macros/remarks.rb +0 -12
  110. data/spec/macros/timetable.rb +0 -11
  111. data/spec/macros/xy.rb +0 -11
  112. data/spec/macros/z_qnh.rb +0 -11
  113. data/spec/sounds/failure.mp3 +0 -0
  114. data/spec/sounds/success.mp3 +0 -0
  115. data/spec/spec_helper.rb +0 -62
@@ -1,52 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Feature::NavigationalAid do
4
- subject do
5
- AIXM::Feature::NavigationalAid.send(:new,
6
- organisation: AIXM::Factory.organisation,
7
- id: 'XXX',
8
- xy: AIXM::Factory.xy
9
- )
10
- end
11
-
12
- describe :id= do
13
- it "fails on invalid values" do
14
- _{ subject.id = 123 }.must_raise ArgumentError
15
- end
16
-
17
- it "upcases value" do
18
- _(subject.tap { |s| s.id = 'lol' }.id).must_equal 'LOL'
19
- end
20
- end
21
-
22
- describe :name= do
23
- it "fails on invalid values" do
24
- _([:foobar, 123]).wont_be_written_to subject, :name
25
- end
26
-
27
- it "accepts nil value" do
28
- _([nil]).must_be_written_to subject, :name
29
- end
30
-
31
- it "upcases and transcodes value" do
32
- _(subject.tap { |s| s.name = 'löl' }.name).must_equal 'LOEL'
33
- end
34
- end
35
-
36
- describe :xy= do
37
- macro :xy
38
- end
39
-
40
- describe :z= do
41
- macro :z_qnh
42
-
43
- it "accepts nil value" do
44
- _([nil]).must_be_written_to subject, :z
45
- end
46
- end
47
-
48
- describe :remarks= do
49
- macro :remarks
50
- end
51
-
52
- end
@@ -1,330 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Feature::ObstacleGroup do
4
- describe "unlinked obstacle group" do
5
- subject do
6
- AIXM.obstacle_group(name: "Mirmande éoliennes")
7
- end
8
-
9
- describe :initialize do
10
- it "sets defaults" do
11
- subject = AIXM.obstacle_group(
12
- name: "Mirmande éoliennes"
13
- )
14
- _(subject.obstacles).must_equal []
15
- end
16
- end
17
-
18
- describe :name= do
19
- it "fails on invalid values" do
20
- _([:foobar, 123]).wont_be_written_to subject, :name
21
- end
22
-
23
- it "upcases and transcodes valid values" do
24
- _(subject.name).must_equal 'MIRMANDE EOLIENNES'
25
- end
26
- end
27
-
28
- describe :xy_accuracy= do
29
- it "fails on invalid values" do
30
- _([:foobar, 123]).wont_be_written_to subject, :xy_accuracy
31
- end
32
-
33
- it "accepts valid values" do
34
- _([nil, AIXM::Factory.d, AIXM.d(0, :m)]).must_be_written_to subject, :xy_accuracy
35
- end
36
- end
37
-
38
- describe :z_accuracy= do
39
- it "fails on invalid values" do
40
- _([:foobar, 123]).wont_be_written_to subject, :z_accuracy
41
- end
42
-
43
- it "accepts valid values" do
44
- _([nil, AIXM::Factory.d, AIXM.d(0, :m)]).must_be_written_to subject, :z_accuracy
45
- end
46
- end
47
-
48
- describe :remarks= do
49
- macro :remarks
50
- end
51
-
52
- describe :add_obstacle do
53
- it "adds an obstacle to the obstacle group" do
54
- subject.add_obstacle(AIXM::Factory.obstacle)
55
- _(subject.obstacles.count).must_equal 1
56
- _(subject.obstacles.first.obstacle_group).must_equal subject
57
- end
58
- end
59
-
60
- describe :to_xml do
61
- subject do
62
- AIXM::Factory.unlinked_obstacle_group
63
- end
64
-
65
- it "builds correct AIXM" do
66
- _(subject.to_xml).must_equal <<~END
67
- <!-- Obstacle: [wind_turbine] 44.67501389N 004.87256667E LA TEISSONIERE 1 -->
68
- <Obs>
69
- <ObsUid>
70
- <geoLat>444030.05N</geoLat>
71
- <geoLong>0045221.24E</geoLong>
72
- </ObsUid>
73
- <txtName>LA TEISSONIERE 1</txtName>
74
- <txtDescrType>WINDTURBINE</txtDescrType>
75
- <codeGroup>Y</codeGroup>
76
- <codeLgt>N</codeLgt>
77
- <codeDatum>WGE</codeDatum>
78
- <valGeoAccuracy>50</valGeoAccuracy>
79
- <uomGeoAccuracy>M</uomGeoAccuracy>
80
- <valElev>1764</valElev>
81
- <valElevAccuracy>33</valElevAccuracy>
82
- <valHgt>262</valHgt>
83
- <uomDistVer>FT</uomDistVer>
84
- </Obs>
85
- <!-- Obstacle: [wind_turbine] 44.67946667N 004.87381111E LA TEISSONIERE 2 -->
86
- <Obs>
87
- <ObsUid>
88
- <geoLat>444046.08N</geoLat>
89
- <geoLong>0045225.72E</geoLong>
90
- </ObsUid>
91
- <txtName>LA TEISSONIERE 2</txtName>
92
- <txtDescrType>WINDTURBINE</txtDescrType>
93
- <codeGroup>Y</codeGroup>
94
- <codeLgt>N</codeLgt>
95
- <codeDatum>WGE</codeDatum>
96
- <valGeoAccuracy>50</valGeoAccuracy>
97
- <uomGeoAccuracy>M</uomGeoAccuracy>
98
- <valElev>1738</valElev>
99
- <valElevAccuracy>33</valElevAccuracy>
100
- <valHgt>262</valHgt>
101
- <uomDistVer>FT</uomDistVer>
102
- </Obs>
103
- END
104
- end
105
-
106
- it "builds correct OFMX" do
107
- AIXM.ofmx!
108
- _(subject.to_xml).must_equal <<~END
109
- <!-- Obstacle group: MIRMANDE EOLIENNES -->
110
- <Ogr>
111
- <OgrUid>
112
- <txtName>MIRMANDE EOLIENNES</txtName>
113
- <geoLat>44.67501389N</geoLat>
114
- <geoLong>004.87256667E</geoLong>
115
- </OgrUid>
116
- <codeDatum>WGE</codeDatum>
117
- <valGeoAccuracy>50</valGeoAccuracy>
118
- <uomGeoAccuracy>M</uomGeoAccuracy>
119
- <valElevAccuracy>33</valElevAccuracy>
120
- <uomElevAccuracy>FT</uomElevAccuracy>
121
- <txtRmk>Extension planned</txtRmk>
122
- </Ogr>
123
- <!-- Obstacle: [wind_turbine] 44.67501389N 004.87256667E LA TEISSONIERE 1 -->
124
- <Obs>
125
- <ObsUid>
126
- <OgrUid>
127
- <txtName>MIRMANDE EOLIENNES</txtName>
128
- <geoLat>44.67501389N</geoLat>
129
- <geoLong>004.87256667E</geoLong>
130
- </OgrUid>
131
- <geoLat>44.67501389N</geoLat>
132
- <geoLong>004.87256667E</geoLong>
133
- </ObsUid>
134
- <txtName>LA TEISSONIERE 1</txtName>
135
- <codeType>WINDTURBINE</codeType>
136
- <codeGroup>Y</codeGroup>
137
- <codeLgt>N</codeLgt>
138
- <codeMarking>N</codeMarking>
139
- <codeDatum>WGE</codeDatum>
140
- <valElev>1764</valElev>
141
- <valHgt>262</valHgt>
142
- <uomDistVer>FT</uomDistVer>
143
- <codeHgtAccuracy>N</codeHgtAccuracy>
144
- <valRadius>80</valRadius>
145
- <uomRadius>M</uomRadius>
146
- </Obs>
147
- <!-- Obstacle: [wind_turbine] 44.67946667N 004.87381111E LA TEISSONIERE 2 -->
148
- <Obs>
149
- <ObsUid>
150
- <OgrUid>
151
- <txtName>MIRMANDE EOLIENNES</txtName>
152
- <geoLat>44.67501389N</geoLat>
153
- <geoLong>004.87256667E</geoLong>
154
- </OgrUid>
155
- <geoLat>44.67946667N</geoLat>
156
- <geoLong>004.87381111E</geoLong>
157
- </ObsUid>
158
- <txtName>LA TEISSONIERE 2</txtName>
159
- <codeType>WINDTURBINE</codeType>
160
- <codeGroup>Y</codeGroup>
161
- <codeLgt>N</codeLgt>
162
- <codeMarking>N</codeMarking>
163
- <codeDatum>WGE</codeDatum>
164
- <valElev>1738</valElev>
165
- <valHgt>262</valHgt>
166
- <uomDistVer>FT</uomDistVer>
167
- <codeHgtAccuracy>N</codeHgtAccuracy>
168
- <valRadius>80</valRadius>
169
- <uomRadius>M</uomRadius>
170
- </Obs>
171
- END
172
- end
173
-
174
- it "builds OFMX with mid" do
175
- AIXM.ofmx!
176
- AIXM.config.mid_region = 'LF'
177
- _(subject.to_xml).must_match /<OgrUid mid="c099ea7c-2056-3921-5c1c-b28090537332">/
178
- end
179
- end
180
- end
181
-
182
- describe "linked obstacle group" do
183
- subject do
184
- AIXM.obstacle_group(name: "Mirmande éoliennes")
185
- end
186
-
187
- describe :add_obstacle do
188
- it "adds an obstacle to the obstacle group and links it to previous" do
189
- subject.add_obstacle(AIXM::Factory.obstacle)
190
- subject.add_obstacle(AIXM::Factory.obstacle, linked_to: :previous, link_type: :cable)
191
- _(subject.obstacles.count).must_equal 2
192
- _(subject.obstacles.last.linked_to).must_equal subject.obstacles.first
193
- _(subject.obstacles.last.link_type).must_equal :cable
194
- end
195
-
196
- it "adds an obstacle to the obstacle group and links it to another obstacle" do
197
- subject.add_obstacle(AIXM::Factory.obstacle)
198
- subject.add_obstacle(AIXM::Factory.obstacle, linked_to: subject.obstacles.first, link_type: :solid)
199
- _(subject.obstacles.count).must_equal 2
200
- _(subject.obstacles.last.linked_to).must_equal subject.obstacles.first
201
- _(subject.obstacles.last.link_type).must_equal :solid
202
- end
203
- end
204
-
205
- describe :to_xml do
206
- subject do
207
- AIXM::Factory.linked_obstacle_group
208
- end
209
-
210
- it "builds correct AIXM" do
211
- _(subject.to_xml).must_equal <<~END
212
- <!-- Obstacle: [mast] 52.29639722N 002.10675278W DROITWICH LW NORTH -->
213
- <Obs>
214
- <ObsUid>
215
- <geoLat>521747.03N</geoLat>
216
- <geoLong>0020624.31W</geoLong>
217
- </ObsUid>
218
- <txtName>DROITWICH LW NORTH</txtName>
219
- <txtDescrType>MAST</txtDescrType>
220
- <codeGroup>Y</codeGroup>
221
- <codeLgt>N</codeLgt>
222
- <codeDatum>WGE</codeDatum>
223
- <valGeoAccuracy>0</valGeoAccuracy>
224
- <uomGeoAccuracy>M</uomGeoAccuracy>
225
- <valElev>848</valElev>
226
- <valElevAccuracy>0</valElevAccuracy>
227
- <valHgt>700</valHgt>
228
- <uomDistVer>FT</uomDistVer>
229
- </Obs>
230
- <!-- Obstacle: [mast] 52.29457778N 002.10568611W DROITWICH LW NORTH -->
231
- <Obs>
232
- <ObsUid>
233
- <geoLat>521740.48N</geoLat>
234
- <geoLong>0020620.47W</geoLong>
235
- </ObsUid>
236
- <txtName>DROITWICH LW NORTH</txtName>
237
- <txtDescrType>MAST</txtDescrType>
238
- <codeGroup>Y</codeGroup>
239
- <codeLgt>N</codeLgt>
240
- <codeDatum>WGE</codeDatum>
241
- <valGeoAccuracy>0</valGeoAccuracy>
242
- <uomGeoAccuracy>M</uomGeoAccuracy>
243
- <valElev>848</valElev>
244
- <valElevAccuracy>0</valElevAccuracy>
245
- <valHgt>700</valHgt>
246
- <uomDistVer>FT</uomDistVer>
247
- </Obs>
248
- END
249
- end
250
-
251
- it "builds correct OFMX" do
252
- AIXM.ofmx!
253
- _(subject.to_xml).must_equal <<~END
254
- <!-- Obstacle group: DROITWICH LONGWAVE ANTENNA -->
255
- <Ogr>
256
- <OgrUid>
257
- <txtName>DROITWICH LONGWAVE ANTENNA</txtName>
258
- <geoLat>52.29639722N</geoLat>
259
- <geoLong>002.10675278W</geoLong>
260
- </OgrUid>
261
- <codeDatum>WGE</codeDatum>
262
- <valGeoAccuracy>0</valGeoAccuracy>
263
- <uomGeoAccuracy>M</uomGeoAccuracy>
264
- <valElevAccuracy>0</valElevAccuracy>
265
- <uomElevAccuracy>FT</uomElevAccuracy>
266
- <txtRmk>Destruction planned</txtRmk>
267
- </Ogr>
268
- <!-- Obstacle: [mast] 52.29639722N 002.10675278W DROITWICH LW NORTH -->
269
- <Obs>
270
- <ObsUid>
271
- <OgrUid>
272
- <txtName>DROITWICH LONGWAVE ANTENNA</txtName>
273
- <geoLat>52.29639722N</geoLat>
274
- <geoLong>002.10675278W</geoLong>
275
- </OgrUid>
276
- <geoLat>52.29639722N</geoLat>
277
- <geoLong>002.10675278W</geoLong>
278
- </ObsUid>
279
- <txtName>DROITWICH LW NORTH</txtName>
280
- <codeType>MAST</codeType>
281
- <codeGroup>Y</codeGroup>
282
- <codeLgt>N</codeLgt>
283
- <codeMarking>N</codeMarking>
284
- <codeDatum>WGE</codeDatum>
285
- <valElev>848</valElev>
286
- <valHgt>700</valHgt>
287
- <uomDistVer>FT</uomDistVer>
288
- <codeHgtAccuracy>Y</codeHgtAccuracy>
289
- <valRadius>200</valRadius>
290
- <uomRadius>M</uomRadius>
291
- </Obs>
292
- <!-- Obstacle: [mast] 52.29457778N 002.10568611W DROITWICH LW NORTH -->
293
- <Obs>
294
- <ObsUid>
295
- <OgrUid>
296
- <txtName>DROITWICH LONGWAVE ANTENNA</txtName>
297
- <geoLat>52.29639722N</geoLat>
298
- <geoLong>002.10675278W</geoLong>
299
- </OgrUid>
300
- <geoLat>52.29457778N</geoLat>
301
- <geoLong>002.10568611W</geoLong>
302
- </ObsUid>
303
- <txtName>DROITWICH LW NORTH</txtName>
304
- <codeType>MAST</codeType>
305
- <codeGroup>Y</codeGroup>
306
- <codeLgt>N</codeLgt>
307
- <codeMarking>N</codeMarking>
308
- <codeDatum>WGE</codeDatum>
309
- <valElev>848</valElev>
310
- <valHgt>700</valHgt>
311
- <uomDistVer>FT</uomDistVer>
312
- <codeHgtAccuracy>Y</codeHgtAccuracy>
313
- <valRadius>200</valRadius>
314
- <uomRadius>M</uomRadius>
315
- <ObsUidLink>
316
- <OgrUid>
317
- <txtName>DROITWICH LONGWAVE ANTENNA</txtName>
318
- <geoLat>52.29639722N</geoLat>
319
- <geoLong>002.10675278W</geoLong>
320
- </OgrUid>
321
- <geoLat>52.29639722N</geoLat>
322
- <geoLong>002.10675278W</geoLong>
323
- </ObsUidLink>
324
- <codeLinkType>CABLE</codeLinkType>
325
- </Obs>
326
- END
327
- end
328
- end
329
- end
330
- end
@@ -1,284 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Feature::Obstacle do
4
- subject do
5
- AIXM::Factory.obstacle
6
- end
7
-
8
- describe :initialize do
9
- it "sets defaults" do
10
- subject = AIXM.obstacle(
11
- type: :tower,
12
- xy: AIXM.xy(lat: %q(48°51'29.7"N), long: %q(002°17'40.52"E)),
13
- radius: AIXM.d(88, :m),
14
- z: AIXM.z(1187 , :qnh)
15
- )
16
- _(subject).wont_be :lighting
17
- _(subject).wont_be :marking
18
- _(subject).wont_be :height_accurate
19
- end
20
- end
21
-
22
- describe :name= do
23
- it "fails on invalid values" do
24
- _([:foobar, 123]).wont_be_written_to subject, :name
25
- end
26
-
27
- it "upcases and transcodes valid values" do
28
- _(subject.tap { |s| s.name = 'Teufelsbrücke' }.name).must_equal 'TEUFELSBRUECKE'
29
- end
30
- end
31
-
32
- describe :type= do
33
- it "fails on invalid values" do
34
- _([nil, :foobar]).wont_be_written_to subject, :type
35
- end
36
-
37
- it "looks up valid values" do
38
- _(subject.tap { |s| s.type = :WINDTURBINE }.type).must_equal :wind_turbine
39
- _(subject.tap { |s| s.type = :TOWER }.type).must_equal :tower
40
- end
41
- end
42
-
43
- describe :xy= do
44
- macro :xy
45
-
46
- it "fails on nil values" do
47
- _([nil]).wont_be_written_to subject, :xy
48
- end
49
- end
50
-
51
- describe :radius= do
52
- it "fails on invalid values" do
53
- _([:foobar, 123, AIXM.d(0, :m)]).wont_be_written_to subject, :radius
54
- end
55
-
56
- it "accepts valid values" do
57
- _([AIXM::Factory.d, nil]).must_be_written_to subject, :radius
58
- end
59
- end
60
-
61
- describe :z= do
62
- macro :z_qnh
63
-
64
- it "fails on nil values" do
65
- _([nil]).wont_be_written_to subject, :z
66
- end
67
- end
68
-
69
- describe :lighting= do
70
- it "fails on invalid values" do
71
- _([:foobar, 123]).wont_be_written_to subject, :lighting
72
- end
73
-
74
- it "accepts valid values" do
75
- _([true, false, nil]).must_be_written_to subject, :lighting
76
- end
77
- end
78
-
79
- describe :lighting_remarks= do
80
- it "accepts nil value" do
81
- _([nil]).must_be_written_to subject, :lighting_remarks
82
- end
83
-
84
- it "stringifies valid values" do
85
- _(subject.tap { |s| s.lighting_remarks = 'foobar' }.lighting_remarks).must_equal 'foobar'
86
- _(subject.tap { |s| s.lighting_remarks = 123 }.lighting_remarks).must_equal '123'
87
- end
88
- end
89
-
90
- describe :marking= do
91
- it "fails on invalid values" do
92
- _([:foobar, 123]).wont_be_written_to subject, :marking
93
- end
94
-
95
- it "accepts valid values" do
96
- _([true, false, nil]).must_be_written_to subject, :marking
97
- end
98
- end
99
-
100
- describe :marking_remarks= do
101
- it "accepts nil value" do
102
- _([nil]).must_be_written_to subject, :marking_remarks
103
- end
104
-
105
- it "stringifies valid values" do
106
- _(subject.tap { |s| s.marking_remarks = 'foobar' }.marking_remarks).must_equal 'foobar'
107
- _(subject.tap { |s| s.marking_remarks = 123 }.marking_remarks).must_equal '123'
108
- end
109
- end
110
-
111
- describe :height= do
112
- it "fails on invalid values" do
113
- _([:foobar, 123, AIXM.d(0, :m)]).wont_be_written_to subject, :height
114
- end
115
-
116
- it "accepts valid values" do
117
- _([nil, AIXM::Factory.d]).must_be_written_to subject, :height
118
- end
119
- end
120
-
121
- describe :xy_accuracy= do
122
- it "fails on invalid values" do
123
- _([:foobar, 123]).wont_be_written_to subject, :xy_accuracy
124
- end
125
-
126
- it "accepts valid values" do
127
- _([nil, AIXM::Factory.d, AIXM.d(0, :m)]).must_be_written_to subject, :xy_accuracy
128
- end
129
- end
130
-
131
- describe :z_accuracy= do
132
- it "fails on invalid values" do
133
- _([:foobar, 123]).wont_be_written_to subject, :z_accuracy
134
- end
135
-
136
- it "accepts valid values" do
137
- _([nil, AIXM::Factory.d, AIXM.d(0, :m)]).must_be_written_to subject, :z_accuracy
138
- end
139
- end
140
-
141
- describe :height_accurate= do
142
- it "fails on invalid values" do
143
- _([:foobar, 123]).wont_be_written_to subject, :height_accurate
144
- end
145
-
146
- it "accepts valid values" do
147
- _([true, false, nil]).must_be_written_to subject, :height_accurate
148
- end
149
- end
150
-
151
- describe :valid_from= do
152
- it "fails on invalid values" do
153
- _(['foobar', '2018-01-77']).wont_be_written_to subject, :valid_from
154
- end
155
-
156
- it "accepts nil value" do
157
- _([nil]).must_be_written_to subject, :valid_from
158
- end
159
-
160
- it "parses dates and times" do
161
- string = '2018-01-01 12:00:00 +0100'
162
- _(subject.tap { |s| s.valid_from = string }.valid_from).must_equal Time.parse(string)
163
- end
164
- end
165
-
166
- describe :valid_until= do
167
- it "fails on invalid values" do
168
- _(['foobar', '2018-01-77']).wont_be_written_to subject, :valid_until
169
- end
170
-
171
- it "accepts nil value" do
172
- _([nil]).must_be_written_to subject, :valid_until
173
- end
174
-
175
- it "parses dates and times" do
176
- string = '2018-01-01 12:00:00 +0100'
177
- _(subject.tap { |s| s.valid_until = string }.valid_until).must_equal Time.parse(string)
178
- end
179
- end
180
-
181
- describe :remarks= do
182
- macro :remarks
183
- end
184
-
185
- describe :grouped? do
186
- it "returns false since single obstacles are not grouped" do
187
- _(subject).wont_be :grouped?
188
- end
189
- end
190
-
191
- describe :linked? do
192
- subject do
193
- AIXM::Factory.unlinked_obstacle_group.obstacles.first
194
- end
195
-
196
- it "returns false for unlinked obstacles" do
197
- _(subject).wont_be :linked?
198
- end
199
-
200
- it "returns true for linked obstacles" do
201
- subject = AIXM::Factory.linked_obstacle_group.obstacles.last
202
- _(subject).must_be :linked?
203
- end
204
- end
205
-
206
- describe :to_xml do
207
- it "builds correct AIXM" do
208
- _(subject.to_xml).must_equal <<~END
209
- <!-- Obstacle: [tower] 48.85825000N 002.29458889E EIFFEL TOWER -->
210
- <Obs>
211
- <ObsUid>
212
- <geoLat>485129.70N</geoLat>
213
- <geoLong>0021740.52E</geoLong>
214
- </ObsUid>
215
- <txtName>EIFFEL TOWER</txtName>
216
- <txtDescrType>TOWER</txtDescrType>
217
- <codeGroup>N</codeGroup>
218
- <codeLgt>Y</codeLgt>
219
- <txtDescrLgt>red strobes</txtDescrLgt>
220
- <codeDatum>WGE</codeDatum>
221
- <valGeoAccuracy>2</valGeoAccuracy>
222
- <uomGeoAccuracy>M</uomGeoAccuracy>
223
- <valElev>1187</valElev>
224
- <valElevAccuracy>3</valElevAccuracy>
225
- <valHgt>1063</valHgt>
226
- <uomDistVer>FT</uomDistVer>
227
- <txtRmk>Temporary light installations (white strobes, gyro light etc)</txtRmk>
228
- </Obs>
229
- END
230
- end
231
-
232
- it "builds correct OFMX" do
233
- AIXM.ofmx!
234
- _(subject.to_xml).must_equal <<~END
235
- <!-- Obstacle group: EIFFEL TOWER -->
236
- <Ogr>
237
- <OgrUid>
238
- <txtName>EIFFEL TOWER</txtName>
239
- <geoLat>48.85825000N</geoLat>
240
- <geoLong>002.29458889E</geoLong>
241
- </OgrUid>
242
- <codeDatum>WGE</codeDatum>
243
- <valGeoAccuracy>2</valGeoAccuracy>
244
- <uomGeoAccuracy>M</uomGeoAccuracy>
245
- <valElevAccuracy>3</valElevAccuracy>
246
- <uomElevAccuracy>FT</uomElevAccuracy>
247
- </Ogr>
248
- <!-- Obstacle: [tower] 48.85825000N 002.29458889E EIFFEL TOWER -->
249
- <Obs>
250
- <ObsUid>
251
- <OgrUid>
252
- <txtName>EIFFEL TOWER</txtName>
253
- <geoLat>48.85825000N</geoLat>
254
- <geoLong>002.29458889E</geoLong>
255
- </OgrUid>
256
- <geoLat>48.85825000N</geoLat>
257
- <geoLong>002.29458889E</geoLong>
258
- </ObsUid>
259
- <txtName>EIFFEL TOWER</txtName>
260
- <codeType>TOWER</codeType>
261
- <codeGroup>N</codeGroup>
262
- <codeLgt>Y</codeLgt>
263
- <txtDescrLgt>red strobes</txtDescrLgt>
264
- <codeDatum>WGE</codeDatum>
265
- <valElev>1187</valElev>
266
- <valHgt>1063</valHgt>
267
- <uomDistVer>FT</uomDistVer>
268
- <codeHgtAccuracy>Y</codeHgtAccuracy>
269
- <valRadius>88</valRadius>
270
- <uomRadius>M</uomRadius>
271
- <datetimeValidWef>2018-01-01T12:00:00+01:00</datetimeValidWef>
272
- <datetimeValidTil>2019-01-01T12:00:00+01:00</datetimeValidTil>
273
- <txtRmk>Temporary light installations (white strobes, gyro light etc)</txtRmk>
274
- </Obs>
275
- END
276
- end
277
-
278
- it "builds OFMX with mid" do
279
- AIXM.ofmx!
280
- AIXM.config.mid_region = 'LF'
281
- _(subject.to_xml).must_match /<ObsUid mid="864b252b-0b1d-66c4-22cd-14dbda287467">/
282
- end
283
- end
284
- end