aixm 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +149 -116
  4. data/lib/aixm/component/class_layer.rb +3 -3
  5. data/lib/aixm/component/geometry.rb +3 -3
  6. data/lib/aixm/component/geometry/arc.rb +2 -2
  7. data/lib/aixm/component/geometry/border.rb +2 -2
  8. data/lib/aixm/component/geometry/circle.rb +2 -2
  9. data/lib/aixm/component/geometry/point.rb +2 -2
  10. data/lib/aixm/component/schedule.rb +2 -2
  11. data/lib/aixm/component/vertical_limits.rb +2 -2
  12. data/lib/aixm/document.rb +4 -4
  13. data/lib/aixm/feature/airspace.rb +42 -17
  14. data/lib/aixm/feature/navigational_aid/base.rb +41 -8
  15. data/lib/aixm/feature/navigational_aid/designated_point.rb +29 -15
  16. data/lib/aixm/feature/navigational_aid/dme.rb +32 -9
  17. data/lib/aixm/feature/navigational_aid/marker.rb +25 -7
  18. data/lib/aixm/feature/navigational_aid/ndb.rb +25 -9
  19. data/lib/aixm/feature/navigational_aid/tacan.rb +21 -20
  20. data/lib/aixm/feature/navigational_aid/vor.rb +66 -26
  21. data/lib/aixm/version.rb +1 -1
  22. data/spec/factory.rb +69 -13
  23. data/spec/lib/aixm/component/class_layer_spec.rb +4 -4
  24. data/spec/lib/aixm/component/geometry/arc_spec.rb +3 -3
  25. data/spec/lib/aixm/component/geometry/border_spec.rb +2 -2
  26. data/spec/lib/aixm/component/geometry/circle_spec.rb +3 -3
  27. data/spec/lib/aixm/component/geometry/point_spec.rb +3 -3
  28. data/spec/lib/aixm/component/geometry_spec.rb +4 -4
  29. data/spec/lib/aixm/component/schedule_spec.rb +2 -2
  30. data/spec/lib/aixm/component/vertical_limits_spec.rb +4 -4
  31. data/spec/lib/aixm/document_spec.rb +282 -28
  32. data/spec/lib/aixm/feature/airspace_spec.rb +14 -10
  33. data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +9 -6
  34. data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +9 -6
  35. data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +7 -4
  36. data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +9 -6
  37. data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +9 -6
  38. data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +156 -7
  39. metadata +2 -2
@@ -31,10 +31,10 @@ describe AIXM::Feature::Airspace do
31
31
  end
32
32
  end
33
33
 
34
- describe :to_xml do
34
+ describe :to_aixm do
35
35
  it "must build correct XML with OFM extensions" do
36
36
  digest = subject.to_digest
37
- subject.to_xml(:ofm).must_equal <<~"END"
37
+ subject.to_aixm(:ofm).must_equal <<~"END"
38
38
  <!-- Airspace: [D] POLYGON AIRSPACE -->
39
39
  <Ase xt_classLayersAvail="false">
40
40
  <AseUid mid="#{digest}" newEntity="true">
@@ -116,10 +116,10 @@ describe AIXM::Feature::Airspace do
116
116
  end
117
117
  end
118
118
 
119
- describe :to_xml do
119
+ describe :to_aixm do
120
120
  it "must build correct XML with OFM extensions" do
121
121
  digest = subject.to_digest
122
- subject.to_xml(:ofm).must_equal <<~"END"
122
+ subject.to_aixm(:ofm).must_equal <<~"END"
123
123
  <!-- Airspace: [D] POLYGON AIRSPACE -->
124
124
  <Ase xt_classLayersAvail="true">
125
125
  <AseUid mid="#{digest}" newEntity="true">
@@ -236,19 +236,23 @@ describe AIXM::Feature::Airspace do
236
236
  end
237
237
 
238
238
  context "partially complete" do
239
+ subject do
240
+ AIXM::Factory.polygon_airspace
241
+ end
242
+
239
243
  it "must build correct XML without short name" do
240
- subject = AIXM::Factory.polygon_airspace(short_name: nil)
241
- subject.to_xml.wont_match(/txtLocalType/)
244
+ subject.short_name = nil
245
+ subject.to_aixm.wont_match(/txtLocalType/)
242
246
  end
243
247
 
244
248
  it "must build correct XML with identical name and short name" do
245
- subject = AIXM::Factory.polygon_airspace(short_name: 'POLYGON AIRSPACE')
246
- subject.to_xml.wont_match(/txtLocalType/)
249
+ subject.short_name = 'POLYGON AIRSPACE'
250
+ subject.to_aixm.wont_match(/txtLocalType/)
247
251
  end
248
252
 
249
253
  it "must build correct XML without schedule" do
250
- subject = AIXM::Factory.polygon_airspace(schedule: nil)
251
- subject.to_xml.wont_match(/codeWorkHr/)
254
+ subject.schedule = nil
255
+ subject.to_aixm.wont_match(/codeWorkHr/)
252
256
  end
253
257
  end
254
258
  end
@@ -8,23 +8,23 @@ describe AIXM::Feature::NavigationalAid::DesignatedPoint do
8
8
 
9
9
  describe :kind do
10
10
  it "must return class or type" do
11
- subject.kind.must_equal :ICAO
11
+ subject.kind.must_equal "DesignatedPoint:ICAO"
12
12
  end
13
13
  end
14
14
 
15
15
  describe :to_digest do
16
16
  it "must return digest of payload" do
17
- subject.to_digest.must_equal 582056647
17
+ subject.to_digest.must_equal 5317882
18
18
  end
19
19
  end
20
20
 
21
- describe :to_xml do
21
+ describe :to_aixm do
22
22
  it "must build correct XML of VOR with OFM extension" do
23
- subject.to_xml(:ofm).must_equal <<~END
24
- <!-- Navigational aid: [ICAO] DESIGNATED POINT NAVAID -->
23
+ subject.to_aixm(:ofm).must_equal <<~END
24
+ <!-- NavigationalAid: [DesignatedPoint:ICAO] DESIGNATED POINT NAVAID -->
25
25
  <Dpn>
26
26
  <DpnUid newEntity="true">
27
- <codeId>DPN</codeId>
27
+ <codeId>DDD</codeId>
28
28
  <geoLat>47.85916667N</geoLat>
29
29
  <geoLong>7.56000000E</geoLong>
30
30
  </DpnUid>
@@ -34,6 +34,9 @@ describe AIXM::Feature::NavigationalAid::DesignatedPoint do
34
34
  <codeType>ICAO</codeType>
35
35
  <valElev>500</valElev>
36
36
  <uomDistVer>FT</uomDistVer>
37
+ <Dtt>
38
+ <codeWorkHr>H24</codeWorkHr>
39
+ </Dtt>
37
40
  <txtRmk>designated point navaid</txtRmk>
38
41
  </Dpn>
39
42
  END
@@ -8,23 +8,23 @@ describe AIXM::Feature::NavigationalAid::DME do
8
8
 
9
9
  describe :kind do
10
10
  it "must return class or type" do
11
- subject.kind.must_equal :DME
11
+ subject.kind.must_equal "DME"
12
12
  end
13
13
  end
14
14
 
15
15
  describe :to_digest do
16
16
  it "must return digest of payload" do
17
- subject.to_digest.must_equal 30256638
17
+ subject.to_digest.must_equal 537506748
18
18
  end
19
19
  end
20
20
 
21
- describe :to_xml do
21
+ describe :to_aixm do
22
22
  it "must build correct XML with OFM extension" do
23
- subject.to_xml(:ofm).must_equal <<~END
24
- <!-- Navigational aid: [DME] DME NAVAID -->
23
+ subject.to_aixm(:ofm).must_equal <<~END
24
+ <!-- NavigationalAid: [DME] DME NAVAID -->
25
25
  <Dme>
26
26
  <DmeUid newEntity="true">
27
- <codeId>DME</codeId>
27
+ <codeId>MMM</codeId>
28
28
  <geoLat>47.85916667N</geoLat>
29
29
  <geoLong>7.56000000E</geoLong>
30
30
  </DmeUid>
@@ -34,6 +34,9 @@ describe AIXM::Feature::NavigationalAid::DME do
34
34
  <codeDatum>WGE</codeDatum>
35
35
  <valElev>500</valElev>
36
36
  <uomDistVer>FT</uomDistVer>
37
+ <Dtt>
38
+ <codeWorkHr>H24</codeWorkHr>
39
+ </Dtt>
37
40
  <txtRmk>dme navaid</txtRmk>
38
41
  </Dme>
39
42
  END
@@ -8,7 +8,7 @@ describe AIXM::Feature::NavigationalAid::Marker do
8
8
 
9
9
  describe :kind do
10
10
  it "must return class or type" do
11
- subject.kind.must_equal :Marker
11
+ subject.kind.must_equal "Marker"
12
12
  end
13
13
  end
14
14
 
@@ -18,10 +18,10 @@ describe AIXM::Feature::NavigationalAid::Marker do
18
18
  end
19
19
  end
20
20
 
21
- describe :to_xml do
21
+ describe :to_aixm do
22
22
  it "must build correct XML with OFM extension" do
23
- subject.to_xml(:ofm).must_equal <<~END
24
- <!-- Navigational aid: [Marker] MARKER NAVAID -->
23
+ subject.to_aixm(:ofm).must_equal <<~END
24
+ <!-- NavigationalAid: [Marker] MARKER NAVAID -->
25
25
  <Mkr>
26
26
  <MkrUid newEntity="true">
27
27
  <codeId>---</codeId>
@@ -35,6 +35,9 @@ describe AIXM::Feature::NavigationalAid::Marker do
35
35
  <codeDatum>WGE</codeDatum>
36
36
  <valElev>500</valElev>
37
37
  <uomDistVer>FT</uomDistVer>
38
+ <Mtt>
39
+ <codeWorkHr>H24</codeWorkHr>
40
+ </Mtt>
38
41
  <txtRmk>marker navaid</txtRmk>
39
42
  </Mkr>
40
43
  END
@@ -18,23 +18,23 @@ describe AIXM::Feature::NavigationalAid::NDB do
18
18
 
19
19
  describe :kind do
20
20
  it "must return class or type" do
21
- subject.kind.must_equal :NDB
21
+ subject.kind.must_equal "NDB"
22
22
  end
23
23
  end
24
24
 
25
25
  describe :to_digest do
26
26
  it "must return digest of payload" do
27
- subject.to_digest.must_equal 839752023
27
+ subject.to_digest.must_equal 387748611
28
28
  end
29
29
  end
30
30
 
31
- describe :to_xml do
31
+ describe :to_aixm do
32
32
  it "must build correct XML with OFM extension" do
33
- subject.to_xml(:ofm).must_equal <<~END
34
- <!-- Navigational aid: [NDB] NDB NAVAID -->
33
+ subject.to_aixm(:ofm).must_equal <<~END
34
+ <!-- NavigationalAid: [NDB] NDB NAVAID -->
35
35
  <Ndb>
36
36
  <NdbUid newEntity="true">
37
- <codeId>NDB</codeId>
37
+ <codeId>NNN</codeId>
38
38
  <geoLat>47.85916667N</geoLat>
39
39
  <geoLong>7.56000000E</geoLong>
40
40
  </NdbUid>
@@ -45,6 +45,9 @@ describe AIXM::Feature::NavigationalAid::NDB do
45
45
  <codeDatum>WGE</codeDatum>
46
46
  <valElev>500</valElev>
47
47
  <uomDistVer>FT</uomDistVer>
48
+ <Ntt>
49
+ <codeWorkHr>H24</codeWorkHr>
50
+ </Ntt>
48
51
  <txtRmk>ndb navaid</txtRmk>
49
52
  </Ndb>
50
53
  END
@@ -8,23 +8,23 @@ describe AIXM::Feature::NavigationalAid::TACAN do
8
8
 
9
9
  describe :kind do
10
10
  it "must return class or type" do
11
- subject.kind.must_equal :TACAN
11
+ subject.kind.must_equal "TACAN"
12
12
  end
13
13
  end
14
14
 
15
15
  describe :to_digest do
16
16
  it "must return digest of payload" do
17
- subject.to_digest.must_equal 518546211
17
+ subject.to_digest.must_equal 648449590
18
18
  end
19
19
  end
20
20
 
21
- describe :to_xml do
21
+ describe :to_aixm do
22
22
  it "must build correct XML with OFM extension" do
23
- subject.to_xml(:ofm).must_equal <<~END
24
- <!-- Navigational aid: [TACAN] TACAN NAVAID -->
23
+ subject.to_aixm(:ofm).must_equal <<~END
24
+ <!-- NavigationalAid: [TACAN] TACAN NAVAID -->
25
25
  <Tcn>
26
26
  <TcnUid newEntity="true">
27
- <codeId>TCN</codeId>
27
+ <codeId>TTT</codeId>
28
28
  <geoLat>47.85916667N</geoLat>
29
29
  <geoLong>7.56000000E</geoLong>
30
30
  </TcnUid>
@@ -34,6 +34,9 @@ describe AIXM::Feature::NavigationalAid::TACAN do
34
34
  <codeDatum>WGE</codeDatum>
35
35
  <valElev>500</valElev>
36
36
  <uomDistVer>FT</uomDistVer>
37
+ <Ttt>
38
+ <codeWorkHr>H24</codeWorkHr>
39
+ </Ttt>
37
40
  <txtRmk>tacan navaid</txtRmk>
38
41
  </Tcn>
39
42
  END
@@ -13,30 +13,30 @@ describe AIXM::Feature::NavigationalAid::VOR do
13
13
  end
14
14
  end
15
15
 
16
- context "complete" do
16
+ context "complete VOR" do
17
17
  subject do
18
18
  AIXM::Factory.vor
19
19
  end
20
20
 
21
21
  describe :kind do
22
22
  it "must return class or type" do
23
- subject.kind.must_equal :VOR
23
+ subject.kind.must_equal "VOR:VOR"
24
24
  end
25
25
  end
26
26
 
27
27
  describe :to_digest do
28
28
  it "must return digest of payload" do
29
- subject.to_digest.must_equal 276222546
29
+ subject.to_digest.must_equal 152119936
30
30
  end
31
31
  end
32
32
 
33
- describe :to_xml do
33
+ describe :to_aixm do
34
34
  it "must build correct XML of VOR with OFM extension" do
35
- subject.to_xml(:ofm).must_equal <<~END
36
- <!-- Navigational aid: [VOR] VOR NAVAID -->
35
+ subject.to_aixm(:ofm).must_equal <<~END
36
+ <!-- NavigationalAid: [VOR:VOR] VOR NAVAID -->
37
37
  <Vor>
38
38
  <VorUid newEntity="true">
39
- <codeId>VOR</codeId>
39
+ <codeId>VVV</codeId>
40
40
  <geoLat>47.85916667N</geoLat>
41
41
  <geoLong>7.56000000E</geoLong>
42
42
  </VorUid>
@@ -49,10 +49,159 @@ describe AIXM::Feature::NavigationalAid::VOR do
49
49
  <codeDatum>WGE</codeDatum>
50
50
  <valElev>500</valElev>
51
51
  <uomDistVer>FT</uomDistVer>
52
+ <Vtt>
53
+ <codeWorkHr>H24</codeWorkHr>
54
+ </Vtt>
52
55
  <txtRmk>vor navaid</txtRmk>
53
56
  </Vor>
54
57
  END
55
58
  end
56
59
  end
57
60
  end
61
+
62
+ context "complete VOR/DME" do
63
+ subject do
64
+ AIXM::Factory.vor.tap do |vor|
65
+ vor.name = "VOR/DME NAVAID"
66
+ vor.remarks = "vor/dme navaid"
67
+ vor.associate_dme(channel: '84X')
68
+ end
69
+ end
70
+
71
+ describe :kind do
72
+ it "must return class or type" do
73
+ subject.kind.must_equal "VOR:VOR"
74
+ end
75
+ end
76
+
77
+ describe :to_digest do
78
+ it "must return digest of payload" do
79
+ subject.to_digest.must_equal 863096858
80
+ end
81
+ end
82
+
83
+ describe :to_aixm do
84
+ it "must build correct XML of VOR with OFM extension" do
85
+ subject.to_aixm(:ofm).must_equal <<~END
86
+ <!-- NavigationalAid: [VOR:VOR] VOR/DME NAVAID -->
87
+ <Vor>
88
+ <VorUid newEntity="true">
89
+ <codeId>VVV</codeId>
90
+ <geoLat>47.85916667N</geoLat>
91
+ <geoLong>7.56000000E</geoLong>
92
+ </VorUid>
93
+ <OrgUid/>
94
+ <txtName>VOR/DME NAVAID</txtName>
95
+ <codeType>VOR</codeType>
96
+ <valFreq>111</valFreq>
97
+ <uomFreq>MHZ</uomFreq>
98
+ <codeTypeNorth>TRUE</codeTypeNorth>
99
+ <codeDatum>WGE</codeDatum>
100
+ <valElev>500</valElev>
101
+ <uomDistVer>FT</uomDistVer>
102
+ <Vtt>
103
+ <codeWorkHr>H24</codeWorkHr>
104
+ </Vtt>
105
+ <txtRmk>vor/dme navaid</txtRmk>
106
+ </Vor>
107
+ <!-- NavigationalAid: [DME] VOR/DME NAVAID -->
108
+ <Dme>
109
+ <DmeUid newEntity="true">
110
+ <codeId>VVV</codeId>
111
+ <geoLat>47.85916667N</geoLat>
112
+ <geoLong>7.56000000E</geoLong>
113
+ </DmeUid>
114
+ <OrgUid/>
115
+ <VorUid newEntity="true">
116
+ <codeId>VVV</codeId>
117
+ <geoLat>47.85916667N</geoLat>
118
+ <geoLong>7.56000000E</geoLong>
119
+ </VorUid>
120
+ <txtName>VOR/DME NAVAID</txtName>
121
+ <codeChannel>84X</codeChannel>
122
+ <codeDatum>WGE</codeDatum>
123
+ <valElev>500</valElev>
124
+ <uomDistVer>FT</uomDistVer>
125
+ <Dtt>
126
+ <codeWorkHr>H24</codeWorkHr>
127
+ </Dtt>
128
+ <txtRmk>vor/dme navaid</txtRmk>
129
+ </Dme>
130
+ END
131
+ end
132
+ end
133
+ end
134
+
135
+ context "complete VORTAC" do
136
+ subject do
137
+ AIXM::Factory.vor.tap do |vor|
138
+ vor.name = "VORTAC NAVAID"
139
+ vor.remarks = "vortac navaid"
140
+ vor.associate_tacan(channel: '54X')
141
+ end
142
+ end
143
+
144
+ describe :kind do
145
+ it "must return class or type" do
146
+ subject.kind.must_equal "VOR:VOR"
147
+ end
148
+ end
149
+
150
+ describe :to_digest do
151
+ it "must return digest of payload" do
152
+ subject.to_digest.must_equal 458371299
153
+ end
154
+ end
155
+
156
+ describe :to_aixm do
157
+ it "must build correct XML of VOR with OFM extension" do
158
+ subject.to_aixm(:ofm).must_equal <<~END
159
+ <!-- NavigationalAid: [VOR:VOR] VORTAC NAVAID -->
160
+ <Vor>
161
+ <VorUid newEntity="true">
162
+ <codeId>VVV</codeId>
163
+ <geoLat>47.85916667N</geoLat>
164
+ <geoLong>7.56000000E</geoLong>
165
+ </VorUid>
166
+ <OrgUid/>
167
+ <txtName>VORTAC NAVAID</txtName>
168
+ <codeType>VOR</codeType>
169
+ <valFreq>111</valFreq>
170
+ <uomFreq>MHZ</uomFreq>
171
+ <codeTypeNorth>TRUE</codeTypeNorth>
172
+ <codeDatum>WGE</codeDatum>
173
+ <valElev>500</valElev>
174
+ <uomDistVer>FT</uomDistVer>
175
+ <Vtt>
176
+ <codeWorkHr>H24</codeWorkHr>
177
+ </Vtt>
178
+ <txtRmk>vortac navaid</txtRmk>
179
+ </Vor>
180
+ <!-- NavigationalAid: [TACAN] VORTAC NAVAID -->
181
+ <Tcn>
182
+ <TcnUid newEntity="true">
183
+ <codeId>VVV</codeId>
184
+ <geoLat>47.85916667N</geoLat>
185
+ <geoLong>7.56000000E</geoLong>
186
+ </TcnUid>
187
+ <OrgUid/>
188
+ <VorUid newEntity="true">
189
+ <codeId>VVV</codeId>
190
+ <geoLat>47.85916667N</geoLat>
191
+ <geoLong>7.56000000E</geoLong>
192
+ </VorUid>
193
+ <txtName>VORTAC NAVAID</txtName>
194
+ <codeChannel>54X</codeChannel>
195
+ <codeDatum>WGE</codeDatum>
196
+ <valElev>500</valElev>
197
+ <uomDistVer>FT</uomDistVer>
198
+ <Ttt>
199
+ <codeWorkHr>H24</codeWorkHr>
200
+ </Ttt>
201
+ <txtRmk>vortac navaid</txtRmk>
202
+ </Tcn>
203
+ END
204
+ end
205
+ end
206
+ end
58
207
  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.2.0
4
+ version: 0.2.1
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-24 00:00:00.000000000 Z
11
+ date: 2018-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler