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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd29f2661b79750343e05d494102c232fa91ffa861038eb4fe2b147fe2a01bd2
4
- data.tar.gz: 657c897f48236120da2c82b833f65e8e540585176c46c939b1b9a73a594f13fd
3
+ metadata.gz: 486dafa5ec46b76f70a12053bdc29606c563136106cd25ffafc62906decec9e4
4
+ data.tar.gz: f154584ca3cc854eec2e715b76ff379b689ed51a0bd7887979445b3733a3e0d6
5
5
  SHA512:
6
- metadata.gz: a356611cb807985b0dba0cde0fc5ced0ec07b84a9be92608145f32ea736a6d87f283d523855276e8902bb420575e80acca2d9f2109d424348f2c8771593c1a05
7
- data.tar.gz: 0d98d537ced8fdea59cae71328bb684144e4c52c684f895b076a401ca39138f64683b796e8ba6486244f326662be9df30851fbf3c7819f4a8489b0c1315edeb0
6
+ metadata.gz: 68808eefa33113f2e57c5376156c5395711c80f447e9cb03584076d45f043b102f213450e6e2f438ec4a0480eff10708605c6bb623bcba2a55d629241a4d4a7a
7
+ data.tar.gz: 148345f24a85d5e5636d93175ea516c1266bd5277f0a13c301acb8762155f349a80a095c33856b8ff8234826e3301409b73b7b8fb681ac872463a8d9e596e272
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.2.1
2
+
3
+ * Major changes:
4
+ * Fix DVOR and VORDME confusion
5
+ * Add schedule to navigational aids
6
+ * VOR can be associated with DME (-> VOR/DME) or TACAN (-> VORTAC) now
7
+ * `to_xml` has been renamed to `to_aixm` everywhere
8
+ * Minor changes:
9
+ * Remove :other from all value lists
10
+
1
11
  ## 0.2.0
2
12
 
3
13
  * Additions:
data/README.md CHANGED
@@ -6,12 +6,9 @@
6
6
 
7
7
  # AIXM
8
8
 
9
- Partial implementation of the [Aeronautical Information Exchange Model (AIXM 4.5)](http://aixm.aero)
10
- for Ruby.
9
+ Partial implementation of the [Aeronautical Information Exchange Model (AIXM 4.5)](http://aixm.aero) for Ruby.
11
10
 
12
- For now, only the parts needed to automize the AIP import of [Open Flightmaps](https://openflightmaps.org)
13
- are part of this gem. Most notably, the gem is only a builder of AIXM 4.5
14
- snapshot files and does not parse them.
11
+ For now, only the parts needed to automize the AIP import of [Open Flightmaps](https://openflightmaps.org) are part of this gem. Most notably, the gem is only a builder of AIXM 4.5 snapshot files and does not parse them.
15
12
 
16
13
  * [Homepage](https://github.com/svoop/aixm)
17
14
  * [API](http://www.rubydoc.info/gems/aixm)
@@ -27,8 +24,7 @@ gem aixm
27
24
 
28
25
  ## Usage
29
26
 
30
- You can initialize all elements either traditionally or by use of shorter
31
- AIXM class methods:
27
+ You can initialize all elements either traditionally or by use of shorter AIXM class methods:
32
28
 
33
29
  ```ruby
34
30
  AIXM.airspace(...)
@@ -41,26 +37,24 @@ All fundamentals are subclasses of `AIXM::Base`.
41
37
 
42
38
  ### Document
43
39
 
44
- The document is the root container of the AIXM snapshot file to be generated.
45
- It's essentially a collection of features:
40
+ The document is the root container of the AIXM snapshot file to be generated. It's essentially a collection of features:
46
41
 
47
42
  ```ruby
48
43
  document = AIXM.document(created_at: Time.now, effective_at: Time.now)
49
44
  document.features << AIXM.airspace(...)
50
45
  ```
51
46
 
52
- To give an overview of the AIXM building blocks, the remainder of this guide
53
- will list initializer arguments with colons (`name: class`) and attribute
54
- writers with equal or push signs (`name = class` or `name << class`):
47
+ To give you an overview of the AIXM building blocks, the remainder of this guide will use pseudo code to describe the initializer arguments, writer methods etc:
55
48
 
56
- * AIXM.document
57
- * created_at: Time, Date or String
58
- * effective_at: Time, Date or String
59
- * features << AIXM::Feature
49
+ ```ruby
50
+ document = AIXM.document(
51
+ created_at: Time or Date or String
52
+ effective_at: Time or Date or String
53
+ )
54
+ document.features << AIXM::Feature
55
+ ```
60
56
 
61
- See [the API documentation](http://www.rubydoc.info/gems/aixm) for details and
62
- [spec/factory.rb](https://github.com/svoop/aixm/blob/master/spec/factory.rb) for
63
- examples.
57
+ See [the API documentation](http://www.rubydoc.info/gems/aixm) for details and [spec/factory.rb](https://github.com/svoop/aixm/blob/master/spec/factory.rb) for examples.
64
58
 
65
59
  #### Coordinate
66
60
 
@@ -94,77 +88,109 @@ All features are subclasses of `AIXM::Feature::Base`.
94
88
 
95
89
  #### Airspace
96
90
 
97
- * AIXM.airspace
98
- * name: String
99
- * short_name: String or *nil*
100
- * type: String or Symbol
101
- * schedule = AIXM.schedule
102
- * geometry << AIXM.point, AIXM.arc, AIXM.border or AIXM.circle
103
- * class_layers << AIXM.class_layer
104
- * remarks = String
91
+ ```ruby
92
+ airspace = AIXM.airspace(
93
+ name: String
94
+ short_name: String or nil
95
+ type: String or Symbol
96
+ )
97
+ airspace.schedule = AIXM.schedule
98
+ airspace.geometry << AIXM.point or AIXM.arc or AIXM.border or AIXM.circle
99
+ airspace.class_layers << AIXM.class_layer
100
+ airspace.remarks = String
101
+ ```
105
102
 
106
103
  #### Navigational Aids
107
104
 
108
105
  ##### Designated Point
109
106
 
110
- * AIXM.designated_point
111
- * id: String
112
- * name: String
113
- * xy: AIXM.xy
114
- * z: AIXM.z or *nil*
115
- * type: :icao, :adhp, :coordinates or :other
116
- * remarks = String
107
+ ```ruby
108
+ designated_point = AIXM.designated_point(
109
+ id: String
110
+ name: String
111
+ xy: AIXM.xy
112
+ z: AIXM.z or nil
113
+ type: :icao or :adhp, or :coordinates
114
+ )
115
+ designated_point.schedule = AIXM.schedule
116
+ designated_point.remarks = String
117
+ ```
117
118
 
118
119
  ##### DME
119
120
 
120
- * AIXM.dme
121
- * id: String
122
- * name: String
123
- * xy: AIXM.xy
124
- * z: AIXM.z or *nil*
125
- * channel: String
126
- * remarks = String
121
+ ```ruby
122
+ dme = AIXM.dme(
123
+ id: String
124
+ name: String
125
+ xy: AIXM.xy
126
+ z: AIXM.z or nil
127
+ channel: String
128
+ )
129
+ dme.schedule = AIXM.schedule
130
+ dme.remarks = String
131
+ ```
127
132
 
128
133
  ##### NDB
129
134
 
130
- * AIXM.ndb
131
- * id: String
132
- * name: String
133
- * xy: AIXM.xy
134
- * z: AIXM.z or *nil*
135
- * f: AIXM.f
136
- * remarks = String
135
+ ```ruby
136
+ ndb = AIXM.ndb(
137
+ id: String
138
+ name: String
139
+ xy: AIXM.xy
140
+ z: AIXM.z or nil
141
+ f: AIXM.f
142
+ )
143
+ ndb.schedule = AIXM.schedule
144
+ ndb.remarks = String
145
+ ```
137
146
 
138
147
  ##### Marker
139
148
 
140
- * AIXM.marker
141
- * id: String
142
- * name: String
143
- * xy: AIXM.xy
144
- * z: AIXM.z or *nil*
145
- * remarks = String
149
+ WARNING: Marker are not fully implemented because they usually have to be
150
+ associated with ILS which are not yet implemented.
151
+
152
+ ```ruby
153
+ marker = AIXM.marker(
154
+ id: String
155
+ name: String
156
+ xy: AIXM.xy
157
+ z: AIXM.z or nil
158
+ )
159
+ marker.schedule = AIXM.schedule
160
+ marker.remarks = String
161
+ ```
146
162
 
147
163
  ##### TACAN
148
164
 
149
- * AIXM.tacan
150
- * id: String
151
- * name: String
152
- * xy: AIXM.xy
153
- * z: AIXM.z or *nil*
154
- * channel: String
155
- * remarks = String
156
-
157
- ##### VOR and DVOR
158
-
159
- * AIXM.vor
160
- * id: String
161
- * name: String
162
- * xy: AIXM.xy
163
- * z: AIXM.z or *nil*
164
- * type: :vor or :vordme
165
- * f: AIXM.f
166
- * north: :geographic or :magnetic
167
- * remarks = String
165
+ ```ruby
166
+ tacan = AIXM.tacan(
167
+ id: String
168
+ name: String
169
+ xy: AIXM.xy
170
+ z: AIXM.z or nil
171
+ channel: String
172
+ )
173
+ tacan.schedule = AIXM.schedule
174
+ tacan.remarks = String
175
+ ```
176
+
177
+ ##### VOR
178
+
179
+ ```ruby
180
+ vor = AIXM.vor(
181
+ id: String
182
+ name: String
183
+ xy: AIXM.xy
184
+ z: AIXM.z or nil
185
+ type: :vor or :doppler_vor
186
+ f: AIXM.f
187
+ north: :geographic or :grid or :magnetic
188
+ )
189
+ vor.schedule = AIXM.schedule
190
+ vor.remarks = String
191
+ vor.associate_dme(channel: String) # turns the VOR into a VOR/DME
192
+ vor.associate_tacan(channel: String) # turns the VOR into a VORTAC
193
+ ```
168
194
 
169
195
  ### Components
170
196
 
@@ -172,66 +198,78 @@ All components are subclasses of `AIXM::Component::Base`.
172
198
 
173
199
  #### Schedule
174
200
 
175
- * AIXM.schedule
176
- * code: String or Symbol
201
+ ```ruby
202
+ schedule = AIXM.schedule(
203
+ code: String or Symbol
204
+ )
205
+ ```
177
206
 
178
207
  #### Class Layer
179
208
 
180
- * AIXM.class_layer
181
- * class: String or *nil*
182
- * vertical_limits: AIXM.vertical_limits
209
+ ```ruby
210
+ class_layer = AIXM.class_layer(
211
+ class: String or nil
212
+ vertical_limits: AIXM.vertical_limits
213
+ )
214
+ ```
183
215
 
184
216
  #### Vertical Limits
185
217
 
186
- * AIXM.vertical_limits
187
- * max_z: AIXM.z or *nil*
188
- * upper_z: AIXM.z
189
- * lower_z: AIXM.z
190
- * min_z: AIXM.z or *nil*
218
+ ```ruby
219
+ vertical_limits = AIXM.vertical_limits(
220
+ max_z: AIXM.z or nil
221
+ upper_z: AIXM.z
222
+ lower_z: AIXM.z
223
+ min_z: AIXM.z or nil
224
+ )
225
+ ```
191
226
 
192
227
  #### Point, Arc, Border and Circle
193
228
 
194
- * AIXM.point
195
- * xy: AIXM.xy
196
- * AIXM.arc
197
- * xy: AIXM.xy
198
- * center_xy: AIXM.xy
199
- * cloclwise: *true* or *false*
200
- * AIXM.border
201
- * xy: AIXM.xy
202
- * name: String
203
- * AIXM.circle
204
- * center_xy: AIXM.xy
205
- * radius: Numeric
229
+ ```ruby
230
+ point = AIXM.point(
231
+ xy: AIXM.xy
232
+ )
233
+ arc = AIXM.arc(
234
+ xy: AIXM.xy
235
+ center_xy: AIXM.xy
236
+ cloclwise: true or false
237
+ )
238
+ border = AIXM.border(
239
+ xy: AIXM.xy
240
+ name: String
241
+ )
242
+ circle = AIXM.circle(
243
+ center_xy: AIXM.xy
244
+ radius: Numeric
245
+ )
246
+ ```
206
247
 
207
248
  #### Geometry
208
249
 
209
- * AIXM.geometry
210
- * << AIXM.point, AIXM.arc, AIXM.border or AIXM.circle
250
+ ```ruby
251
+ geometry = AIXM.geometry
252
+ geometry << AIXM.point or AIXM.arc or AIXM.border or AIXM.circle
253
+ ```
211
254
 
212
255
  For a geometry to be complete, it must be comprised of either:
213
256
 
214
257
  * exactly one circle
215
- * at least three points, arcs or borders (the last of which a point with
216
- identical coordinates as the first)
258
+ * at least three points, arcs or borders (the last of which a point with identical coordinates as the first)
217
259
 
218
260
  ## Validation
219
261
 
220
- Use `AIXM::Document#complete?` to check whether all mandatory information is
221
- present. Airspaces, geometries etc have `complete?` methods as well.
262
+ Use `AIXM::Document#complete?` to check whether all mandatory information is present. Airspaces, geometries etc have `complete?` methods as well.
222
263
 
223
- Use `AIXM::Document#valid?` to validate the resulting AIXM against the XSD
224
- schema. If any, you find the errors in `AIXM::Document#errors`. Since the data
225
- model is not fully implemented, some associations cannot be assigned and have
226
- to be left empty. The resulting validation errors are silently ignored:
264
+ Use `AIXM::Document#valid?` to validate the resulting AIXM against the XSD schema. If any, you find the errors in `AIXM::Document#errors`. Since the data model is not fully implemented, some associations cannot be assigned and have to be left empty. The resulting validation errors are silently ignored:
227
265
 
228
266
  * OrgUid - organizations may be empty tags
229
267
 
230
268
  ## Rendering
231
269
 
232
270
  ```ruby
233
- document.to_xml # render AIXM 4.5 compliant XML
234
- document.to_xml(:ofm) # render AIXM 4.5 + OFM extensions XML
271
+ document.to_aixm # render AIXM 4.5 compliant XML
272
+ document.to_aixm(:ofm) # render AIXM 4.5 + OFM extensions XML
235
273
  ```
236
274
 
237
275
  ## Constants
@@ -252,16 +290,13 @@ By `using AIXM::Refinements` you get the following general purpose methods:
252
290
  * `Float#trim`<br>Convert whole numbers to Integer and leave all other untouched
253
291
  * `Float#to_km(from: unit)`<br>Convert a distance from *unit* (:km, :m, :nm or :ft) to km
254
292
 
255
- See the [source code](https://github.com/svoop/aixm/blob/master/lib/aixm/refinements.rb)
256
- for more explicit descriptions and examples.
293
+ See the [source code](https://github.com/svoop/aixm/blob/master/lib/aixm/refinements.rb) for more explicit descriptions and examples.
257
294
 
258
295
  ## Extensions
259
296
 
260
297
  ### OFM
261
298
 
262
- This extension adds proprietary tags and attributes (most of which are prefixed
263
- with `xt_`) aiming to improve importing the resulting AIXM into the OFM
264
- originative suite:
299
+ This extension adds proprietary tags and attributes (most of which are prefixed with `xt_`) aiming to improve importing the resulting AIXM into the OFM originative suite:
265
300
 
266
301
  * `<AIXM-Snapshot version="4.5 + OFM extensions of version 0.1" (...) />`<br>root node with extended version string
267
302
  * `<Ase xt_classLayersAvail="(true|false)">`<br>true when multiple class layers and therefore an Adg-node is present
@@ -278,8 +313,7 @@ originative suite:
278
313
 
279
314
  ## Tests
280
315
 
281
- Some tests are very time consuming and therefore skipped by default. To run the
282
- full test suite, set the environment variable:
316
+ Some tests are very time consuming and therefore skipped by default. To run the full test suite, set the environment variable:
283
317
 
284
318
  ```
285
319
  export SPEC_SCOPE=all
@@ -299,8 +333,7 @@ Please submit issues on:
299
333
 
300
334
  https://github.com/svoop/aixm/issues
301
335
 
302
- To contribute code, fork the project on Github, add your code and submit a
303
- pull request:
336
+ To contribute code, fork the project on Github, add your code and submit a pull request:
304
337
 
305
338
  https://help.github.com/articles/fork-a-repo
306
339
 
@@ -33,11 +33,11 @@ module AIXM
33
33
  end
34
34
 
35
35
  ##
36
- # Render AIXM
37
- def to_xml(*extensions)
36
+ # Render AIXM markup
37
+ def to_aixm(*extensions)
38
38
  builder = Builder::XmlMarkup.new(indent: 2)
39
39
  builder.codeClass(self.class.to_s) if self.class
40
- builder << vertical_limits.to_xml(*extensions)
40
+ builder << vertical_limits.to_aixm(*extensions)
41
41
  builder.target! # see https://github.com/jimweirich/builder/issues/42
42
42
  end
43
43
  end
@@ -46,9 +46,9 @@ module AIXM
46
46
  end
47
47
 
48
48
  ##
49
- # Render AIXM
50
- def to_xml(*extensions)
51
- @result_array.map { |h| h.to_xml(*extensions) }.join
49
+ # Render AIXM markup
50
+ def to_aixm(*extensions)
51
+ @result_array.map { |h| h.to_aixm(*extensions) }.join
52
52
  end
53
53
 
54
54
  private
@@ -30,8 +30,8 @@ module AIXM
30
30
  end
31
31
 
32
32
  ##
33
- # Render AIXM
34
- def to_xml(*extensions)
33
+ # Render AIXM markup
34
+ def to_aixm(*extensions)
35
35
  builder = Builder::XmlMarkup.new(indent: 2)
36
36
  builder.Avx do |avx|
37
37
  avx.codeType(clockwise? ? 'CWA' : 'CCA')
@@ -22,8 +22,8 @@ module AIXM
22
22
  end
23
23
 
24
24
  ##
25
- # Render AIXM
26
- def to_xml(*extensions)
25
+ # Render AIXM markup
26
+ def to_aixm(*extensions)
27
27
  builder = Builder::XmlMarkup.new(indent: 2)
28
28
  builder.Avx do |avx|
29
29
  avx.codeType('FNT')