aixm 0.1.3 → 0.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +91 -11
- data/lib/aixm.rb +10 -0
- data/lib/aixm/base.rb +10 -0
- data/lib/aixm/component/base.rb +1 -1
- data/lib/aixm/component/class_layer.rb +0 -3
- data/lib/aixm/component/geometry.rb +0 -3
- data/lib/aixm/component/geometry/arc.rb +4 -8
- data/lib/aixm/component/geometry/base.rb +8 -0
- data/lib/aixm/component/geometry/border.rb +3 -8
- data/lib/aixm/component/geometry/circle.rb +5 -9
- data/lib/aixm/component/geometry/point.rb +6 -13
- data/lib/aixm/component/schedule.rb +8 -10
- data/lib/aixm/component/vertical_limits.rb +1 -4
- data/lib/aixm/document.rb +9 -6
- data/lib/aixm/f.rb +41 -0
- data/lib/aixm/feature/airspace.rb +5 -9
- data/lib/aixm/feature/base.rb +6 -0
- data/lib/aixm/feature/navigational_aid/base.rb +46 -0
- data/lib/aixm/feature/navigational_aid/designated_point.rb +69 -0
- data/lib/aixm/feature/navigational_aid/dme.rb +54 -0
- data/lib/aixm/feature/navigational_aid/marker.rb +41 -0
- data/lib/aixm/feature/navigational_aid/ndb.rb +56 -0
- data/lib/aixm/feature/navigational_aid/tacan.rb +54 -0
- data/lib/aixm/feature/navigational_aid/vor.rb +92 -0
- data/lib/aixm/refinements.rb +23 -2
- data/lib/aixm/shortcuts.rb +12 -5
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm/xy.rb +9 -6
- data/lib/aixm/z.rb +22 -11
- data/spec/factory.rb +87 -4
- data/spec/lib/aixm/component/class_layer_spec.rb +6 -6
- data/spec/lib/aixm/component/geometry/arc_spec.rb +16 -16
- data/spec/lib/aixm/component/geometry/border_spec.rb +4 -4
- data/spec/lib/aixm/component/geometry/circle_spec.rb +10 -10
- data/spec/lib/aixm/component/geometry/point_spec.rb +4 -4
- data/spec/lib/aixm/component/geometry_spec.rb +21 -21
- data/spec/lib/aixm/component/schedule_spec.rb +6 -6
- data/spec/lib/aixm/component/vertical_limits_spec.rb +18 -18
- data/spec/lib/aixm/document_spec.rb +220 -30
- data/spec/lib/aixm/f_spec.rb +58 -0
- data/spec/lib/aixm/feature/airspace_spec.rb +5 -5
- data/spec/lib/aixm/feature/navigational_aid/base_spec.rb +37 -0
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +43 -0
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +43 -0
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +44 -0
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +54 -0
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +43 -0
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +58 -0
- data/spec/lib/aixm/refinements_spec.rb +27 -0
- data/spec/lib/aixm/xy_spec.rb +29 -23
- data/spec/lib/aixm/z_spec.rb +33 -17
- metadata +29 -2
data/spec/lib/aixm/xy_spec.rb
CHANGED
@@ -3,40 +3,40 @@ require_relative '../../spec_helper'
|
|
3
3
|
describe AIXM::XY do
|
4
4
|
describe :initialize do
|
5
5
|
it "must parse valid DD" do
|
6
|
-
subject = AIXM
|
6
|
+
subject = AIXM.xy(lat: 11.2233, long: 22.3344)
|
7
7
|
subject.lat.must_equal 11.2233
|
8
8
|
subject.long.must_equal 22.3344
|
9
9
|
end
|
10
10
|
|
11
11
|
it "must parse valid DMS N/E" do
|
12
|
-
subject = AIXM
|
12
|
+
subject = AIXM.xy(lat: %q(11°22'33"N), long: %q(22°33'44"E))
|
13
13
|
subject.lat.must_equal 11.37583333
|
14
14
|
subject.long.must_equal 22.56222222
|
15
15
|
end
|
16
16
|
|
17
17
|
it "must parse valid DMS S/W" do
|
18
|
-
subject = AIXM
|
18
|
+
subject = AIXM.xy(lat: %q(11°22'33"S), long: %q(22°33'44"W))
|
19
19
|
subject.lat.must_equal(-11.37583333)
|
20
20
|
subject.long.must_equal(-22.56222222)
|
21
21
|
end
|
22
22
|
|
23
23
|
it "won't parse invalid latitude" do
|
24
|
-
-> { AIXM
|
24
|
+
-> { AIXM.xy(lat: 91, long: 22.3344) }.must_raise ArgumentError
|
25
25
|
end
|
26
26
|
|
27
27
|
it "won't parse invalid longitude" do
|
28
|
-
-> { AIXM
|
28
|
+
-> { AIXM.xy(lat: 11.2233, long: 181) }.must_raise ArgumentError
|
29
29
|
end
|
30
30
|
|
31
31
|
it "won't parse invalid DMS" do
|
32
|
-
-> { AIXM
|
32
|
+
-> { AIXM.xy(lat: "foo", long: "bar") }.must_raise ArgumentError
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
describe :lat do
|
37
37
|
context "north" do
|
38
38
|
subject do
|
39
|
-
AIXM
|
39
|
+
AIXM.xy(lat: 1.1234, long: 0)
|
40
40
|
end
|
41
41
|
|
42
42
|
it "must format DD (default) correctly" do
|
@@ -44,17 +44,17 @@ describe AIXM::XY do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "must format AIXM correctly" do
|
47
|
-
subject.lat(:
|
47
|
+
subject.lat(:aixm).must_equal %q(010724.24N)
|
48
48
|
end
|
49
49
|
|
50
50
|
it "must format OFM correctly" do
|
51
|
-
subject.lat(:
|
51
|
+
subject.lat(:ofm).must_equal '1.12340000N'
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
context "south" do
|
56
56
|
subject do
|
57
|
-
AIXM
|
57
|
+
AIXM.xy(lat: -1.1234, long: 0)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "must format DD (default) correctly" do
|
@@ -62,11 +62,11 @@ describe AIXM::XY do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "must format AIXM correctly" do
|
65
|
-
subject.lat(:
|
65
|
+
subject.lat(:aixm).must_equal %q(010724.24S)
|
66
66
|
end
|
67
67
|
|
68
68
|
it "must format OFM correctly" do
|
69
|
-
subject.lat(:
|
69
|
+
subject.lat(:ofm).must_equal '1.12340000S'
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -74,7 +74,7 @@ describe AIXM::XY do
|
|
74
74
|
describe :long do
|
75
75
|
context "east" do
|
76
76
|
subject do
|
77
|
-
AIXM
|
77
|
+
AIXM.xy(lat: 0, long: 1.1234)
|
78
78
|
end
|
79
79
|
|
80
80
|
it "must format DD (default) correctly" do
|
@@ -82,17 +82,17 @@ describe AIXM::XY do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it "must format AIXM correctly" do
|
85
|
-
subject.long(:
|
85
|
+
subject.long(:aixm).must_equal %q(0010724.24E)
|
86
86
|
end
|
87
87
|
|
88
88
|
it "must format OFM correctly" do
|
89
|
-
subject.long(:
|
89
|
+
subject.long(:ofm).must_equal '1.12340000E'
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
context "west" do
|
94
94
|
subject do
|
95
|
-
AIXM
|
95
|
+
AIXM.xy(lat: 0, long: -1.1234)
|
96
96
|
end
|
97
97
|
|
98
98
|
it "must format DD (default) correctly" do
|
@@ -100,30 +100,36 @@ describe AIXM::XY do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
it "must format AIXM correctly" do
|
103
|
-
subject.long(:
|
103
|
+
subject.long(:aixm).must_equal %q(0010724.24W)
|
104
104
|
end
|
105
105
|
|
106
106
|
it "must format OFM correctly" do
|
107
|
-
subject.long(:
|
107
|
+
subject.long(:ofm).must_equal '1.12340000W'
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
+
describe :to_digest do
|
113
|
+
it "must return digest of payload" do
|
114
|
+
AIXM::Factory.xy.to_digest.must_equal 783044788
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
112
118
|
describe :== do
|
113
119
|
it "recognizes objects with identical latitude and longitude as equal" do
|
114
|
-
a = AIXM
|
115
|
-
b = AIXM
|
120
|
+
a = AIXM.xy(lat: "112233N", long: "0223344E")
|
121
|
+
b = AIXM.xy(lat: 11.37583333, long: 22.56222222)
|
116
122
|
a.must_equal b
|
117
123
|
end
|
118
124
|
|
119
125
|
it "recognizes objects with different latitude or longitude as unequal" do
|
120
|
-
a = AIXM
|
121
|
-
b = AIXM
|
126
|
+
a = AIXM.xy(lat: "112233.44N", long: "0223344.55E")
|
127
|
+
b = AIXM.xy(lat: 11, long: 22)
|
122
128
|
a.wont_equal b
|
123
129
|
end
|
124
130
|
|
125
131
|
it "recognizes objects of different class as unequal" do
|
126
|
-
a = AIXM
|
132
|
+
a = AIXM.xy(lat: "112233.44N", long: "0223344.55E")
|
127
133
|
b = :oggy
|
128
134
|
a.wont_equal b
|
129
135
|
end
|
data/spec/lib/aixm/z_spec.rb
CHANGED
@@ -3,57 +3,73 @@ require_relative '../../spec_helper'
|
|
3
3
|
describe AIXM::Z do
|
4
4
|
describe :initialize do
|
5
5
|
it "must parse valid Q code" do
|
6
|
-
subject = AIXM
|
6
|
+
subject = AIXM.z(111, 'QNH')
|
7
7
|
subject.alt.must_equal 111
|
8
|
-
subject.code.must_equal :
|
8
|
+
subject.code.must_equal :qnh
|
9
9
|
end
|
10
10
|
|
11
11
|
it "won't parse invalid Q code" do
|
12
|
-
-> { AIXM
|
12
|
+
-> { AIXM.z(111, :FOO) }.must_raise ArgumentError
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe :to_digest do
|
17
|
+
it "must return digest of payload" do
|
18
|
+
AIXM.z(111, :qnh).to_digest.must_equal 606000673
|
13
19
|
end
|
14
20
|
end
|
15
21
|
|
16
22
|
describe :== do
|
17
23
|
it "recognizes objects with identical altitude and Q code as equal" do
|
18
|
-
a = AIXM
|
19
|
-
b = AIXM
|
24
|
+
a = AIXM.z(111, :qnh)
|
25
|
+
b = AIXM.z(111, :qnh)
|
20
26
|
a.must_equal b
|
21
27
|
end
|
22
28
|
|
23
29
|
it "recognizes objects with different altitude or Q code as unequal" do
|
24
|
-
a = AIXM
|
25
|
-
b = AIXM
|
30
|
+
a = AIXM.z(111, :qnh)
|
31
|
+
b = AIXM.z(222, :qnh)
|
26
32
|
a.wont_equal b
|
27
33
|
end
|
28
34
|
|
29
35
|
it "recognizes objects of different class as unequal" do
|
30
|
-
a = AIXM
|
36
|
+
a = AIXM.z(111, :qnh)
|
31
37
|
b = :oggy
|
32
38
|
a.wont_equal b
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
42
|
+
describe :qfe? do
|
43
|
+
it "recognizes same Q code" do
|
44
|
+
AIXM.z(111, :qfe).must_be :qfe?
|
45
|
+
end
|
46
|
+
|
47
|
+
it "doesn't recognize different Q code" do
|
48
|
+
AIXM.z(111, :qnh).wont_be :qfe?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
36
52
|
describe :ground? do
|
37
53
|
it "must detect ground" do
|
38
|
-
AIXM
|
39
|
-
AIXM
|
40
|
-
AIXM
|
54
|
+
AIXM.z(0, :qfe).must_be :ground?
|
55
|
+
AIXM.z(111, :qfe).wont_be :ground?
|
56
|
+
AIXM.z(0, :qnh).wont_be :ground?
|
41
57
|
end
|
42
58
|
end
|
43
59
|
|
44
60
|
describe :base do
|
45
61
|
it "must return the correct base" do
|
46
|
-
AIXM
|
47
|
-
AIXM
|
48
|
-
AIXM
|
62
|
+
AIXM.z(0, :qfe).base.must_equal :ASFC
|
63
|
+
AIXM.z(0, :qnh).base.must_equal :AMSL
|
64
|
+
AIXM.z(0, :qne).base.must_equal :AMSL
|
49
65
|
end
|
50
66
|
end
|
51
67
|
|
52
68
|
describe :unit do
|
53
69
|
it "must return the correct unit" do
|
54
|
-
AIXM
|
55
|
-
AIXM
|
56
|
-
AIXM
|
70
|
+
AIXM.z(0, :qfe).unit.must_equal :FT
|
71
|
+
AIXM.z(0, :qnh).unit.must_equal :FT
|
72
|
+
AIXM.z(0, :qne).unit.must_equal :FL
|
57
73
|
end
|
58
74
|
end
|
59
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aixm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Schwyn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -168,17 +168,28 @@ files:
|
|
168
168
|
- Rakefile
|
169
169
|
- aixm.gemspec
|
170
170
|
- lib/aixm.rb
|
171
|
+
- lib/aixm/base.rb
|
171
172
|
- lib/aixm/component/base.rb
|
172
173
|
- lib/aixm/component/class_layer.rb
|
173
174
|
- lib/aixm/component/geometry.rb
|
174
175
|
- lib/aixm/component/geometry/arc.rb
|
176
|
+
- lib/aixm/component/geometry/base.rb
|
175
177
|
- lib/aixm/component/geometry/border.rb
|
176
178
|
- lib/aixm/component/geometry/circle.rb
|
177
179
|
- lib/aixm/component/geometry/point.rb
|
178
180
|
- lib/aixm/component/schedule.rb
|
179
181
|
- lib/aixm/component/vertical_limits.rb
|
180
182
|
- lib/aixm/document.rb
|
183
|
+
- lib/aixm/f.rb
|
181
184
|
- lib/aixm/feature/airspace.rb
|
185
|
+
- lib/aixm/feature/base.rb
|
186
|
+
- lib/aixm/feature/navigational_aid/base.rb
|
187
|
+
- lib/aixm/feature/navigational_aid/designated_point.rb
|
188
|
+
- lib/aixm/feature/navigational_aid/dme.rb
|
189
|
+
- lib/aixm/feature/navigational_aid/marker.rb
|
190
|
+
- lib/aixm/feature/navigational_aid/ndb.rb
|
191
|
+
- lib/aixm/feature/navigational_aid/tacan.rb
|
192
|
+
- lib/aixm/feature/navigational_aid/vor.rb
|
182
193
|
- lib/aixm/refinements.rb
|
183
194
|
- lib/aixm/schemas/4.5/AIXM-DataTypes.xsd
|
184
195
|
- lib/aixm/schemas/4.5/AIXM-Features.xsd
|
@@ -197,7 +208,15 @@ files:
|
|
197
208
|
- spec/lib/aixm/component/schedule_spec.rb
|
198
209
|
- spec/lib/aixm/component/vertical_limits_spec.rb
|
199
210
|
- spec/lib/aixm/document_spec.rb
|
211
|
+
- spec/lib/aixm/f_spec.rb
|
200
212
|
- spec/lib/aixm/feature/airspace_spec.rb
|
213
|
+
- spec/lib/aixm/feature/navigational_aid/base_spec.rb
|
214
|
+
- spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb
|
215
|
+
- spec/lib/aixm/feature/navigational_aid/dme_spec.rb
|
216
|
+
- spec/lib/aixm/feature/navigational_aid/marker_spec.rb
|
217
|
+
- spec/lib/aixm/feature/navigational_aid/ndb_spec.rb
|
218
|
+
- spec/lib/aixm/feature/navigational_aid/tacan_spec.rb
|
219
|
+
- spec/lib/aixm/feature/navigational_aid/vor_spec.rb
|
201
220
|
- spec/lib/aixm/refinements_spec.rb
|
202
221
|
- spec/lib/aixm/version_spec.rb
|
203
222
|
- spec/lib/aixm/xy_spec.rb
|
@@ -240,7 +259,15 @@ test_files:
|
|
240
259
|
- spec/lib/aixm/component/schedule_spec.rb
|
241
260
|
- spec/lib/aixm/component/vertical_limits_spec.rb
|
242
261
|
- spec/lib/aixm/document_spec.rb
|
262
|
+
- spec/lib/aixm/f_spec.rb
|
243
263
|
- spec/lib/aixm/feature/airspace_spec.rb
|
264
|
+
- spec/lib/aixm/feature/navigational_aid/base_spec.rb
|
265
|
+
- spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb
|
266
|
+
- spec/lib/aixm/feature/navigational_aid/dme_spec.rb
|
267
|
+
- spec/lib/aixm/feature/navigational_aid/marker_spec.rb
|
268
|
+
- spec/lib/aixm/feature/navigational_aid/ndb_spec.rb
|
269
|
+
- spec/lib/aixm/feature/navigational_aid/tacan_spec.rb
|
270
|
+
- spec/lib/aixm/feature/navigational_aid/vor_spec.rb
|
244
271
|
- spec/lib/aixm/refinements_spec.rb
|
245
272
|
- spec/lib/aixm/version_spec.rb
|
246
273
|
- spec/lib/aixm/xy_spec.rb
|