aixm 0.3.8 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,124 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Surface do
4
- subject do
5
- AIXM::Factory.airport.runways.first.surface
6
- end
7
-
8
- describe :composition= do
9
- it "fails on invalid values" do
10
- _([:foobar, 123]).wont_be_written_to subject, :composition
11
- end
12
-
13
- it "accepts nil value" do
14
- _([nil]).must_be_written_to subject, :composition
15
- end
16
-
17
- it "looks up valid values" do
18
- _(subject.tap { |s| s.composition = :macadam }.composition).must_equal :macadam
19
- _(subject.tap { |s| s.composition = :GRADE }.composition).must_equal :graded_earth
20
- end
21
- end
22
-
23
- describe :preparation= do
24
- it "fails on invalid values" do
25
- _([:foobar, 123]).wont_be_written_to subject, :preparation
26
- end
27
-
28
- it "accepts nil value" do
29
- _([nil]).must_be_written_to subject, :preparation
30
- end
31
-
32
- it "looks up valid values" do
33
- _(subject.tap { |s| s.preparation = :rolled }.preparation).must_equal :rolled
34
- _(subject.tap { |s| s.preparation = 'PFC' }.preparation).must_equal :porous_friction_course
35
- end
36
- end
37
-
38
- describe :condition= do
39
- it "fails on invalid values" do
40
- _([:foobar, 123]).wont_be_written_to subject, :condition
41
- end
42
-
43
- it "accepts nil value" do
44
- _([nil]).must_be_written_to subject, :condition
45
- end
46
-
47
- it "looks up valid values" do
48
- _(subject.tap { |s| s.condition = :fair }.condition).must_equal :fair
49
- _(subject.tap { |s| s.condition = :GOOD }.condition).must_equal :good
50
- end
51
- end
52
-
53
- describe :pcn do
54
- end
55
-
56
- describe :pcn= do
57
- it "fails on invalid values" do
58
- _([25, 'X/F/B/W/U', '10/A/B', '10/A/B/C/D']).wont_be_written_to subject, :pcn
59
- end
60
-
61
- it "accepts valid values" do
62
- _(subject.tap { |s| s.pcn = nil }.pcn).must_be :nil?
63
- _(subject.tap { |s| s.pcn = '25/F/B/W/U' }.pcn).must_equal '25/F/B/W/U'
64
- _(subject.tap { |s| s.pcn = '10 R C X T' }.pcn).must_equal '10/R/C/X/T'
65
- _(subject.tap { |s| s.pcn = "5\nF-b-y U" }.pcn).must_equal '5/F/B/Y/U'
66
- end
67
- end
68
-
69
- describe :siwl_weight= do
70
- it "fails on invalid values" do
71
- _([:foobar, 123]).wont_be_written_to subject, :siwl_weight
72
- end
73
-
74
- it "accepts valid values" do
75
- _([nil, AIXM::Factory.w]).must_be_written_to subject, :siwl_weight
76
- end
77
- end
78
-
79
- describe :siwl_tire_pressure= do
80
- it "fails on invalid values" do
81
- _([:foobar, 123]).wont_be_written_to subject, :siwl_tire_pressure
82
- end
83
-
84
- it "accepts valid values" do
85
- _([nil, AIXM::Factory.p]).must_be_written_to subject, :siwl_tire_pressure
86
- end
87
- end
88
-
89
- describe :auw_weight= do
90
- it "fails on invalid values" do
91
- _([:foobar, 123]).wont_be_written_to subject, :auw_weight
92
- end
93
-
94
- it "accepts valid values" do
95
- _([nil, AIXM::Factory.w]).must_be_written_to subject, :auw_weight
96
- end
97
- end
98
-
99
- describe :remarks= do
100
- macro :remarks
101
- end
102
-
103
- describe :to_xml do
104
- it "builds correct complete AIXM/OFMX" do
105
- _(subject.to_xml).must_equal <<~END
106
- <codeComposition>ASPH</codeComposition>
107
- <codePreparation>PAVED</codePreparation>
108
- <codeCondSfc>GOOD</codeCondSfc>
109
- <valPcnClass>59</valPcnClass>
110
- <codePcnPavementType>F</codePcnPavementType>
111
- <codePcnPavementSubgrade>A</codePcnPavementSubgrade>
112
- <codePcnMaxTirePressure>W</codePcnMaxTirePressure>
113
- <codePcnEvalMethod>T</codePcnEvalMethod>
114
- <txtPcnNote>Paved shoulder on 2.5m on each side of the RWY.</txtPcnNote>
115
- <valSiwlWeight>1500</valSiwlWeight>
116
- <uomSiwlWeight>KG</uomSiwlWeight>
117
- <valSiwlTirePressure>0.5</valSiwlTirePressure>
118
- <uomSiwlTirePressure>MPA</uomSiwlTirePressure>
119
- <valAuwWeight>30</valAuwWeight>
120
- <uomAuwWeight>T</uomAuwWeight>
121
- END
122
- end
123
- end
124
- end
@@ -1,47 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::Timetable do
4
- subject do
5
- AIXM::Factory.timetable
6
- end
7
-
8
- describe :code= do
9
- it "fails on invalid values" do
10
- _([nil, :foobar, 123]).wont_be_written_to subject, :code
11
- end
12
-
13
- it "looks up valid values" do
14
- _(subject.tap { |s| s.code = :notam }.code).must_equal :notam
15
- _(subject.tap { |s| s.code = :H24 }.code).must_equal :continuous
16
- end
17
- end
18
-
19
- describe :remarks= do
20
- macro :remarks
21
- end
22
-
23
- describe :to_xml do
24
- it "builds correct complete AIXM" do
25
- _(subject.to_xml).must_equal <<~END
26
- <Timetable>
27
- <codeWorkHr>HJ</codeWorkHr>
28
- <txtRmkWorkHr>timetable remarks</txtRmkWorkHr>
29
- </Timetable>
30
- END
31
- end
32
-
33
- it "builds correct minimal AIXM" do
34
- subject.remarks = nil
35
- _(subject.to_xml).must_equal <<~END
36
- <Timetable>
37
- <codeWorkHr>HJ</codeWorkHr>
38
- </Timetable>
39
- END
40
- end
41
-
42
- it "builds with arbitrary tag" do
43
- _(subject.to_xml).must_match(/<Timetable>/)
44
- _(subject.to_xml(as: :FooBar)).must_match(/<FooBar>/)
45
- end
46
- end
47
- end
@@ -1,94 +0,0 @@
1
- require_relative '../../../spec_helper'
2
-
3
- describe AIXM::Component::VerticalLimits do
4
- subject do
5
- AIXM::Factory.vertical_limits
6
- end
7
-
8
- describe :upper_z= do
9
- it "fails on invalid values" do
10
- _([nil, :foobar, 123]).wont_be_written_to subject, :upper_z
11
- end
12
- end
13
-
14
- describe :max_z= do
15
- it "fails on invalid values" do
16
- _([:foobar, 123]).wont_be_written_to subject, :max_z
17
- end
18
-
19
- it "accepts nil value" do
20
- _([nil]).must_be_written_to subject, :max_z
21
- end
22
- end
23
-
24
- describe :lower_z= do
25
- it "fails on invalid values" do
26
- _([nil, :foobar, 123]).wont_be_written_to subject, :lower_z
27
- end
28
- end
29
-
30
- describe :min_z= do
31
- it "fails on invalid values" do
32
- _([:foobar, 123]).wont_be_written_to subject, :min_z
33
- end
34
-
35
- it "accepts nil value" do
36
- _([nil]).must_be_written_to subject, :max_z
37
- end
38
- end
39
-
40
- describe :to_aixm do
41
- it "builds correct AIXM with only upper_z and lower_z" do
42
- subject = AIXM.vertical_limits(
43
- upper_z: AIXM.z(2000, :qnh),
44
- lower_z: AIXM::GROUND
45
- )
46
- _(subject.to_xml).must_equal <<~END
47
- <codeDistVerUpper>ALT</codeDistVerUpper>
48
- <valDistVerUpper>2000</valDistVerUpper>
49
- <uomDistVerUpper>FT</uomDistVerUpper>
50
- <codeDistVerLower>HEI</codeDistVerLower>
51
- <valDistVerLower>0</valDistVerLower>
52
- <uomDistVerLower>FT</uomDistVerLower>
53
- END
54
- end
55
-
56
- it "builds correct AIXM with additional max_z" do
57
- subject = AIXM.vertical_limits(
58
- upper_z: AIXM.z(65, :qne),
59
- max_z: AIXM.z(6000, :qnh),
60
- lower_z: AIXM.z(1000, :qfe)
61
- )
62
- _(subject.to_xml).must_equal <<~END
63
- <codeDistVerUpper>STD</codeDistVerUpper>
64
- <valDistVerUpper>65</valDistVerUpper>
65
- <uomDistVerUpper>FL</uomDistVerUpper>
66
- <codeDistVerLower>HEI</codeDistVerLower>
67
- <valDistVerLower>1000</valDistVerLower>
68
- <uomDistVerLower>FT</uomDistVerLower>
69
- <codeDistVerMax>ALT</codeDistVerMax>
70
- <valDistVerMax>6000</valDistVerMax>
71
- <uomDistVerMax>FT</uomDistVerMax>
72
- END
73
- end
74
-
75
- it "builds correct AIXM with additional min_z" do
76
- subject = AIXM.vertical_limits(
77
- upper_z: AIXM.z(65, :qne),
78
- lower_z: AIXM.z(45, :qne),
79
- min_z: AIXM.z(3000, :qnh)
80
- )
81
- _(subject.to_xml).must_equal <<~END
82
- <codeDistVerUpper>STD</codeDistVerUpper>
83
- <valDistVerUpper>65</valDistVerUpper>
84
- <uomDistVerUpper>FL</uomDistVerUpper>
85
- <codeDistVerLower>STD</codeDistVerLower>
86
- <valDistVerLower>45</valDistVerLower>
87
- <uomDistVerLower>FL</uomDistVerLower>
88
- <codeDistVerMnm>ALT</codeDistVerMnm>
89
- <valDistVerMnm>3000</valDistVerMnm>
90
- <uomDistVerMnm>FT</uomDistVerMnm>
91
- END
92
- end
93
- end
94
- end
@@ -1,41 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- describe AIXM do
4
- describe :initialize_config do
5
- it "must use AIXM" do
6
- AIXM.send :initialize_config
7
- _(AIXM.schema).must_equal :aixm
8
- end
9
- end
10
-
11
- describe :config do
12
- it "must set and get arbitrary config options" do
13
- AIXM.config.foo = :bar
14
- _(AIXM.config.foo).must_equal :bar
15
- end
16
- end
17
-
18
- describe :schema do
19
- it "must return schema identifier" do
20
- AIXM.aixm!
21
- _(AIXM.schema).must_equal :aixm
22
- end
23
-
24
- it "must return schema details" do
25
- AIXM.aixm!
26
- _(AIXM.schema(:root)).must_equal 'AIXM-Snapshot'
27
- end
28
- end
29
-
30
- describe "<schema>! and <schema>?" do
31
- it "must set and query schemas" do
32
- AIXM.aixm!
33
- _(AIXM).must_be :aixm?
34
- _(AIXM).wont_be :ofmx?
35
- AIXM.ofmx!
36
- _(AIXM).wont_be :aixm?
37
- _(AIXM).must_be :ofmx?
38
- end
39
- end
40
-
41
- end
@@ -1,150 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- describe AIXM::D do
4
- subject do
5
- AIXM::Factory.d
6
- end
7
-
8
- describe :dist= do
9
- it "fails on invalid values" do
10
- _([:foobar, -1]).wont_be_written_to subject, :dist
11
- end
12
-
13
- it "converts Numeric to Float" do
14
- _(subject.tap { |s| s.dist = 5 }.dist).must_equal 5.0
15
- end
16
- end
17
-
18
- describe :unit= do
19
- it "fails on invalid values" do
20
- _([:foobar, 123]).wont_be_written_to subject, :unit
21
- end
22
-
23
- it "symbolizes and downcases values" do
24
- _(subject.tap { |s| s.unit = "NM" }.unit).must_equal :nm
25
- end
26
- end
27
-
28
- describe :to_ft do
29
- it "leaves feet untouched" do
30
- subject = AIXM.d(2, :ft)
31
- _(subject.to_ft).must_be_same_as subject
32
- end
33
-
34
- it "converts kilometers to feet" do
35
- _(AIXM.d(0.5, :km).to_ft).must_equal AIXM.d(1640.4199475, :ft)
36
- end
37
-
38
- it "converts meters to feet" do
39
- _(AIXM.d(200, :m).to_ft).must_equal AIXM.d(656.167979, :ft)
40
- end
41
-
42
- it "converts nautical miles to feet" do
43
- _(AIXM.d(0.5, :nm).to_ft).must_equal AIXM.d(3038.05774277, :ft)
44
- end
45
- end
46
-
47
- describe :to_km do
48
- it "leaves kilometers untouched" do
49
- subject = AIXM.d(2, :km)
50
- _(subject.to_km).must_be_same_as subject
51
- end
52
-
53
- it "converts feet to kilometers" do
54
- _(AIXM.d(10_000, :ft).to_km).must_equal AIXM.d(3.048, :km)
55
- end
56
-
57
- it "converts meters to kilometers" do
58
- _(AIXM.d(2000, :m).to_km).must_equal AIXM.d(2, :km)
59
- end
60
-
61
- it "converts nautical miles to kilometers" do
62
- _(AIXM.d(10, :nm).to_km).must_equal AIXM.d(18.52, :km)
63
- end
64
- end
65
-
66
- describe :to_m do
67
- it "leaves meters untouched" do
68
- subject = AIXM.d(2, :m)
69
- _(subject.to_m).must_be_same_as subject
70
- end
71
-
72
- it "converts feet to meters" do
73
- _(AIXM.d(500, :ft).to_m).must_equal AIXM.d(152.4, :m)
74
- end
75
-
76
- it "converts kilometers to meters" do
77
- _(AIXM.d(1.3, :km).to_m).must_equal AIXM.d(1300, :m)
78
- end
79
-
80
- it "converts nautical miles to meters" do
81
- _(AIXM.d(0.8, :nm).to_m).must_equal AIXM.d(1481.6, :m)
82
- end
83
- end
84
-
85
- describe :to_nm do
86
- it "leaves nautical miles untouched" do
87
- subject = AIXM.d(2, :nm)
88
- _(subject.to_nm).must_be_same_as subject
89
- end
90
-
91
- it "converts feet to nautical miles" do
92
- _(AIXM.d(11_000, :ft).to_nm).must_equal AIXM.d(1.81036717, :nm)
93
- end
94
-
95
- it "converts kilometers to nautical miles" do
96
- _(AIXM.d(17, :km).to_nm).must_equal AIXM.d(9.17926565, :nm)
97
- end
98
-
99
- it "converts meters to nautical miles" do
100
- _(AIXM.d(5800, :m).to_nm).must_equal AIXM.d(3.13174946, :nm)
101
- end
102
- end
103
-
104
- describe :<=> do
105
- it "recognizes objects with identical unit and distance as equal" do
106
- a = AIXM.d(123, :m)
107
- b = AIXM.d(123.0, 'M')
108
- _(a).must_equal b
109
- end
110
-
111
- it "recognizes objects with different units and converted distance as equal" do
112
- a = AIXM.d(123, :m)
113
- b = AIXM.d(403.54330709, 'FT')
114
- _(a).must_equal b
115
- end
116
-
117
- it "recognizes objects with different units and identical distance as unequal" do
118
- a = AIXM.d(123, :m)
119
- b = AIXM.d(123, :ft)
120
- _(a).wont_equal b
121
- end
122
-
123
- it "recognizes objects of different class as unequal" do
124
- a = AIXM.d(123, :m)
125
- b = :oggy
126
- _(a).wont_equal b
127
- end
128
- end
129
-
130
- describe :hash do
131
- it "returns an integer" do
132
- _(subject.hash).must_be_instance_of Integer
133
- end
134
-
135
- it "allows for the use of instances as hash keys" do
136
- dupe = subject.dup
137
- _({ subject => true }[dupe]).must_equal true
138
- end
139
- end
140
-
141
- describe :zero? do
142
- it "returns true for zero distance" do
143
- _(subject.tap { |s| s.dist = 0 }).must_be :zero?
144
- end
145
-
146
- it "returns false for non-zero distance" do
147
- _(subject.tap { |s| s.dist = 1 }).wont_be :zero?
148
- end
149
- end
150
- end