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,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,49 +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
- AIXM.aixm!
26
- subject.to_xml.must_equal <<~END
27
- <Timetable>
28
- <codeWorkHr>HJ</codeWorkHr>
29
- <txtRmkWorkHr>timetable remarks</txtRmkWorkHr>
30
- </Timetable>
31
- END
32
- end
33
-
34
- it "builds correct minimal AIXM" do
35
- AIXM.aixm!
36
- subject.remarks = nil
37
- subject.to_xml.must_equal <<~END
38
- <Timetable>
39
- <codeWorkHr>HJ</codeWorkHr>
40
- </Timetable>
41
- END
42
- end
43
-
44
- it "builds with arbitrary tag" do
45
- subject.to_xml.must_match(/<Timetable>/)
46
- subject.to_xml(as: :FooBar).must_match(/<FooBar>/)
47
- end
48
- end
49
- end
@@ -1,97 +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
- AIXM.aixm!
47
- subject.to_xml.must_equal <<~END
48
- <codeDistVerUpper>ALT</codeDistVerUpper>
49
- <valDistVerUpper>2000</valDistVerUpper>
50
- <uomDistVerUpper>FT</uomDistVerUpper>
51
- <codeDistVerLower>HEI</codeDistVerLower>
52
- <valDistVerLower>0</valDistVerLower>
53
- <uomDistVerLower>FT</uomDistVerLower>
54
- END
55
- end
56
-
57
- it "builds correct AIXM with additional max_z" do
58
- subject = AIXM.vertical_limits(
59
- upper_z: AIXM.z(65, :qne),
60
- max_z: AIXM.z(6000, :qnh),
61
- lower_z: AIXM.z(1000, :qfe)
62
- )
63
- AIXM.aixm!
64
- subject.to_xml.must_equal <<~END
65
- <codeDistVerUpper>STD</codeDistVerUpper>
66
- <valDistVerUpper>65</valDistVerUpper>
67
- <uomDistVerUpper>FL</uomDistVerUpper>
68
- <codeDistVerLower>HEI</codeDistVerLower>
69
- <valDistVerLower>1000</valDistVerLower>
70
- <uomDistVerLower>FT</uomDistVerLower>
71
- <codeDistVerMax>ALT</codeDistVerMax>
72
- <valDistVerMax>6000</valDistVerMax>
73
- <uomDistVerMax>FT</uomDistVerMax>
74
- END
75
- end
76
-
77
- it "builds correct AIXM with additional min_z" do
78
- subject = AIXM.vertical_limits(
79
- upper_z: AIXM.z(65, :qne),
80
- lower_z: AIXM.z(45, :qne),
81
- min_z: AIXM.z(3000, :qnh)
82
- )
83
- AIXM.aixm!
84
- subject.to_xml.must_equal <<~END
85
- <codeDistVerUpper>STD</codeDistVerUpper>
86
- <valDistVerUpper>65</valDistVerUpper>
87
- <uomDistVerUpper>FL</uomDistVerUpper>
88
- <codeDistVerLower>STD</codeDistVerLower>
89
- <valDistVerLower>45</valDistVerLower>
90
- <uomDistVerLower>FL</uomDistVerLower>
91
- <codeDistVerMnm>ALT</codeDistVerMnm>
92
- <valDistVerMnm>3000</valDistVerMnm>
93
- <uomDistVerMnm>FT</uomDistVerMnm>
94
- END
95
- end
96
- end
97
- 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