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,180 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- describe AIXM::XY do
4
- subject do
5
- AIXM::Factory.xy
6
- end
7
-
8
- describe :lat= do
9
- it "fails on invalid values" do
10
- _([91, "foobar"]).wont_be_written_to subject, :lat
11
- end
12
-
13
- it "parses valid DD values" do
14
- _(subject.tap { |s| s.lat = 11.2233 }.lat).must_equal 11.2233
15
- end
16
-
17
- it "parses valid DMS values" do
18
- _(subject.tap { |s| s.lat = %q(11°22'33"N) }.lat).must_equal(11.37583333)
19
- _(subject.tap { |s| s.lat = %q(11°22'33"S) }.lat).must_equal(-11.37583333)
20
- end
21
- end
22
-
23
- describe :lat do
24
- context "north" do
25
- subject do
26
- AIXM.xy(lat: 1.1234, long: 0)
27
- end
28
-
29
- it "must format DD (default) correctly" do
30
- _(subject.lat).must_equal 1.1234
31
- end
32
-
33
- it "must format AIXM correctly" do
34
- _(subject.lat(:aixm)).must_equal %q(010724.24N)
35
- end
36
-
37
- it "must format OFM correctly" do
38
- _(subject.lat(:ofmx)).must_equal '01.12340000N'
39
- end
40
- end
41
-
42
- context "south" do
43
- subject do
44
- AIXM.xy(lat: -1.1234, long: 0)
45
- end
46
-
47
- it "must format DD (default) correctly" do
48
- _(subject.lat).must_equal(-1.1234)
49
- end
50
-
51
- it "must format AIXM correctly" do
52
- _(subject.lat(:aixm)).must_equal %q(010724.24S)
53
- end
54
-
55
- it "must format OFM correctly" do
56
- _(subject.lat(:ofmx)).must_equal '01.12340000S'
57
- end
58
- end
59
- end
60
-
61
- describe :long= do
62
- it "fails on invalid values" do
63
- _([181, "foobar"]).wont_be_written_to subject, :lat
64
- end
65
-
66
- it "parses valid DD values" do
67
- _(subject.tap { |s| s.long = 22.3344 }.long).must_equal 22.3344
68
- end
69
-
70
- it "parses valid DMS values" do
71
- _(subject.tap { |s| s.long = %q(22°33'44"E) }.long).must_equal(22.56222222)
72
- _(subject.tap { |s| s.long = %q(22°33'44"W) }.long).must_equal(-22.56222222)
73
- end
74
- end
75
-
76
- describe :long do
77
- context "east" do
78
- subject do
79
- AIXM.xy(lat: 0, long: 1.1234)
80
- end
81
-
82
- it "must format DD (default) correctly" do
83
- _(subject.long).must_equal 1.1234
84
- end
85
-
86
- it "must format AIXM correctly" do
87
- _(subject.long(:aixm)).must_equal %q(0010724.24E)
88
- end
89
-
90
- it "must format OFM correctly" do
91
- _(subject.long(:ofmx)).must_equal '001.12340000E'
92
- end
93
- end
94
-
95
- context "west" do
96
- subject do
97
- AIXM.xy(lat: 0, long: -1.1234)
98
- end
99
-
100
- it "must format DD (default) correctly" do
101
- _(subject.long).must_equal(-1.1234)
102
- end
103
-
104
- it "must format AIXM correctly" do
105
- _(subject.long(:aixm)).must_equal %q(0010724.24W)
106
- end
107
-
108
- it "must format OFM correctly" do
109
- _(subject.long(:ofmx)).must_equal '001.12340000W'
110
- end
111
- end
112
- end
113
-
114
- describe :seconds? do
115
- it "must detect coordinates with zero DMS seconds" do
116
- _(AIXM.xy(lat: %q(44°33'00"N), long: %q(004°03'00"E))).wont_be :seconds?
117
- _(AIXM.xy(lat: %q(44°33'00.01"N), long: %q(004°03'00"E))).must_be :seconds?
118
- _(AIXM.xy(lat: %q(44°33'00"N), long: %q(004°03'00.01"E))).must_be :seconds?
119
- _(AIXM.xy(lat: %q(47°29'10"N), long: %q(000°33'15"W))).must_be :seconds?
120
- _(AIXM.xy(lat: %q(44°36'50"N), long: %q(004°23'50"E))).must_be :seconds?
121
- _(AIXM.xy(lat: %q(44°48'00"N), long: %q(000°34'27"W))).must_be :seconds?
122
- end
123
- end
124
-
125
- describe :to_point do
126
- subject do
127
- AIXM.xy(lat: %q(44°00'07.63"N), long: %q(004°45'07.81"E))
128
- end
129
-
130
- it "must return a point object with these coordinates" do
131
- _(subject.to_point.xy).must_equal AIXM.point(xy: subject).xy
132
- end
133
- end
134
-
135
- describe :distance do
136
- subject do
137
- AIXM.xy(lat: %q(44°00'07.63"N), long: %q(004°45'07.81"E))
138
- end
139
-
140
- it "calculates the distance between the same point as zero" do
141
- _(subject.distance(subject)).must_equal AIXM.d(0, :m)
142
- end
143
-
144
- it "calculates the distance between two points correctly" do
145
- other = AIXM.xy(lat: %q(43°59'25.31"N), long: %q(004°45'23.24"E))
146
- _(subject.distance(other)).must_equal AIXM.d(1351, :m)
147
- end
148
- end
149
-
150
- describe :== do
151
- it "recognizes objects with identical latitude and longitude as equal" do
152
- a = AIXM.xy(lat: "112233N", long: "0223344E")
153
- b = AIXM.xy(lat: 11.37583333, long: 22.56222222)
154
- _(a).must_equal b
155
- end
156
-
157
- it "recognizes objects with different latitude or longitude as unequal" do
158
- a = AIXM.xy(lat: "112233.44N", long: "0223344.55E")
159
- b = AIXM.xy(lat: 11, long: 22)
160
- _(a).wont_equal b
161
- end
162
-
163
- it "recognizes objects of different class as unequal" do
164
- a = AIXM.xy(lat: "112233.44N", long: "0223344.55E")
165
- b = :oggy
166
- _(a).wont_equal b
167
- end
168
- end
169
-
170
- describe :hash do
171
- it "returns an integer" do
172
- _(subject.hash).must_be_instance_of Integer
173
- end
174
-
175
- it "allows for the use of instances as hash keys" do
176
- dupe = subject.dup
177
- _({ subject => true }[dupe]).must_equal true
178
- end
179
- end
180
- end
@@ -1,94 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- describe AIXM::Z do
4
- subject do
5
- AIXM::Factory.z
6
- end
7
-
8
- describe :alt= do
9
- it "fails on invalid values" do
10
- _([:foobar]).wont_be_written_to subject, :alt
11
- end
12
-
13
- it "converts Numeric to Integer" do
14
- _(subject.tap { |s| s.alt = 5.5 }.alt).must_equal 5
15
- end
16
- end
17
-
18
- describe :code= do
19
- it "fails on invalid values" do
20
- _([nil, :foobar]).wont_be_written_to subject, :code
21
- end
22
-
23
- it "symbolizes and downcases values" do
24
- _(subject.tap { |s| s.code = "QFE" }.code).must_equal :qfe
25
- end
26
- end
27
-
28
- describe :qfe? do
29
- it "recognizes same Q code" do
30
- _(AIXM.z(111, :qfe)).must_be :qfe?
31
- end
32
-
33
- it "doesn't recognize different Q code" do
34
- _(AIXM.z(111, :qnh)).wont_be :qfe?
35
- end
36
- end
37
-
38
- describe :ground? do
39
- it "must detect ground" do
40
- _(AIXM.z(0, :qfe)).must_be :ground?
41
- _(AIXM.z(111, :qfe)).wont_be :ground?
42
- _(AIXM.z(0, :qnh)).wont_be :ground?
43
- end
44
- end
45
-
46
- describe :unit do
47
- it "must return the correct unit" do
48
- _(AIXM.z(0, :qfe).unit).must_equal :ft
49
- _(AIXM.z(0, :qnh).unit).must_equal :ft
50
- _(AIXM.z(0, :qne).unit).must_equal :fl
51
- end
52
- end
53
-
54
- describe :== do
55
- it "recognizes objects with identical altitude and Q code as equal" do
56
- a = AIXM.z(111, :qnh)
57
- b = AIXM.z(111, :qnh)
58
- _(a).must_equal b
59
- end
60
-
61
- it "recognizes objects with different altitude or Q code as unequal" do
62
- a = AIXM.z(111, :qnh)
63
- b = AIXM.z(222, :qnh)
64
- _(a).wont_equal b
65
- end
66
-
67
- it "recognizes objects of different class as unequal" do
68
- a = AIXM.z(111, :qnh)
69
- b = :oggy
70
- _(a).wont_equal b
71
- end
72
- end
73
-
74
- describe :hash do
75
- it "returns an integer" do
76
- _(subject.hash).must_be_instance_of Integer
77
- end
78
-
79
- it "allows for the use of instances as hash keys" do
80
- dupe = subject.dup
81
- _({ subject => true }[dupe]).must_equal true
82
- end
83
- end
84
-
85
- describe :zero? do
86
- it "returns true for zero height, elevation or altitude" do
87
- _(subject.tap { |s| s.alt = 0 }).must_be :zero?
88
- end
89
-
90
- it "returns false for non-zero height, elevation or altitude" do
91
- _(subject.tap { |s| s.alt = 1 }).wont_be :zero?
92
- end
93
- end
94
- end
@@ -1,12 +0,0 @@
1
- describe nil do
2
-
3
- it "accepts nil value" do
4
- _([nil]).must_be_written_to subject, :marking
5
- end
6
-
7
- it "stringifies valid values" do
8
- _(subject.tap { |s| s.marking = 'foobar' }.marking).must_equal 'foobar'
9
- _(subject.tap { |s| s.marking = 123 }.marking).must_equal '123'
10
- end
11
-
12
- end
@@ -1,11 +0,0 @@
1
- describe nil do
2
-
3
- it "fails on invalid values" do
4
- _([:foobar, 123]).wont_be_written_to subject, :organisation
5
- end
6
-
7
- it "accepts valid values" do
8
- _([AIXM::Factory.organisation]).must_be_written_to subject, :organisation
9
- end
10
-
11
- end
@@ -1,12 +0,0 @@
1
- describe nil do
2
-
3
- it "accepts nil value" do
4
- _([nil]).must_be_written_to subject, :remarks
5
- end
6
-
7
- it "stringifies valid values" do
8
- _(subject.tap { |s| s.remarks = 'foobar' }.remarks).must_equal 'foobar'
9
- _(subject.tap { |s| s.remarks = 123 }.remarks).must_equal '123'
10
- end
11
-
12
- end
@@ -1,11 +0,0 @@
1
- describe nil do
2
-
3
- it "fails on invalid values" do
4
- _([:foobar, 123]).wont_be_written_to subject, :timetable
5
- end
6
-
7
- it "accepts nil values" do
8
- _([nil]).must_be_written_to subject, :timetable
9
- end
10
-
11
- end
@@ -1,11 +0,0 @@
1
- describe nil do
2
-
3
- it "fails on invalid values" do
4
- _([:foobar, 123]).wont_be_written_to subject, :xy
5
- end
6
-
7
- it "accepts valid values" do
8
- _([AIXM::Factory.xy]).must_be_written_to subject, :xy
9
- end
10
-
11
- end
@@ -1,11 +0,0 @@
1
- describe nil do
2
-
3
- it "fails on invalid values" do
4
- _([:foobar, 123, AIXM.z(123, :qfe)]).wont_be_written_to subject, :z
5
- end
6
-
7
- it "accepts valid values" do
8
- _([AIXM.z(123, :qnh)]).must_be_written_to subject, :z
9
- end
10
-
11
- end
Binary file
Binary file
@@ -1,62 +0,0 @@
1
- $VERBOSE = nil # silence warnings
2
-
3
- gem 'minitest'
4
-
5
- require 'pathname'
6
-
7
- require 'minitest/autorun'
8
- require Pathname(__dir__).join('..', 'lib', 'aixm')
9
-
10
- require 'minitest/sound'
11
- require 'minitest/sound/reporter'
12
- Minitest::Sound.success = Pathname(__dir__).join('sounds/success.mp3').to_s
13
- Minitest::Sound.failure = Pathname(__dir__).join('sounds/failure.mp3').to_s
14
- require 'minitest/reporters'
15
- Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new, Minitest::Sound::Reporter.new]
16
-
17
- require 'minitest/focus'
18
- require 'minitest/matchers'
19
- require Pathname(__dir__).join('factory')
20
-
21
- module AIXM
22
- def self.root
23
- Pathname(__dir__).join('..')
24
- end
25
- end
26
-
27
- class MiniTest::Spec
28
- class << self
29
- alias_method :context, :describe
30
-
31
- def macro(name)
32
- load Pathname(__dir__).join("macros/#{name}.rb")
33
- end
34
- end
35
- end
36
-
37
- module Minitest::Assertions
38
- def assert_write(values, subject, attribute, msg=nil)
39
- values.each do |value|
40
- msg = message(msg) { "Expected #{mu_pp(value)} to be written to #{subject.class}##{attribute}" }
41
- subject.send("#{attribute}=", value)
42
- assert(subject.send(attribute) == value, msg)
43
- end
44
- end
45
-
46
- def refute_write(values, subject, attribute, msg=nil)
47
- values.each do |value|
48
- msg = "Expected #{mu_pp(value)} to raise ArgumentError when written to #{subject.class}##{attribute}"
49
- assert_raises(ArgumentError, msg) { subject.send("#{attribute}=", value) }
50
- end
51
- end
52
- end
53
-
54
- Array.infect_an_assertion :assert_write, :must_be_written_to, :reverse
55
- Array.infect_an_assertion :refute_write, :wont_be_written_to, :reverse
56
-
57
- class Minitest::Spec
58
- before :each do
59
- AIXM.config.schema = :aixm
60
- AIXM.config.mid_region = nil
61
- end
62
- end