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,193 +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
-
187
- it "builds OFMX with mid" do
188
- AIXM.ofmx!
189
- AIXM.config.mid_region = 'LF'
190
- _(subject.to_xml).must_match /<TlaUid mid="c1f675f9-ed0f-e52e-b117-f9fe6a00fe7c">/
191
- end
192
- end
193
- end
@@ -1,135 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Layer do
4
-
5
- context "only required attributes set" do
6
- subject do
7
- AIXM.layer(vertical_limits: AIXM::Factory.vertical_limits)
8
- end
9
-
10
- describe :initialize do
11
- it "sets defaults" do
12
- _(subject).wont_be :selective?
13
- end
14
- end
15
-
16
- describe :class= do
17
- it "fails on invalid values" do
18
- _([:X, 'X']).wont_be_written_to subject, :class
19
- end
20
-
21
- it "symbolizes and upcases valid values" do
22
- _(subject.tap { |s| s.class = 'c' }.class).must_equal :C
23
- end
24
- end
25
-
26
- describe :location_indicator= do
27
- it "fails on invalid values" do
28
- _([:foobar, 123, 'XXX', 'XXXXX']).wont_be_written_to subject, :location_indicator
29
- end
30
-
31
- it "accepts nil value" do
32
- _([nil]).must_be_written_to subject, :location_indicator
33
- end
34
-
35
- it "upcases value" do
36
- _(subject.tap { |s| s.location_indicator = 'lfbb' }.location_indicator).must_equal 'LFBB'
37
- end
38
- end
39
-
40
- describe :vertical_limits= do
41
- it "fails on invalid values" do
42
- _([nil, :foobar, 123]).wont_be_written_to subject, :vertical_limits
43
- end
44
- end
45
-
46
- describe :activity= do
47
- it "fails on invalid values" do
48
- _([:foobar, 123]).wont_be_written_to subject, :activity
49
- end
50
-
51
- it "looks up valid values" do
52
- _(subject.tap { |s| s.activity = :aerodrome_traffic }.activity).must_equal :aerodrome_traffic
53
- _(subject.tap { |s| s.activity = :GLIDER }.activity).must_equal :gliding
54
- end
55
- end
56
-
57
- describe :timetable= do
58
- macro :timetable
59
- end
60
-
61
- describe :selective= do
62
- it "fails on invalid values" do
63
- _([nil, 'N', 0]).wont_be_written_to subject, :selective
64
- end
65
- end
66
-
67
- describe :remarks= do
68
- macro :remarks
69
- end
70
-
71
- describe :to_xml do
72
- it "builds correct OFMX" do
73
- AIXM.ofmx!
74
- _(subject.to_xml).must_equal <<~END
75
- <codeDistVerUpper>STD</codeDistVerUpper>
76
- <valDistVerUpper>65</valDistVerUpper>
77
- <uomDistVerUpper>FL</uomDistVerUpper>
78
- <codeDistVerLower>STD</codeDistVerLower>
79
- <valDistVerLower>45</valDistVerLower>
80
- <uomDistVerLower>FL</uomDistVerLower>
81
- <codeDistVerMax>ALT</codeDistVerMax>
82
- <valDistVerMax>6000</valDistVerMax>
83
- <uomDistVerMax>FT</uomDistVerMax>
84
- <codeDistVerMnm>HEI</codeDistVerMnm>
85
- <valDistVerMnm>3000</valDistVerMnm>
86
- <uomDistVerMnm>FT</uomDistVerMnm>
87
- <codeSelAvbl>N</codeSelAvbl>
88
- END
89
- end
90
-
91
- it "builds correct AIXM" do
92
- _(subject.to_xml).wont_match(/<codeSelAvbl>/)
93
- _(subject.to_xml).wont_match(/<Att>/)
94
- _(subject.to_xml).wont_match(/<txtRmk>/)
95
- end
96
- end
97
- end
98
-
99
- context "required and optional attributes set" do
100
- subject do
101
- AIXM::Factory.layer
102
- end
103
-
104
- it "builds correct OFMX" do
105
- AIXM.ofmx!
106
- _(subject.to_xml).must_equal <<~END
107
- <codeClass>C</codeClass>
108
- <codeLocInd>XXXX</codeLocInd>
109
- <codeActivity>TFC-AD</codeActivity>
110
- <codeDistVerUpper>STD</codeDistVerUpper>
111
- <valDistVerUpper>65</valDistVerUpper>
112
- <uomDistVerUpper>FL</uomDistVerUpper>
113
- <codeDistVerLower>STD</codeDistVerLower>
114
- <valDistVerLower>45</valDistVerLower>
115
- <uomDistVerLower>FL</uomDistVerLower>
116
- <codeDistVerMax>ALT</codeDistVerMax>
117
- <valDistVerMax>6000</valDistVerMax>
118
- <uomDistVerMax>FT</uomDistVerMax>
119
- <codeDistVerMnm>HEI</codeDistVerMnm>
120
- <valDistVerMnm>3000</valDistVerMnm>
121
- <uomDistVerMnm>FT</uomDistVerMnm>
122
- <Att>
123
- <codeWorkHr>H24</codeWorkHr>
124
- </Att>
125
- <codeSelAvbl>Y</codeSelAvbl>
126
- <txtRmk>airspace layer</txtRmk>
127
- END
128
- end
129
-
130
- it "builds correct AIXM" do
131
- _(subject.to_xml).wont_match(/<codeSelAvbl>/)
132
- end
133
- end
134
-
135
- end
@@ -1,94 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Lighting do
4
- subject do
5
- AIXM::Factory.airport.runways.first.forth.lightings.first
6
- end
7
-
8
- describe :position= do
9
- it "fails on invalid values" do
10
- _([:foobar, 123, nil]).wont_be_written_to subject, :position
11
- end
12
-
13
- it "looks up valid values" do
14
- _(subject.tap { |s| s.position = :edge }.position).must_equal :edge
15
- _(subject.tap { |s| s.position = :SWYEND }.position).must_equal :stopway_end
16
- end
17
- end
18
-
19
- describe :description= do
20
- it "accepts nil value" do
21
- _([nil]).must_be_written_to subject, :description
22
- end
23
-
24
- it "stringifies valid values" do
25
- _(subject.tap { |s| s.description = 'foobar' }.description).must_equal 'foobar'
26
- _(subject.tap { |s| s.description = 123 }.description).must_equal '123'
27
- end
28
- end
29
-
30
- describe :intensity= do
31
- it "fails on invalid values" do
32
- _([:foobar, 123]).wont_be_written_to subject, :intensity
33
- end
34
-
35
- it "accepts nil value" do
36
- _([nil]).must_be_written_to subject, :intensity
37
- end
38
-
39
- it "looks up valid values" do
40
- _(subject.tap { |s| s.intensity = :low }.intensity).must_equal :low
41
- _(subject.tap { |s| s.intensity = 'LIM' }.intensity).must_equal :medium
42
- end
43
- end
44
-
45
- describe :color= do
46
- it "fails on invalid values" do
47
- _([:foobar, 123]).wont_be_written_to subject, :color
48
- end
49
-
50
- it "accepts nil value" do
51
- _([nil]).must_be_written_to subject, :color
52
- end
53
-
54
- it "looks up valid values" do
55
- _(subject.tap { |s| s.color = :blue }.color).must_equal :blue
56
- _(subject.tap { |s| s.color = 'GRN' }.color).must_equal :green
57
- end
58
- end
59
-
60
- describe :remarks= do
61
- macro :remarks
62
- end
63
-
64
- describe :to_xml do
65
- it "builds correct complete AIXM/OFMX" do
66
- _(subject.to_xml(as: :Rls)).must_equal <<~END
67
- <Rls>
68
- <RlsUid>
69
- <RdnUid>
70
- <RwyUid>
71
- <AhpUid>
72
- <codeId>LFNT</codeId>
73
- </AhpUid>
74
- <txtDesig>16L/34R</txtDesig>
75
- </RwyUid>
76
- <txtDesig>16L</txtDesig>
77
- </RdnUid>
78
- <codePsn>AIM</codePsn>
79
- </RlsUid>
80
- <txtDescr>omnidirectional</txtDescr>
81
- <codeIntst>LIM</codeIntst>
82
- <codeColour>GRN</codeColour>
83
- <txtRmk>lighting remarks</txtRmk>
84
- </Rls>
85
- END
86
- end
87
-
88
- it "builds OFMX with mid" do
89
- AIXM.ofmx!
90
- AIXM.config.mid_region = 'LF'
91
- _(subject.to_xml(as: :Rls)).must_match /<RlsUid mid="e96565dc-d6b4-35ca-6e42-7c465cfbec52">/
92
- end
93
- end
94
- end
@@ -1,479 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Runway do
4
- subject do
5
- AIXM::Factory.airport.runways.first
6
- end
7
-
8
- describe :initialize do
9
- it "sets defaults for bidirectional runways" do
10
- _(subject.forth.name).must_equal AIXM.a('16L')
11
- _(subject.back.name).must_equal AIXM.a('34R')
12
- end
13
-
14
- it "sets defaults for unidirectional runways" do
15
- subject = AIXM::Component::Runway.new(name: '30')
16
- _(subject.forth.name).must_equal AIXM.a('30')
17
- _(subject.back).must_be_nil
18
- end
19
-
20
- it "fails on non-inverse bidirectional runways" do
21
- _{ AIXM.runway(name: '16L/14R') }.must_raise ArgumentError
22
- end
23
- end
24
-
25
- describe :name= do
26
- it "fails on invalid values" do
27
- _([nil, :foobar, 123]).wont_be_written_to subject, :name
28
- end
29
-
30
- it "upcases and transcodes valid values" do
31
- _(subject.tap { |s| s.name = '10r/28l' }.name).must_equal '10R/28L'
32
- end
33
- end
34
-
35
- describe :length= do
36
- it "fails on invalid values" do
37
- _([:foobar, 0, 1, AIXM.d(0, :m)]).wont_be_written_to subject, :length
38
- end
39
-
40
- it "accepts nil value" do
41
- _([nil]).must_be_written_to subject, :length
42
- end
43
- end
44
-
45
- describe :width= do
46
- it "fails on invalid values" do
47
- _([:foobar, 0, 1, AIXM.d(0, :m)]).wont_be_written_to subject, :width
48
- end
49
-
50
- it "accepts nil value" do
51
- _([nil]).must_be_written_to subject, :width
52
- end
53
- end
54
-
55
- describe :status= do
56
- it "fails on invalid values" do
57
- _([:foobar, 123]).wont_be_written_to subject, :status
58
- end
59
-
60
- it "accepts nil value" do
61
- _([nil]).must_be_written_to subject, :status
62
- end
63
-
64
- it "looks up valid values" do
65
- _(subject.tap { |s| s.status = :closed }.status).must_equal :closed
66
- _(subject.tap { |s| s.status = :SPOWER }.status).must_equal :secondary_power
67
- end
68
- end
69
-
70
- describe :remarks= do
71
- macro :remarks
72
- end
73
-
74
- describe :xml= do
75
- it "builds correct complete OFMX" do
76
- AIXM.ofmx!
77
- _(subject.to_xml).must_equal <<~END
78
- <Rwy>
79
- <RwyUid>
80
- <AhpUid>
81
- <codeId>LFNT</codeId>
82
- </AhpUid>
83
- <txtDesig>16L/34R</txtDesig>
84
- </RwyUid>
85
- <valLen>650</valLen>
86
- <valWid>80</valWid>
87
- <uomDimRwy>M</uomDimRwy>
88
- <codeComposition>ASPH</codeComposition>
89
- <codePreparation>PAVED</codePreparation>
90
- <codeCondSfc>GOOD</codeCondSfc>
91
- <valPcnClass>59</valPcnClass>
92
- <codePcnPavementType>F</codePcnPavementType>
93
- <codePcnPavementSubgrade>A</codePcnPavementSubgrade>
94
- <codePcnMaxTirePressure>W</codePcnMaxTirePressure>
95
- <codePcnEvalMethod>T</codePcnEvalMethod>
96
- <txtPcnNote>Paved shoulder on 2.5m on each side of the RWY.</txtPcnNote>
97
- <valSiwlWeight>1500</valSiwlWeight>
98
- <uomSiwlWeight>KG</uomSiwlWeight>
99
- <valSiwlTirePressure>0.5</valSiwlTirePressure>
100
- <uomSiwlTirePressure>MPA</uomSiwlTirePressure>
101
- <valAuwWeight>30</valAuwWeight>
102
- <uomAuwWeight>T</uomAuwWeight>
103
- <codeSts>CLSD</codeSts>
104
- <txtRmk>Markings eroded</txtRmk>
105
- </Rwy>
106
- <Rdn>
107
- <RdnUid>
108
- <RwyUid>
109
- <AhpUid>
110
- <codeId>LFNT</codeId>
111
- </AhpUid>
112
- <txtDesig>16L/34R</txtDesig>
113
- </RwyUid>
114
- <txtDesig>16L</txtDesig>
115
- </RdnUid>
116
- <geoLat>44.00211944N</geoLat>
117
- <geoLong>004.75216944E</geoLong>
118
- <valTrueBrg>165</valTrueBrg>
119
- <valMagBrg>164</valMagBrg>
120
- <valElevTdz>145</valElevTdz>
121
- <uomElevTdz>FT</uomElevTdz>
122
- <codeVfrPattern>E</codeVfrPattern>
123
- <txtRmk>forth remarks</txtRmk>
124
- </Rdn>
125
- <Rdd>
126
- <RddUid>
127
- <RdnUid>
128
- <RwyUid>
129
- <AhpUid>
130
- <codeId>LFNT</codeId>
131
- </AhpUid>
132
- <txtDesig>16L/34R</txtDesig>
133
- </RwyUid>
134
- <txtDesig>16L</txtDesig>
135
- </RdnUid>
136
- <codeType>DPLM</codeType>
137
- <codeDayPeriod>A</codeDayPeriod>
138
- </RddUid>
139
- <valDist>131</valDist>
140
- <uomDist>M</uomDist>
141
- <txtRmk>forth remarks</txtRmk>
142
- </Rdd>
143
- <Rls>
144
- <RlsUid>
145
- <RdnUid>
146
- <RwyUid>
147
- <AhpUid>
148
- <codeId>LFNT</codeId>
149
- </AhpUid>
150
- <txtDesig>16L/34R</txtDesig>
151
- </RwyUid>
152
- <txtDesig>16L</txtDesig>
153
- </RdnUid>
154
- <codePsn>AIM</codePsn>
155
- </RlsUid>
156
- <txtDescr>omnidirectional</txtDescr>
157
- <codeIntst>LIM</codeIntst>
158
- <codeColour>GRN</codeColour>
159
- <txtRmk>lighting remarks</txtRmk>
160
- </Rls>
161
- <Rdn>
162
- <RdnUid>
163
- <RwyUid>
164
- <AhpUid>
165
- <codeId>LFNT</codeId>
166
- </AhpUid>
167
- <txtDesig>16L/34R</txtDesig>
168
- </RwyUid>
169
- <txtDesig>34R</txtDesig>
170
- </RdnUid>
171
- <geoLat>43.99036389N</geoLat>
172
- <geoLong>004.75645556E</geoLong>
173
- <valTrueBrg>345</valTrueBrg>
174
- <valMagBrg>344</valMagBrg>
175
- <valElevTdz>147</valElevTdz>
176
- <uomElevTdz>FT</uomElevTdz>
177
- <codeVfrPattern>L</codeVfrPattern>
178
- <txtRmk>back remarks</txtRmk>
179
- </Rdn>
180
- <Rdd>
181
- <RddUid>
182
- <RdnUid>
183
- <RwyUid>
184
- <AhpUid>
185
- <codeId>LFNT</codeId>
186
- </AhpUid>
187
- <txtDesig>16L/34R</txtDesig>
188
- </RwyUid>
189
- <txtDesig>34R</txtDesig>
190
- </RdnUid>
191
- <codeType>DPLM</codeType>
192
- <codeDayPeriod>A</codeDayPeriod>
193
- </RddUid>
194
- <valDist>209</valDist>
195
- <uomDist>M</uomDist>
196
- <txtRmk>back remarks</txtRmk>
197
- </Rdd>
198
- <Rls>
199
- <RlsUid>
200
- <RdnUid>
201
- <RwyUid>
202
- <AhpUid>
203
- <codeId>LFNT</codeId>
204
- </AhpUid>
205
- <txtDesig>16L/34R</txtDesig>
206
- </RwyUid>
207
- <txtDesig>34R</txtDesig>
208
- </RdnUid>
209
- <codePsn>AIM</codePsn>
210
- </RlsUid>
211
- <txtDescr>omnidirectional</txtDescr>
212
- <codeIntst>LIM</codeIntst>
213
- <codeColour>GRN</codeColour>
214
- <txtRmk>lighting remarks</txtRmk>
215
- </Rls>
216
- END
217
- end
218
-
219
- it "builds correct minimal OFMX" do
220
- AIXM.ofmx!
221
- %i(length width status remarks).each { |a| subject.send(:"#{a}=", nil) }
222
- %i(composition preparation condition pcn siwl_weight siwl_tire_pressure auw_weight remarks).each { |a| subject.surface.send(:"#{a}=", nil) }
223
- %i(forth back).each { |d| subject.send(d).instance_eval { @lightings.clear } }
224
- _(subject.to_xml).must_equal <<~END
225
- <Rwy>
226
- <RwyUid>
227
- <AhpUid>
228
- <codeId>LFNT</codeId>
229
- </AhpUid>
230
- <txtDesig>16L/34R</txtDesig>
231
- </RwyUid>
232
- </Rwy>
233
- <Rdn>
234
- <RdnUid>
235
- <RwyUid>
236
- <AhpUid>
237
- <codeId>LFNT</codeId>
238
- </AhpUid>
239
- <txtDesig>16L/34R</txtDesig>
240
- </RwyUid>
241
- <txtDesig>16L</txtDesig>
242
- </RdnUid>
243
- <geoLat>44.00211944N</geoLat>
244
- <geoLong>004.75216944E</geoLong>
245
- <valTrueBrg>165</valTrueBrg>
246
- <valMagBrg>164</valMagBrg>
247
- <valElevTdz>145</valElevTdz>
248
- <uomElevTdz>FT</uomElevTdz>
249
- <codeVfrPattern>E</codeVfrPattern>
250
- <txtRmk>forth remarks</txtRmk>
251
- </Rdn>
252
- <Rdd>
253
- <RddUid>
254
- <RdnUid>
255
- <RwyUid>
256
- <AhpUid>
257
- <codeId>LFNT</codeId>
258
- </AhpUid>
259
- <txtDesig>16L/34R</txtDesig>
260
- </RwyUid>
261
- <txtDesig>16L</txtDesig>
262
- </RdnUid>
263
- <codeType>DPLM</codeType>
264
- <codeDayPeriod>A</codeDayPeriod>
265
- </RddUid>
266
- <valDist>131</valDist>
267
- <uomDist>M</uomDist>
268
- <txtRmk>forth remarks</txtRmk>
269
- </Rdd>
270
- <Rdn>
271
- <RdnUid>
272
- <RwyUid>
273
- <AhpUid>
274
- <codeId>LFNT</codeId>
275
- </AhpUid>
276
- <txtDesig>16L/34R</txtDesig>
277
- </RwyUid>
278
- <txtDesig>34R</txtDesig>
279
- </RdnUid>
280
- <geoLat>43.99036389N</geoLat>
281
- <geoLong>004.75645556E</geoLong>
282
- <valTrueBrg>345</valTrueBrg>
283
- <valMagBrg>344</valMagBrg>
284
- <valElevTdz>147</valElevTdz>
285
- <uomElevTdz>FT</uomElevTdz>
286
- <codeVfrPattern>L</codeVfrPattern>
287
- <txtRmk>back remarks</txtRmk>
288
- </Rdn>
289
- <Rdd>
290
- <RddUid>
291
- <RdnUid>
292
- <RwyUid>
293
- <AhpUid>
294
- <codeId>LFNT</codeId>
295
- </AhpUid>
296
- <txtDesig>16L/34R</txtDesig>
297
- </RwyUid>
298
- <txtDesig>34R</txtDesig>
299
- </RdnUid>
300
- <codeType>DPLM</codeType>
301
- <codeDayPeriod>A</codeDayPeriod>
302
- </RddUid>
303
- <valDist>209</valDist>
304
- <uomDist>M</uomDist>
305
- <txtRmk>back remarks</txtRmk>
306
- </Rdd>
307
- END
308
- end
309
-
310
- it "builds OFMX with mid" do
311
- AIXM.ofmx!
312
- AIXM.config.mid_region = 'LF'
313
- _(subject.to_xml).must_match /<RwyUid mid="4d06b33a-91c8-ffec-ac25-b2b7efa103b2">/
314
- _(subject.to_xml).must_match /<RdnUid mid="7e469f8c-b03a-9d1d-0e5a-2a2cec7c652d">/
315
- end
316
- end
317
- end
318
-
319
- describe AIXM::Component::Runway::Direction do
320
- subject do
321
- AIXM::Factory.airport.runways.first.forth
322
- end
323
-
324
- describe :name= do
325
- it "fails on invalid values" do
326
- _([nil, :foobar, '16R']).wont_be_written_to subject, :name
327
- end
328
-
329
- it "overwrites preset name" do
330
- _(subject.name.to_s).must_equal '16L'
331
- subject.name = AIXM.a('34L')
332
- _(subject.name.to_s).must_equal '34L'
333
- end
334
- end
335
-
336
- describe :geographic_orientation= do
337
- it "fails on invalid values" do
338
- _([:foobar, -1, 10]).wont_be_written_to subject, :geographic_orientation
339
- end
340
- end
341
-
342
- describe :xy= do
343
- macro :xy
344
-
345
- it "fails on nil value" do
346
- _([nil]).wont_be_written_to subject, :xy
347
- end
348
- end
349
-
350
- describe :z= do
351
- macro :z_qnh
352
-
353
- it "accepts nil value" do
354
- _([nil]).must_be_written_to subject, :z
355
- end
356
- end
357
-
358
- describe :displaced_threshold= do
359
- it "fails on invalid values" do
360
- _([:foobar, 1, AIXM.d(0, :m)]).wont_be_written_to subject, :displaced_threshold
361
- end
362
-
363
- it "converts coordinates to distance" do
364
- subject.xy = AIXM.xy(lat: %q(43°59'54.71"N), long: %q(004°45'28.35"E))
365
- subject.displaced_threshold = AIXM.xy(lat: %q(43°59'48.47"N), long: %q(004°45'30.62"E))
366
- _(subject.displaced_threshold).must_equal AIXM.d(199, :m)
367
- end
368
- end
369
-
370
- describe :vfr_pattern= do
371
- it "fails on invalid values" do
372
- _([:foobar, 123]).wont_be_written_to subject, :vfr_pattern
373
- end
374
-
375
- it "accepts nil value" do
376
- _([nil]).must_be_written_to subject, :vfr_pattern
377
- end
378
-
379
- it "looks up valid values" do
380
- _(subject.tap { |s| s.vfr_pattern = :left }.vfr_pattern).must_equal :left
381
- _(subject.tap { |s| s.vfr_pattern = :E }.vfr_pattern).must_equal :left_or_right
382
- end
383
- end
384
-
385
- describe :remarks= do
386
- macro :remarks
387
- end
388
-
389
- describe :magnetic_orientation do
390
- it "is calculated correctly" do
391
- subject.geographic_orientation = AIXM.a(16)
392
- _(subject.magnetic_orientation).must_equal AIXM.a(15)
393
- end
394
- end
395
-
396
- describe :xml= do
397
- it "builds correct complete OFMX" do
398
- AIXM.ofmx!
399
- _(subject.to_xml).must_equal <<~END
400
- <Rdn>
401
- <RdnUid>
402
- <RwyUid>
403
- <AhpUid>
404
- <codeId>LFNT</codeId>
405
- </AhpUid>
406
- <txtDesig>16L/34R</txtDesig>
407
- </RwyUid>
408
- <txtDesig>16L</txtDesig>
409
- </RdnUid>
410
- <geoLat>44.00211944N</geoLat>
411
- <geoLong>004.75216944E</geoLong>
412
- <valTrueBrg>165</valTrueBrg>
413
- <valMagBrg>164</valMagBrg>
414
- <valElevTdz>145</valElevTdz>
415
- <uomElevTdz>FT</uomElevTdz>
416
- <codeVfrPattern>E</codeVfrPattern>
417
- <txtRmk>forth remarks</txtRmk>
418
- </Rdn>
419
- <Rdd>
420
- <RddUid>
421
- <RdnUid>
422
- <RwyUid>
423
- <AhpUid>
424
- <codeId>LFNT</codeId>
425
- </AhpUid>
426
- <txtDesig>16L/34R</txtDesig>
427
- </RwyUid>
428
- <txtDesig>16L</txtDesig>
429
- </RdnUid>
430
- <codeType>DPLM</codeType>
431
- <codeDayPeriod>A</codeDayPeriod>
432
- </RddUid>
433
- <valDist>131</valDist>
434
- <uomDist>M</uomDist>
435
- <txtRmk>forth remarks</txtRmk>
436
- </Rdd>
437
- <Rls>
438
- <RlsUid>
439
- <RdnUid>
440
- <RwyUid>
441
- <AhpUid>
442
- <codeId>LFNT</codeId>
443
- </AhpUid>
444
- <txtDesig>16L/34R</txtDesig>
445
- </RwyUid>
446
- <txtDesig>16L</txtDesig>
447
- </RdnUid>
448
- <codePsn>AIM</codePsn>
449
- </RlsUid>
450
- <txtDescr>omnidirectional</txtDescr>
451
- <codeIntst>LIM</codeIntst>
452
- <codeColour>GRN</codeColour>
453
- <txtRmk>lighting remarks</txtRmk>
454
- </Rls>
455
- END
456
- end
457
-
458
- it "builds correct minimal OFMX" do
459
- AIXM.ofmx!
460
- %i(geographic_orientation z displaced_threshold vfr_pattern remarks).each { |a| subject.send(:"#{a}=", nil) }
461
- subject.instance_eval { @lightings.clear }
462
- _(subject.to_xml).must_equal <<~END
463
- <Rdn>
464
- <RdnUid>
465
- <RwyUid>
466
- <AhpUid>
467
- <codeId>LFNT</codeId>
468
- </AhpUid>
469
- <txtDesig>16L/34R</txtDesig>
470
- </RwyUid>
471
- <txtDesig>16L</txtDesig>
472
- </RdnUid>
473
- <geoLat>44.00211944N</geoLat>
474
- <geoLong>004.75216944E</geoLong>
475
- </Rdn>
476
- END
477
- end
478
- end
479
- end