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,137 +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
- AIXM.aixm!
93
- subject.to_xml.wont_match(/<codeSelAvbl>/)
94
- subject.to_xml.wont_match(/<Att>/)
95
- subject.to_xml.wont_match(/<txtRmk>/)
96
- end
97
- end
98
- end
99
-
100
- context "required and optional attributes set" do
101
- subject do
102
- AIXM::Factory.layer
103
- end
104
-
105
- it "builds correct OFMX" do
106
- AIXM.ofmx!
107
- subject.to_xml.must_equal <<~END
108
- <codeClass>C</codeClass>
109
- <codeLocInd>XXXX</codeLocInd>
110
- <codeActivity>TFC-AD</codeActivity>
111
- <codeDistVerUpper>STD</codeDistVerUpper>
112
- <valDistVerUpper>65</valDistVerUpper>
113
- <uomDistVerUpper>FL</uomDistVerUpper>
114
- <codeDistVerLower>STD</codeDistVerLower>
115
- <valDistVerLower>45</valDistVerLower>
116
- <uomDistVerLower>FL</uomDistVerLower>
117
- <codeDistVerMax>ALT</codeDistVerMax>
118
- <valDistVerMax>6000</valDistVerMax>
119
- <uomDistVerMax>FT</uomDistVerMax>
120
- <codeDistVerMnm>HEI</codeDistVerMnm>
121
- <valDistVerMnm>3000</valDistVerMnm>
122
- <uomDistVerMnm>FT</uomDistVerMnm>
123
- <Att>
124
- <codeWorkHr>H24</codeWorkHr>
125
- </Att>
126
- <codeSelAvbl>Y</codeSelAvbl>
127
- <txtRmk>airspace layer</txtRmk>
128
- END
129
- end
130
-
131
- it "builds correct AIXM" do
132
- AIXM.aixm!
133
- subject.to_xml.wont_match(/<codeSelAvbl>/)
134
- end
135
- end
136
-
137
- end
@@ -1,88 +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
- end
88
- end
@@ -1,472 +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>166</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>346</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>166</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>346</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
- end
310
- end
311
-
312
- describe AIXM::Component::Runway::Direction do
313
- subject do
314
- AIXM::Factory.airport.runways.first.forth
315
- end
316
-
317
- describe :name= do
318
- it "fails on invalid values" do
319
- [nil, :foobar, '16R'].wont_be_written_to subject, :name
320
- end
321
-
322
- it "overwrites preset name" do
323
- subject.name.to_s.must_equal '16L'
324
- subject.name = AIXM.a('34L')
325
- subject.name.to_s.must_equal '34L'
326
- end
327
- end
328
-
329
- describe :geographic_orientation= do
330
- it "fails on invalid values" do
331
- [:foobar, -1, 10].wont_be_written_to subject, :geographic_orientation
332
- end
333
- end
334
-
335
- describe :xy= do
336
- macro :xy
337
-
338
- it "fails on nil value" do
339
- [nil].wont_be_written_to subject, :xy
340
- end
341
- end
342
-
343
- describe :z= do
344
- macro :z_qnh
345
-
346
- it "accepts nil value" do
347
- [nil].must_be_written_to subject, :z
348
- end
349
- end
350
-
351
- describe :displaced_threshold= do
352
- it "fails on invalid values" do
353
- [:foobar, 1, AIXM.d(0, :m)].wont_be_written_to subject, :displaced_threshold
354
- end
355
-
356
- it "converts coordinates to distance" do
357
- subject.xy = AIXM.xy(lat: %q(43°59'54.71"N), long: %q(004°45'28.35"E))
358
- subject.displaced_threshold = AIXM.xy(lat: %q(43°59'48.47"N), long: %q(004°45'30.62"E))
359
- subject.displaced_threshold.must_equal AIXM.d(199, :m)
360
- end
361
- end
362
-
363
- describe :vfr_pattern= do
364
- it "fails on invalid values" do
365
- [:foobar, 123].wont_be_written_to subject, :vfr_pattern
366
- end
367
-
368
- it "accepts nil value" do
369
- [nil].must_be_written_to subject, :vfr_pattern
370
- end
371
-
372
- it "looks up valid values" do
373
- subject.tap { |s| s.vfr_pattern = :left }.vfr_pattern.must_equal :left
374
- subject.tap { |s| s.vfr_pattern = :E }.vfr_pattern.must_equal :left_or_right
375
- end
376
- end
377
-
378
- describe :remarks= do
379
- macro :remarks
380
- end
381
-
382
- describe :magnetic_orientation do
383
- it "is calculated correctly" do
384
- subject.geographic_orientation = AIXM.a(16)
385
- subject.magnetic_orientation.must_equal AIXM.a(17)
386
- end
387
- end
388
-
389
- describe :xml= do
390
- it "builds correct complete OFMX" do
391
- AIXM.ofmx!
392
- subject.to_xml.must_equal <<~END
393
- <Rdn>
394
- <RdnUid>
395
- <RwyUid>
396
- <AhpUid>
397
- <codeId>LFNT</codeId>
398
- </AhpUid>
399
- <txtDesig>16L/34R</txtDesig>
400
- </RwyUid>
401
- <txtDesig>16L</txtDesig>
402
- </RdnUid>
403
- <geoLat>44.00211944N</geoLat>
404
- <geoLong>004.75216944E</geoLong>
405
- <valTrueBrg>165</valTrueBrg>
406
- <valMagBrg>166</valMagBrg>
407
- <valElevTdz>145</valElevTdz>
408
- <uomElevTdz>FT</uomElevTdz>
409
- <codeVfrPattern>E</codeVfrPattern>
410
- <txtRmk>forth remarks</txtRmk>
411
- </Rdn>
412
- <Rdd>
413
- <RddUid>
414
- <RdnUid>
415
- <RwyUid>
416
- <AhpUid>
417
- <codeId>LFNT</codeId>
418
- </AhpUid>
419
- <txtDesig>16L/34R</txtDesig>
420
- </RwyUid>
421
- <txtDesig>16L</txtDesig>
422
- </RdnUid>
423
- <codeType>DPLM</codeType>
424
- <codeDayPeriod>A</codeDayPeriod>
425
- </RddUid>
426
- <valDist>131</valDist>
427
- <uomDist>M</uomDist>
428
- <txtRmk>forth remarks</txtRmk>
429
- </Rdd>
430
- <Rls>
431
- <RlsUid>
432
- <RdnUid>
433
- <RwyUid>
434
- <AhpUid>
435
- <codeId>LFNT</codeId>
436
- </AhpUid>
437
- <txtDesig>16L/34R</txtDesig>
438
- </RwyUid>
439
- <txtDesig>16L</txtDesig>
440
- </RdnUid>
441
- <codePsn>AIM</codePsn>
442
- </RlsUid>
443
- <txtDescr>omnidirectional</txtDescr>
444
- <codeIntst>LIM</codeIntst>
445
- <codeColour>GRN</codeColour>
446
- <txtRmk>lighting remarks</txtRmk>
447
- </Rls>
448
- END
449
- end
450
-
451
- it "builds correct minimal OFMX" do
452
- AIXM.ofmx!
453
- %i(geographic_orientation z displaced_threshold vfr_pattern remarks).each { |a| subject.send(:"#{a}=", nil) }
454
- subject.instance_eval { @lightings.clear }
455
- subject.to_xml.must_equal <<~END
456
- <Rdn>
457
- <RdnUid>
458
- <RwyUid>
459
- <AhpUid>
460
- <codeId>LFNT</codeId>
461
- </AhpUid>
462
- <txtDesig>16L/34R</txtDesig>
463
- </RwyUid>
464
- <txtDesig>16L</txtDesig>
465
- </RdnUid>
466
- <geoLat>44.00211944N</geoLat>
467
- <geoLong>004.75216944E</geoLong>
468
- </Rdn>
469
- END
470
- end
471
- end
472
- end