aixm 0.3.7 → 0.3.8
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/.github/workflows/test.yml +26 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +17 -4
- data/README.md +23 -5
- data/lib/aixm/component/fato.rb +3 -3
- data/lib/aixm/component/frequency.rb +1 -1
- data/lib/aixm/component/geometry/border.rb +9 -3
- data/lib/aixm/component/helipad.rb +1 -1
- data/lib/aixm/component/lighting.rb +1 -1
- data/lib/aixm/component/runway.rb +4 -7
- data/lib/aixm/config.rb +2 -1
- data/lib/aixm/document.rb +1 -0
- data/lib/aixm/feature/address.rb +1 -1
- data/lib/aixm/feature/airport.rb +13 -4
- data/lib/aixm/feature/airspace.rb +11 -8
- data/lib/aixm/feature/navigational_aid/designated_point.rb +1 -1
- data/lib/aixm/feature/navigational_aid/dme.rb +1 -1
- data/lib/aixm/feature/navigational_aid/marker.rb +1 -1
- data/lib/aixm/feature/navigational_aid/ndb.rb +1 -1
- data/lib/aixm/feature/navigational_aid/tacan.rb +1 -1
- data/lib/aixm/feature/navigational_aid/vor.rb +1 -1
- data/lib/aixm/feature/obstacle.rb +1 -1
- data/lib/aixm/feature/obstacle_group.rb +1 -1
- data/lib/aixm/feature/organisation.rb +1 -1
- data/lib/aixm/feature/service.rb +1 -1
- data/lib/aixm/feature/unit.rb +1 -1
- data/lib/aixm/refinements.rb +39 -8
- data/lib/aixm/version.rb +1 -1
- data/rakefile.rb +22 -8
- data/spec/lib/aixm/a_spec.rb +55 -55
- data/spec/lib/aixm/component/fato_spec.rb +30 -23
- data/spec/lib/aixm/component/frequency_spec.rb +12 -13
- data/spec/lib/aixm/component/geometry/arc_spec.rb +7 -9
- data/spec/lib/aixm/component/geometry/border_spec.rb +8 -3
- data/spec/lib/aixm/component/geometry/circle_spec.rb +6 -8
- data/spec/lib/aixm/component/geometry/point_spec.rb +2 -4
- data/spec/lib/aixm/component/geometry_spec.rb +57 -62
- data/spec/lib/aixm/component/helipad_spec.rb +25 -19
- data/spec/lib/aixm/component/layer_spec.rb +17 -19
- data/spec/lib/aixm/component/lighting_spec.rb +21 -15
- data/spec/lib/aixm/component/runway_spec.rb +44 -37
- data/spec/lib/aixm/component/surface_spec.rb +24 -24
- data/spec/lib/aixm/component/timetable_spec.rb +7 -9
- data/spec/lib/aixm/component/vertical_limits_spec.rb +9 -12
- data/spec/lib/aixm/config_spec.rb +8 -8
- data/spec/lib/aixm/d_spec.rb +28 -28
- data/spec/lib/aixm/document_spec.rb +46 -37
- data/spec/lib/aixm/errors_spec.rb +2 -2
- data/spec/lib/aixm/f_spec.rb +16 -16
- data/spec/lib/aixm/feature/address_spec.rb +12 -7
- data/spec/lib/aixm/feature/airport_spec.rb +80 -74
- data/spec/lib/aixm/feature/airspace_spec.rb +32 -28
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +16 -11
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +22 -16
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +13 -7
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +15 -9
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +22 -16
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +21 -15
- data/spec/lib/aixm/feature/navigational_aid_spec.rb +6 -6
- data/spec/lib/aixm/feature/obstacle_group_spec.rb +25 -21
- data/spec/lib/aixm/feature/obstacle_spec.rb +47 -42
- data/spec/lib/aixm/feature/organisation_spec.rb +16 -10
- data/spec/lib/aixm/feature/service_spec.rb +9 -9
- data/spec/lib/aixm/feature/unit_spec.rb +21 -13
- data/spec/lib/aixm/feature_spec.rb +5 -5
- data/spec/lib/aixm/p_spec.rb +37 -37
- data/spec/lib/aixm/refinements_spec.rb +164 -115
- data/spec/lib/aixm/version_spec.rb +1 -1
- data/spec/lib/aixm/w_spec.rb +28 -28
- data/spec/lib/aixm/xy_spec.rb +34 -34
- data/spec/lib/aixm/z_spec.rb +19 -19
- data/spec/macros/marking.rb +3 -3
- data/spec/macros/organisation.rb +2 -2
- data/spec/macros/remarks.rb +3 -3
- data/spec/macros/timetable.rb +2 -2
- data/spec/macros/xy.rb +2 -2
- data/spec/macros/z_qnh.rb +2 -2
- data/spec/spec_helper.rb +7 -0
- metadata +3 -3
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca15626c3948c7f7914face0ccef421502a3b9103bba33bb9f8197696f083a2c
|
4
|
+
data.tar.gz: 8cd271b55758819f0593be1150d4a88484717a0221467c532f852aa011b270a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edee618c607d2e67ac4705a26ff4401f6479958ba84313f9fffc0ca8a3003f3110e8ddfe6a877333c2f29395eaa85cfdf3245c57bd4f3867d8bf48d26f1dc112
|
7
|
+
data.tar.gz: 60fe778dcbf871980ce4b477819be4e1d8a8b4e055365c00837dab226646b714b40f42edd40906acc9726f0f9cd29b4144a1a7506538349ef7e8bb5743146509
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby:
|
15
|
+
- 2.6.x
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v1
|
18
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
19
|
+
uses: actions/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
- name: Build and test
|
23
|
+
run: |
|
24
|
+
gem install bundler
|
25
|
+
bundle install --jobs 4 --retry 3
|
26
|
+
SPEC_SCOPE=all bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.6.
|
1
|
+
ruby-2.6.5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.3.8
|
2
|
+
|
3
|
+
#### Additions
|
4
|
+
* `AIXM.config.mid_region` to generate `mid` attributes on all features
|
5
|
+
* Refinement `String#insert_payload_hash`
|
6
|
+
|
7
|
+
#### Changes
|
8
|
+
* Fix calculation of magnetic bearing
|
9
|
+
|
1
10
|
## 0.3.7
|
2
11
|
|
3
12
|
#### Additions
|
@@ -37,14 +46,17 @@
|
|
37
46
|
* `Runway#preparation`, `Runway#condition` and `Runway#vfr_pattern`
|
38
47
|
* `Service#guessed_unit_type`
|
39
48
|
* Surface for `Runway|Helipad#surface`
|
40
|
-
* Extracted `AIXM::MIN`, `AIXM::SEC` and `AIXM::DMS_RE` to scan for coordinates
|
49
|
+
* Extracted `AIXM::MIN`, `AIXM::SEC` and `AIXM::DMS_RE` to scan for coordinates
|
50
|
+
in texts
|
41
51
|
* Refinement `String#payload_hash`
|
42
52
|
|
43
53
|
#### Breaking Changes
|
44
54
|
* Require Ruby 2.6
|
45
|
-
* Renamed `AIXM::H` to `AIXM::A` (angle) and add simple arithmetics to make it
|
55
|
+
* Renamed `AIXM::H` to `AIXM::A` (angle) and add simple arithmetics to make it
|
56
|
+
more versatile
|
46
57
|
* `Runway|Helipad#composition` moved to `Runway|Helipad#surface`
|
47
|
-
* DMS notation `{-}{DD}DMMSS{.SS}[NESW]` now requires compulsory cardinal
|
58
|
+
* DMS notation `{-}{DD}DMMSS{.SS}[NESW]` now requires compulsory cardinal
|
59
|
+
direction (N, E, S or W) at the end
|
48
60
|
|
49
61
|
#### Changes
|
50
62
|
* Service is a feature now
|
@@ -56,7 +68,8 @@
|
|
56
68
|
|
57
69
|
#### Changes
|
58
70
|
* Updated OFMX schema URI
|
59
|
-
* Added `eql?` and `hash` to `AIXM::XY|Z|D|H|F` to allow for instances of these
|
71
|
+
* Added `eql?` and `hash` to `AIXM::XY|Z|D|H|F` to allow for instances of these
|
72
|
+
classes to be used as Hash keys.
|
60
73
|
|
61
74
|
## 0.3.2
|
62
75
|
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[](https://rubygems.org/gems/aixm)
|
2
|
-
[](https://github.com/svoop/aixm/actions?workflow=Test)
|
3
3
|
[](https://codeclimate.com/github/svoop/aixm/)
|
4
4
|
[](https://donorbox.org/bitcetera)
|
5
5
|
|
@@ -15,7 +15,7 @@ For now, only the parts needed to automize the AIP import of [open flightmaps](h
|
|
15
15
|
|
16
16
|
## Install
|
17
17
|
|
18
|
-
Add this to your
|
18
|
+
Add this to your <tt>Gemfile</tt> or <tt>gems.rb</tt>:
|
19
19
|
|
20
20
|
```ruby
|
21
21
|
gem aixm
|
@@ -47,11 +47,12 @@ See `AIXM::CLASSES` for the complete list of shorthand names.
|
|
47
47
|
|
48
48
|
## Configuration
|
49
49
|
|
50
|
-
|
50
|
+
### AIXM.config.schema
|
51
|
+
|
52
|
+
The schema is either `:aixm` (default) or `:ofmx`:
|
51
53
|
|
52
54
|
```ruby
|
53
|
-
AIXM.config.schema
|
54
|
-
AIXM.config.ignored_errors # ignore XML schema errors which match this regex
|
55
|
+
AIXM.config.schema = :ofmx # =>:ofmx
|
55
56
|
```
|
56
57
|
|
57
58
|
There are shortcuts to set and get the schema:
|
@@ -65,6 +66,23 @@ AIXM.schema # => :ofmx
|
|
65
66
|
AIXM.schema(:version) # => 0
|
66
67
|
```
|
67
68
|
|
69
|
+
### AIXM.config.mid_region
|
70
|
+
|
71
|
+
In order to insert [OFMX-compliant `mid` attributes]() for all `*Uid` elements, set this configuration option to the OFMX region the element belongs to. By default, no `mid` attributes are inserted.
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
AIXM.config.mid_region # => nil - don't insert any mid attributes
|
75
|
+
AIXM.config.mid_region = 'LF' # => 'LF' - insert mid attributes for region LF
|
76
|
+
```
|
77
|
+
|
78
|
+
### AIXM.config.ignored_errors
|
79
|
+
|
80
|
+
In case you want to ignore certain XML schema validation errors, set this configuration option to a regular expression which matches the error messages to ignore. By default, no errors are ignored.
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
AIXM.config.ignored_errors = /invalid date/i
|
84
|
+
```
|
85
|
+
|
68
86
|
## Validation
|
69
87
|
|
70
88
|
`AIXM::Document#valid?` validates the resulting AIXM or OFMX against its XML schema. If any, you find the errors in `AIXM::Document#errors`.
|
data/lib/aixm/component/fato.rb
CHANGED
@@ -131,7 +131,7 @@ module AIXM
|
|
131
131
|
builder.FtoUid do |fto_uid|
|
132
132
|
fto_uid << airport.to_uid.indent(2)
|
133
133
|
fto_uid.txtDesig(name)
|
134
|
-
end
|
134
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
135
135
|
end
|
136
136
|
|
137
137
|
# @return [String] AIXM or OFMX markup
|
@@ -222,7 +222,7 @@ module AIXM
|
|
222
222
|
# @return [AIXM::A] magnetic orientation (magnetic bearing) in degrees
|
223
223
|
def magnetic_orientation
|
224
224
|
if geographic_orientation && fato.airport.declination
|
225
|
-
geographic_orientation
|
225
|
+
geographic_orientation - fato.airport.declination
|
226
226
|
end
|
227
227
|
end
|
228
228
|
|
@@ -232,7 +232,7 @@ module AIXM
|
|
232
232
|
builder.FdnUid do |fdn_uid|
|
233
233
|
fdn_uid << fato.to_uid.indent(2)
|
234
234
|
fdn_uid.txtDesig(name)
|
235
|
-
end
|
235
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
236
236
|
end
|
237
237
|
|
238
238
|
# @return [String] AIXM or OFMX markup
|
@@ -108,7 +108,7 @@ module AIXM
|
|
108
108
|
builder.FqyUid do |fqy_uid|
|
109
109
|
fqy_uid << service.to_uid.indent(2)
|
110
110
|
fqy_uid.valFreqTrans(transmission_f.freq)
|
111
|
-
end
|
111
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
112
112
|
end
|
113
113
|
|
114
114
|
# @return [String] AIXM or OFMX markup
|
@@ -33,13 +33,19 @@ module AIXM
|
|
33
33
|
@name = value
|
34
34
|
end
|
35
35
|
|
36
|
+
# @return [String] UID markup
|
37
|
+
def to_uid(as: :GbrUid)
|
38
|
+
builder = Builder::XmlMarkup.new(indent: 2)
|
39
|
+
builder.tag!(as) do |tag|
|
40
|
+
tag.txtName(name.to_s)
|
41
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
42
|
+
end
|
43
|
+
|
36
44
|
# @return [String] AIXM or OFMX markup
|
37
45
|
def to_xml
|
38
46
|
builder = Builder::XmlMarkup.new(indent: 2)
|
39
47
|
builder.Avx do |avx|
|
40
|
-
avx
|
41
|
-
gbr_uid.txtName(name.to_s)
|
42
|
-
end
|
48
|
+
avx << to_uid.indent(2)
|
43
49
|
avx.codeType('FNT')
|
44
50
|
avx.geoLat(xy.lat(AIXM.schema))
|
45
51
|
avx.geoLong(xy.long(AIXM.schema))
|
@@ -138,7 +138,7 @@ module AIXM
|
|
138
138
|
builder.RwyUid do |rwy_uid|
|
139
139
|
rwy_uid << airport.to_uid.indent(2)
|
140
140
|
rwy_uid.txtDesig(name)
|
141
|
-
end
|
141
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
142
142
|
end
|
143
143
|
|
144
144
|
# @return [String] AIXM or OFMX markup
|
@@ -277,7 +277,7 @@ module AIXM
|
|
277
277
|
# @return [AIXM::A] magnetic orientation (magnetic bearing) in degrees
|
278
278
|
def magnetic_orientation
|
279
279
|
if geographic_orientation && runway.airport.declination
|
280
|
-
geographic_orientation
|
280
|
+
geographic_orientation - runway.airport.declination
|
281
281
|
end
|
282
282
|
end
|
283
283
|
|
@@ -287,7 +287,7 @@ module AIXM
|
|
287
287
|
builder.RdnUid do |rdn_uid|
|
288
288
|
rdn_uid << runway.to_uid.indent(2)
|
289
289
|
rdn_uid.txtDesig(name)
|
290
|
-
end
|
290
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
291
291
|
end
|
292
292
|
|
293
293
|
# @return [String] AIXM or OFMX markup
|
@@ -309,10 +309,7 @@ module AIXM
|
|
309
309
|
if displaced_threshold
|
310
310
|
builder.Rdd do |rdd|
|
311
311
|
rdd.RddUid do |rdd_uid|
|
312
|
-
rdd_uid
|
313
|
-
rdn_uid << runway.to_uid.indent(6)
|
314
|
-
rdn_uid.txtDesig(name)
|
315
|
-
end
|
312
|
+
rdd_uid << to_uid.indent(4)
|
316
313
|
rdd_uid.codeType('DPLM')
|
317
314
|
rdd_uid.codeDayPeriod('A')
|
318
315
|
end
|
data/lib/aixm/config.rb
CHANGED
data/lib/aixm/document.rb
CHANGED
data/lib/aixm/feature/address.rb
CHANGED
@@ -81,7 +81,7 @@ module AIXM
|
|
81
81
|
tag << addressable.to_uid.indent(2) if addressable
|
82
82
|
tag.codeType(TYPES.key(type).to_s.then_if(AIXM.aixm?) { |t| t.sub(/-\w+$/, '') })
|
83
83
|
tag.noSeq(sequence)
|
84
|
-
end
|
84
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
85
85
|
end
|
86
86
|
|
87
87
|
# @return [String] AIXM or OFMX markup
|
data/lib/aixm/feature/airport.rb
CHANGED
@@ -74,6 +74,9 @@ module AIXM
|
|
74
74
|
# declination represents the magnetic north is to the right (aka: east)
|
75
75
|
# by this angle.
|
76
76
|
#
|
77
|
+
# To convert a magnetic bearing to the corresponding geographic (aka:
|
78
|
+
# true) bearing, the declination has to be added.
|
79
|
+
#
|
77
80
|
# @see https://en.wikipedia.org/wiki/Magnetic_declination
|
78
81
|
# @return [Float, nil] magnetic declination in degrees
|
79
82
|
attr_reader :declination
|
@@ -280,7 +283,15 @@ module AIXM
|
|
280
283
|
builder = Builder::XmlMarkup.new(indent: 2)
|
281
284
|
builder.tag!(as) do |tag|
|
282
285
|
tag.codeId(id)
|
283
|
-
end
|
286
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
287
|
+
end
|
288
|
+
|
289
|
+
# @return [String] UID markup
|
290
|
+
def to_wrapped_uid(as: :AhpUid, with:)
|
291
|
+
builder = Builder::XmlMarkup.new(indent: 2)
|
292
|
+
builder.tag!(with) do |tag|
|
293
|
+
tag << to_uid(as: as).indent(2)
|
294
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
284
295
|
end
|
285
296
|
|
286
297
|
# @return [String] AIXM or OFMX markup
|
@@ -322,9 +333,7 @@ module AIXM
|
|
322
333
|
end
|
323
334
|
if usage_limitations.any?
|
324
335
|
builder.Ahu do |ahu|
|
325
|
-
ahu
|
326
|
-
ahu_uid << to_uid.indent(4)
|
327
|
-
end
|
336
|
+
ahu << to_wrapped_uid(with: :AhuUid).indent(2)
|
328
337
|
usage_limitations.each do |usage_limitation|
|
329
338
|
ahu << usage_limitation.to_xml.indent(2)
|
330
339
|
end
|
@@ -136,7 +136,15 @@ module AIXM
|
|
136
136
|
builder.tag!(as) do |tag|
|
137
137
|
tag.codeType(TYPES.key(type).to_s)
|
138
138
|
tag.codeId(id)
|
139
|
-
end
|
139
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
140
|
+
end
|
141
|
+
|
142
|
+
# @return [String] UID markup
|
143
|
+
def to_wrapped_uid(as: :AseUid, with:)
|
144
|
+
builder = Builder::XmlMarkup.new(indent: 2)
|
145
|
+
builder.tag!(with) do |tag|
|
146
|
+
tag << to_uid(as: as).indent(2)
|
147
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
140
148
|
end
|
141
149
|
|
142
150
|
# @raise [AIXM::GeometryError] if the geometry is not closed
|
@@ -155,9 +163,7 @@ module AIXM
|
|
155
163
|
end
|
156
164
|
end
|
157
165
|
builder.Abd do |abd|
|
158
|
-
abd
|
159
|
-
abd_uid << to_uid.indent(4)
|
160
|
-
end
|
166
|
+
abd << to_wrapped_uid(with: :AbdUid).indent(2)
|
161
167
|
abd << geometry.to_xml.indent(2)
|
162
168
|
end
|
163
169
|
if layered?
|
@@ -169,9 +175,7 @@ module AIXM
|
|
169
175
|
ase << layers[index].to_xml.indent(2)
|
170
176
|
end
|
171
177
|
builder.Adg do |adg|
|
172
|
-
adg.AdgUid
|
173
|
-
adg_uid << layer_airspace.to_uid.indent(4)
|
174
|
-
end
|
178
|
+
adg << layer_airspace.to_wrapped_uid(with: :AdgUid).indent(2)
|
175
179
|
adg << to_uid(as: :AseUidSameExtent).indent(2)
|
176
180
|
end
|
177
181
|
end
|
@@ -184,7 +188,6 @@ module AIXM
|
|
184
188
|
def layered?
|
185
189
|
layers.count > 1
|
186
190
|
end
|
187
|
-
|
188
191
|
end
|
189
192
|
end
|
190
193
|
end
|
@@ -237,7 +237,7 @@ module AIXM
|
|
237
237
|
tag << obstacle_group.to_uid.indent(2) if AIXM.ofmx?
|
238
238
|
tag.geoLat((xy.lat(AIXM.schema)))
|
239
239
|
tag.geoLong((xy.long(AIXM.schema)))
|
240
|
-
end
|
240
|
+
end.insert_payload_hash(region: AIXM.config.mid_region)
|
241
241
|
end
|
242
242
|
|
243
243
|
# @return [String] AIXM or OFMX markup
|