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,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
data/spec/macros/xy.rb DELETED
@@ -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
data/spec/macros/z_qnh.rb DELETED
@@ -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
data/spec/spec_helper.rb DELETED
@@ -1,55 +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