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,326 +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
- AIXM.aixm!
67
- subject.to_xml.must_equal <<~END
68
- <!-- Obstacle: [wind_turbine] 44.67501389N 004.87256667E LA TEISSONIERE 1 -->
69
- <Obs>
70
- <ObsUid>
71
- <geoLat>444030.05N</geoLat>
72
- <geoLong>0045221.24E</geoLong>
73
- </ObsUid>
74
- <txtName>LA TEISSONIERE 1</txtName>
75
- <txtDescrType>WINDTURBINE</txtDescrType>
76
- <codeGroup>Y</codeGroup>
77
- <codeLgt>N</codeLgt>
78
- <codeDatum>WGE</codeDatum>
79
- <valGeoAccuracy>50</valGeoAccuracy>
80
- <uomGeoAccuracy>M</uomGeoAccuracy>
81
- <valElev>1764</valElev>
82
- <valElevAccuracy>33</valElevAccuracy>
83
- <valHgt>262</valHgt>
84
- <uomDistVer>FT</uomDistVer>
85
- </Obs>
86
- <!-- Obstacle: [wind_turbine] 44.67946667N 004.87381111E LA TEISSONIERE 2 -->
87
- <Obs>
88
- <ObsUid>
89
- <geoLat>444046.08N</geoLat>
90
- <geoLong>0045225.72E</geoLong>
91
- </ObsUid>
92
- <txtName>LA TEISSONIERE 2</txtName>
93
- <txtDescrType>WINDTURBINE</txtDescrType>
94
- <codeGroup>Y</codeGroup>
95
- <codeLgt>N</codeLgt>
96
- <codeDatum>WGE</codeDatum>
97
- <valGeoAccuracy>50</valGeoAccuracy>
98
- <uomGeoAccuracy>M</uomGeoAccuracy>
99
- <valElev>1738</valElev>
100
- <valElevAccuracy>33</valElevAccuracy>
101
- <valHgt>262</valHgt>
102
- <uomDistVer>FT</uomDistVer>
103
- </Obs>
104
- END
105
- end
106
-
107
- it "builds correct OFMX" do
108
- AIXM.ofmx!
109
- subject.to_xml.must_equal <<~END
110
- <!-- Obstacle group: MIRMANDE EOLIENNES -->
111
- <Ogr>
112
- <OgrUid>
113
- <txtName>MIRMANDE EOLIENNES</txtName>
114
- <geoLat>44.67501389N</geoLat>
115
- <geoLong>004.87256667E</geoLong>
116
- </OgrUid>
117
- <codeDatum>WGE</codeDatum>
118
- <valGeoAccuracy>50</valGeoAccuracy>
119
- <uomGeoAccuracy>M</uomGeoAccuracy>
120
- <valElevAccuracy>33</valElevAccuracy>
121
- <uomElevAccuracy>FT</uomElevAccuracy>
122
- <txtRmk>Extension planned</txtRmk>
123
- </Ogr>
124
- <!-- Obstacle: [wind_turbine] 44.67501389N 004.87256667E LA TEISSONIERE 1 -->
125
- <Obs>
126
- <ObsUid>
127
- <OgrUid>
128
- <txtName>MIRMANDE EOLIENNES</txtName>
129
- <geoLat>44.67501389N</geoLat>
130
- <geoLong>004.87256667E</geoLong>
131
- </OgrUid>
132
- <geoLat>44.67501389N</geoLat>
133
- <geoLong>004.87256667E</geoLong>
134
- </ObsUid>
135
- <txtName>LA TEISSONIERE 1</txtName>
136
- <codeType>WINDTURBINE</codeType>
137
- <codeGroup>Y</codeGroup>
138
- <codeLgt>N</codeLgt>
139
- <codeMarking>N</codeMarking>
140
- <codeDatum>WGE</codeDatum>
141
- <valElev>1764</valElev>
142
- <valHgt>262</valHgt>
143
- <uomDistVer>FT</uomDistVer>
144
- <codeHgtAccuracy>N</codeHgtAccuracy>
145
- <valRadius>80</valRadius>
146
- <uomRadius>M</uomRadius>
147
- </Obs>
148
- <!-- Obstacle: [wind_turbine] 44.67946667N 004.87381111E LA TEISSONIERE 2 -->
149
- <Obs>
150
- <ObsUid>
151
- <OgrUid>
152
- <txtName>MIRMANDE EOLIENNES</txtName>
153
- <geoLat>44.67501389N</geoLat>
154
- <geoLong>004.87256667E</geoLong>
155
- </OgrUid>
156
- <geoLat>44.67946667N</geoLat>
157
- <geoLong>004.87381111E</geoLong>
158
- </ObsUid>
159
- <txtName>LA TEISSONIERE 2</txtName>
160
- <codeType>WINDTURBINE</codeType>
161
- <codeGroup>Y</codeGroup>
162
- <codeLgt>N</codeLgt>
163
- <codeMarking>N</codeMarking>
164
- <codeDatum>WGE</codeDatum>
165
- <valElev>1738</valElev>
166
- <valHgt>262</valHgt>
167
- <uomDistVer>FT</uomDistVer>
168
- <codeHgtAccuracy>N</codeHgtAccuracy>
169
- <valRadius>80</valRadius>
170
- <uomRadius>M</uomRadius>
171
- </Obs>
172
- END
173
- end
174
- end
175
- end
176
-
177
- describe "linked obstacle group" do
178
- subject do
179
- AIXM.obstacle_group(name: "Mirmande éoliennes")
180
- end
181
-
182
- describe :add_obstacle do
183
- it "adds an obstacle to the obstacle group and links it to previous" do
184
- subject.add_obstacle(AIXM::Factory.obstacle)
185
- subject.add_obstacle(AIXM::Factory.obstacle, linked_to: :previous, link_type: :cable)
186
- subject.obstacles.count.must_equal 2
187
- subject.obstacles.last.linked_to.must_equal subject.obstacles.first
188
- subject.obstacles.last.link_type.must_equal :cable
189
- end
190
-
191
- it "adds an obstacle to the obstacle group and links it to another obstacle" do
192
- subject.add_obstacle(AIXM::Factory.obstacle)
193
- subject.add_obstacle(AIXM::Factory.obstacle, linked_to: subject.obstacles.first, link_type: :solid)
194
- subject.obstacles.count.must_equal 2
195
- subject.obstacles.last.linked_to.must_equal subject.obstacles.first
196
- subject.obstacles.last.link_type.must_equal :solid
197
- end
198
- end
199
-
200
- describe :to_xml do
201
- subject do
202
- AIXM::Factory.linked_obstacle_group
203
- end
204
-
205
- it "builds correct AIXM" do
206
- AIXM.aixm!
207
- subject.to_xml.must_equal <<~END
208
- <!-- Obstacle: [mast] 52.29639722N 002.10675278W DROITWICH LW NORTH -->
209
- <Obs>
210
- <ObsUid>
211
- <geoLat>521747.03N</geoLat>
212
- <geoLong>0020624.31W</geoLong>
213
- </ObsUid>
214
- <txtName>DROITWICH LW NORTH</txtName>
215
- <txtDescrType>MAST</txtDescrType>
216
- <codeGroup>Y</codeGroup>
217
- <codeLgt>N</codeLgt>
218
- <codeDatum>WGE</codeDatum>
219
- <valGeoAccuracy>0</valGeoAccuracy>
220
- <uomGeoAccuracy>M</uomGeoAccuracy>
221
- <valElev>848</valElev>
222
- <valElevAccuracy>0</valElevAccuracy>
223
- <valHgt>700</valHgt>
224
- <uomDistVer>FT</uomDistVer>
225
- </Obs>
226
- <!-- Obstacle: [mast] 52.29457778N 002.10568611W DROITWICH LW NORTH -->
227
- <Obs>
228
- <ObsUid>
229
- <geoLat>521740.48N</geoLat>
230
- <geoLong>0020620.47W</geoLong>
231
- </ObsUid>
232
- <txtName>DROITWICH LW NORTH</txtName>
233
- <txtDescrType>MAST</txtDescrType>
234
- <codeGroup>Y</codeGroup>
235
- <codeLgt>N</codeLgt>
236
- <codeDatum>WGE</codeDatum>
237
- <valGeoAccuracy>0</valGeoAccuracy>
238
- <uomGeoAccuracy>M</uomGeoAccuracy>
239
- <valElev>848</valElev>
240
- <valElevAccuracy>0</valElevAccuracy>
241
- <valHgt>700</valHgt>
242
- <uomDistVer>FT</uomDistVer>
243
- </Obs>
244
- END
245
- end
246
-
247
- it "builds correct OFMX" do
248
- AIXM.ofmx!
249
- subject.to_xml.must_equal <<~END
250
- <!-- Obstacle group: DROITWICH LONGWAVE ANTENNA -->
251
- <Ogr>
252
- <OgrUid>
253
- <txtName>DROITWICH LONGWAVE ANTENNA</txtName>
254
- <geoLat>52.29639722N</geoLat>
255
- <geoLong>002.10675278W</geoLong>
256
- </OgrUid>
257
- <codeDatum>WGE</codeDatum>
258
- <valGeoAccuracy>0</valGeoAccuracy>
259
- <uomGeoAccuracy>M</uomGeoAccuracy>
260
- <valElevAccuracy>0</valElevAccuracy>
261
- <uomElevAccuracy>FT</uomElevAccuracy>
262
- <txtRmk>Destruction planned</txtRmk>
263
- </Ogr>
264
- <!-- Obstacle: [mast] 52.29639722N 002.10675278W DROITWICH LW NORTH -->
265
- <Obs>
266
- <ObsUid>
267
- <OgrUid>
268
- <txtName>DROITWICH LONGWAVE ANTENNA</txtName>
269
- <geoLat>52.29639722N</geoLat>
270
- <geoLong>002.10675278W</geoLong>
271
- </OgrUid>
272
- <geoLat>52.29639722N</geoLat>
273
- <geoLong>002.10675278W</geoLong>
274
- </ObsUid>
275
- <txtName>DROITWICH LW NORTH</txtName>
276
- <codeType>MAST</codeType>
277
- <codeGroup>Y</codeGroup>
278
- <codeLgt>N</codeLgt>
279
- <codeMarking>N</codeMarking>
280
- <codeDatum>WGE</codeDatum>
281
- <valElev>848</valElev>
282
- <valHgt>700</valHgt>
283
- <uomDistVer>FT</uomDistVer>
284
- <codeHgtAccuracy>Y</codeHgtAccuracy>
285
- <valRadius>200</valRadius>
286
- <uomRadius>M</uomRadius>
287
- </Obs>
288
- <!-- Obstacle: [mast] 52.29457778N 002.10568611W DROITWICH LW NORTH -->
289
- <Obs>
290
- <ObsUid>
291
- <OgrUid>
292
- <txtName>DROITWICH LONGWAVE ANTENNA</txtName>
293
- <geoLat>52.29639722N</geoLat>
294
- <geoLong>002.10675278W</geoLong>
295
- </OgrUid>
296
- <geoLat>52.29457778N</geoLat>
297
- <geoLong>002.10568611W</geoLong>
298
- </ObsUid>
299
- <txtName>DROITWICH LW NORTH</txtName>
300
- <codeType>MAST</codeType>
301
- <codeGroup>Y</codeGroup>
302
- <codeLgt>N</codeLgt>
303
- <codeMarking>N</codeMarking>
304
- <codeDatum>WGE</codeDatum>
305
- <valElev>848</valElev>
306
- <valHgt>700</valHgt>
307
- <uomDistVer>FT</uomDistVer>
308
- <codeHgtAccuracy>Y</codeHgtAccuracy>
309
- <valRadius>200</valRadius>
310
- <uomRadius>M</uomRadius>
311
- <ObsUidLink>
312
- <OgrUid>
313
- <txtName>DROITWICH LONGWAVE ANTENNA</txtName>
314
- <geoLat>52.29639722N</geoLat>
315
- <geoLong>002.10675278W</geoLong>
316
- </OgrUid>
317
- <geoLat>52.29639722N</geoLat>
318
- <geoLong>002.10675278W</geoLong>
319
- </ObsUidLink>
320
- <codeLinkType>CABLE</codeLinkType>
321
- </Obs>
322
- END
323
- end
324
- end
325
- end
326
- end
@@ -1,279 +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
- AIXM.aixm!
209
- subject.to_xml.must_equal <<~END
210
- <!-- Obstacle: [tower] 48.85825000N 002.29458889E EIFFEL TOWER -->
211
- <Obs>
212
- <ObsUid>
213
- <geoLat>485129.70N</geoLat>
214
- <geoLong>0021740.52E</geoLong>
215
- </ObsUid>
216
- <txtName>EIFFEL TOWER</txtName>
217
- <txtDescrType>TOWER</txtDescrType>
218
- <codeGroup>N</codeGroup>
219
- <codeLgt>Y</codeLgt>
220
- <txtDescrLgt>red strobes</txtDescrLgt>
221
- <codeDatum>WGE</codeDatum>
222
- <valGeoAccuracy>2</valGeoAccuracy>
223
- <uomGeoAccuracy>M</uomGeoAccuracy>
224
- <valElev>1187</valElev>
225
- <valElevAccuracy>3</valElevAccuracy>
226
- <valHgt>1063</valHgt>
227
- <uomDistVer>FT</uomDistVer>
228
- <txtRmk>Temporary light installations (white strobes, gyro light etc)</txtRmk>
229
- </Obs>
230
- END
231
- end
232
-
233
- it "builds correct OFMX" do
234
- AIXM.ofmx!
235
- subject.to_xml.must_equal <<~END
236
- <!-- Obstacle group: EIFFEL TOWER -->
237
- <Ogr>
238
- <OgrUid>
239
- <txtName>EIFFEL TOWER</txtName>
240
- <geoLat>48.85825000N</geoLat>
241
- <geoLong>002.29458889E</geoLong>
242
- </OgrUid>
243
- <codeDatum>WGE</codeDatum>
244
- <valGeoAccuracy>2</valGeoAccuracy>
245
- <uomGeoAccuracy>M</uomGeoAccuracy>
246
- <valElevAccuracy>3</valElevAccuracy>
247
- <uomElevAccuracy>FT</uomElevAccuracy>
248
- </Ogr>
249
- <!-- Obstacle: [tower] 48.85825000N 002.29458889E EIFFEL TOWER -->
250
- <Obs>
251
- <ObsUid>
252
- <OgrUid>
253
- <txtName>EIFFEL TOWER</txtName>
254
- <geoLat>48.85825000N</geoLat>
255
- <geoLong>002.29458889E</geoLong>
256
- </OgrUid>
257
- <geoLat>48.85825000N</geoLat>
258
- <geoLong>002.29458889E</geoLong>
259
- </ObsUid>
260
- <txtName>EIFFEL TOWER</txtName>
261
- <codeType>TOWER</codeType>
262
- <codeGroup>N</codeGroup>
263
- <codeLgt>Y</codeLgt>
264
- <txtDescrLgt>red strobes</txtDescrLgt>
265
- <codeDatum>WGE</codeDatum>
266
- <valElev>1187</valElev>
267
- <valHgt>1063</valHgt>
268
- <uomDistVer>FT</uomDistVer>
269
- <codeHgtAccuracy>Y</codeHgtAccuracy>
270
- <valRadius>88</valRadius>
271
- <uomRadius>M</uomRadius>
272
- <datetimeValidWef>2018-01-01T12:00:00+01:00</datetimeValidWef>
273
- <datetimeValidTil>2019-01-01T12:00:00+01:00</datetimeValidTil>
274
- <txtRmk>Temporary light installations (white strobes, gyro light etc)</txtRmk>
275
- </Obs>
276
- END
277
- end
278
- end
279
- end
@@ -1,77 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Feature::Organisation do
4
- subject do
5
- AIXM::Factory.organisation
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 = 'Nîmes-Alès' }.name.must_equal 'NIMES-ALES'
15
- end
16
- end
17
-
18
- describe :type= do
19
- it "fails on invalid values" do
20
- [nil, :foobar, 123].wont_be_written_to subject, :type
21
- end
22
-
23
- it "looks up valid values" do
24
- subject.tap { |s| s.type = :state }.type.must_equal :state
25
- subject.tap { |s| s.type = :IO }.type.must_equal :international_organisation
26
- end
27
- end
28
-
29
- describe :id= do
30
- it "fails on invalid values" do
31
- [:foobar, 123].wont_be_written_to subject, :id
32
- end
33
-
34
- it "accepts nil value" do
35
- [nil].must_be_written_to subject, :id
36
- end
37
-
38
- it "upcases valid values" do
39
- subject.tap { |s| s.id = 'lf' }.id.must_equal 'LF'
40
- end
41
- end
42
-
43
- describe :remarks= do
44
- macro :remarks
45
- end
46
-
47
- describe :to_xml do
48
- it "builds correct complete OFMX" do
49
- AIXM.ofmx!
50
- subject.to_xml.must_equal <<~END
51
- <!-- Organisation: FRANCE -->
52
- <Org source="LF|GEN|0.0 FACTORY|0|0">
53
- <OrgUid>
54
- <txtName>FRANCE</txtName>
55
- </OrgUid>
56
- <codeId>LF</codeId>
57
- <codeType>S</codeType>
58
- <txtRmk>Oversea departments not included</txtRmk>
59
- </Org>
60
- END
61
- end
62
-
63
- it "builds correct minimal OFMX" do
64
- AIXM.ofmx!
65
- subject.id = subject.remarks = nil
66
- subject.to_xml.must_equal <<~END
67
- <!-- Organisation: FRANCE -->
68
- <Org source="LF|GEN|0.0 FACTORY|0|0">
69
- <OrgUid>
70
- <txtName>FRANCE</txtName>
71
- </OrgUid>
72
- <codeType>S</codeType>
73
- </Org>
74
- END
75
- end
76
- end
77
- end