aixm 0.3.8 → 0.3.10
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
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +33 -3
- data/README.md +166 -56
- data/exe/ckmid +14 -0
- data/exe/mkmid +14 -0
- data/lib/aixm.rb +16 -6
- data/lib/aixm/association.rb +369 -0
- data/lib/aixm/classes.rb +43 -0
- data/lib/aixm/component/fato.rb +45 -53
- data/lib/aixm/component/frequency.rb +11 -12
- data/lib/aixm/component/geometry.rb +36 -38
- data/lib/aixm/component/geometry/arc.rb +2 -2
- data/lib/aixm/component/geometry/border.rb +6 -3
- data/lib/aixm/component/geometry/circle.rb +8 -2
- data/lib/aixm/component/geometry/point.rb +8 -2
- data/lib/aixm/component/helipad.rb +30 -38
- data/lib/aixm/component/layer.rb +28 -19
- data/lib/aixm/component/lighting.rb +12 -13
- data/lib/aixm/component/runway.rb +44 -48
- data/lib/aixm/{feature → component}/service.rb +37 -36
- data/lib/aixm/component/surface.rb +3 -3
- data/lib/aixm/component/timetable.rb +2 -2
- data/lib/aixm/component/{vertical_limits.rb → vertical_limit.rb} +12 -6
- data/lib/aixm/config.rb +2 -1
- data/lib/aixm/document.rb +27 -50
- data/lib/aixm/executables.rb +85 -0
- data/lib/aixm/feature.rb +13 -3
- data/lib/aixm/feature/address.rb +12 -13
- data/lib/aixm/feature/airport.rb +103 -128
- data/lib/aixm/feature/airspace.rb +44 -17
- data/lib/aixm/feature/navigational_aid.rb +7 -9
- data/lib/aixm/feature/navigational_aid/designated_point.rb +13 -15
- data/lib/aixm/feature/navigational_aid/dme.rb +11 -12
- data/lib/aixm/feature/navigational_aid/marker.rb +7 -3
- data/lib/aixm/feature/navigational_aid/ndb.rb +7 -3
- data/lib/aixm/feature/navigational_aid/tacan.rb +7 -3
- data/lib/aixm/feature/navigational_aid/vor.rb +23 -15
- data/lib/aixm/feature/obstacle.rb +29 -43
- data/lib/aixm/feature/obstacle_group.rb +37 -34
- data/lib/aixm/feature/organisation.rb +21 -5
- data/lib/aixm/feature/unit.rb +36 -46
- data/lib/aixm/memoize.rb +89 -0
- data/lib/aixm/object.rb +9 -0
- data/lib/aixm/payload_hash.rb +114 -0
- data/lib/aixm/refinements.rb +29 -76
- data/lib/aixm/shortcuts.rb +5 -42
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm/xy.rb +1 -1
- data/schemas/ofmx/0/OFMX-Features.xsd +152 -20
- data/schemas/ofmx/0/OFMX-Snapshot.xsd +0 -5
- metadata +107 -156
- metadata.gz.sig +2 -0
- data/.github/workflows/test.yml +0 -26
- data/.gitignore +0 -6
- data/.ruby-version +0 -1
- data/.yardopts +0 -3
- data/Guardfile +0 -8
- data/aixm.gemspec +0 -35
- data/gems.rb +0 -3
- data/lib/aixm/component.rb +0 -6
- data/rakefile.rb +0 -36
- data/spec/factory.rb +0 -559
- data/spec/lib/aixm/a_spec.rb +0 -203
- data/spec/lib/aixm/component/fato_spec.rb +0 -267
- data/spec/lib/aixm/component/frequency_spec.rb +0 -74
- data/spec/lib/aixm/component/geometry/arc_spec.rb +0 -73
- data/spec/lib/aixm/component/geometry/border_spec.rb +0 -38
- data/spec/lib/aixm/component/geometry/circle_spec.rb +0 -68
- data/spec/lib/aixm/component/geometry/point_spec.rb +0 -37
- data/spec/lib/aixm/component/geometry_spec.rb +0 -316
- data/spec/lib/aixm/component/helipad_spec.rb +0 -193
- data/spec/lib/aixm/component/layer_spec.rb +0 -135
- data/spec/lib/aixm/component/lighting_spec.rb +0 -94
- data/spec/lib/aixm/component/runway_spec.rb +0 -479
- data/spec/lib/aixm/component/surface_spec.rb +0 -124
- data/spec/lib/aixm/component/timetable_spec.rb +0 -47
- data/spec/lib/aixm/component/vertical_limits_spec.rb +0 -94
- data/spec/lib/aixm/config_spec.rb +0 -41
- data/spec/lib/aixm/d_spec.rb +0 -150
- data/spec/lib/aixm/document_spec.rb +0 -1884
- data/spec/lib/aixm/errors_spec.rb +0 -14
- data/spec/lib/aixm/f_spec.rb +0 -85
- data/spec/lib/aixm/feature/address_spec.rb +0 -60
- data/spec/lib/aixm/feature/airport_spec.rb +0 -776
- data/spec/lib/aixm/feature/airspace_spec.rb +0 -394
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +0 -103
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +0 -98
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +0 -85
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +0 -95
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +0 -94
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +0 -251
- data/spec/lib/aixm/feature/navigational_aid_spec.rb +0 -52
- data/spec/lib/aixm/feature/obstacle_group_spec.rb +0 -330
- data/spec/lib/aixm/feature/obstacle_spec.rb +0 -284
- data/spec/lib/aixm/feature/organisation_spec.rb +0 -83
- data/spec/lib/aixm/feature/service_spec.rb +0 -59
- data/spec/lib/aixm/feature/unit_spec.rb +0 -238
- data/spec/lib/aixm/feature_spec.rb +0 -38
- data/spec/lib/aixm/p_spec.rb +0 -189
- data/spec/lib/aixm/refinements_spec.rb +0 -430
- data/spec/lib/aixm/version_spec.rb +0 -7
- data/spec/lib/aixm/w_spec.rb +0 -150
- data/spec/lib/aixm/xy_spec.rb +0 -180
- data/spec/lib/aixm/z_spec.rb +0 -94
- data/spec/macros/marking.rb +0 -12
- data/spec/macros/organisation.rb +0 -11
- data/spec/macros/remarks.rb +0 -12
- data/spec/macros/timetable.rb +0 -11
- data/spec/macros/xy.rb +0 -11
- data/spec/macros/z_qnh.rb +0 -11
- data/spec/sounds/failure.mp3 +0 -0
- data/spec/sounds/success.mp3 +0 -0
- data/spec/spec_helper.rb +0 -62
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3f6bbccc417b5489c0406281f074c0e2ba763681f2ba93eecce13fc4512a5a3
|
|
4
|
+
data.tar.gz: 2ee3415fd70d683ed60911ddb78f3cd2fa2277aaeea5546cb3e22ab1c22b2d73
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8105e111e3ee60f5ad28b99a2beccd05ce719297c9bb836cca7742dc4b6dec6187fd3cc32b2f09d3924deea35e863329350ca02db869079a2a0f0855a60a6d5
|
|
7
|
+
data.tar.gz: 5d620f1fb1d47d8a8e6f542029bba5e29d31db796baa6dba3c418d8aef0a6dd75e8996c95d68fa5f45187aae66119bf765af9ebc9d304c8179287c1bb395927c
|
checksums.yaml.gz.sig
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
��*;^ь�G�`��ِ.�%o+�����Z�P[~fRs��O7�ߘn(�8�.Yg����9�EV��&Et���ט�97��0�`�ɨ���lxtl����_;���ٮa�EO��@V��g���|H�n�lb7�J���'����Ui4%@J"�(_�ذ���#
|
data.tar.gz.sig
ADDED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
|
+
## 0.3.10
|
|
2
|
+
|
|
3
|
+
### Additions
|
|
4
|
+
* Proper `has_many` and `has_one` associations
|
|
5
|
+
* `AIXM::Association:Array#find_by|find|duplicate` on `has_many` associations
|
|
6
|
+
* `AIXM.config.mid` now defines whether `mid` attributes are inserted or not
|
|
7
|
+
provided the selected schema is OFMX
|
|
8
|
+
* `AIXM::Memoize` module
|
|
9
|
+
* `AIXM::PayloadHash` class
|
|
10
|
+
* `mkmid` executable to insert `mid` attributes into valid OFMX file
|
|
11
|
+
* `ckmid` executable to check `mid` attributes in an OFMX file
|
|
12
|
+
* `AIXM::Component::Geometry#point?|circle?|polygon?`
|
|
13
|
+
* `AIXM::Component::Layer#services`
|
|
14
|
+
|
|
15
|
+
### Breaking Changes
|
|
16
|
+
* Require Ruby 2.7
|
|
17
|
+
* Moved `region` attribute from `Document` back to features again
|
|
18
|
+
* Use `Document#add_feature` instead of `Document@features#<<`
|
|
19
|
+
* Use `Document@features#find` instead of `Document#select_features`
|
|
20
|
+
* Use `Airspace#add_layer` instead of `Airspace@layers#<<`
|
|
21
|
+
* Use `Geometry#add_segment` instead of `Geometry#<<`
|
|
22
|
+
* Renamed `VerticalLimits` to `VerticalLimit`
|
|
23
|
+
* Moved `AIXM::Feature::Service` to `AIXM::Component::Service`
|
|
24
|
+
* Refinements `String#insert_payload_hash` and `Array#to_uuid` removed again
|
|
25
|
+
* Refinement `String#payload_hash` removed in favor of `AIXM::PayloadHash` class
|
|
26
|
+
* Refinements `Array#find|duplicates` removed
|
|
27
|
+
|
|
28
|
+
### Changes
|
|
29
|
+
* Renamed `AIXM.config.mid_region` to `AIXM.config.region`
|
|
30
|
+
|
|
1
31
|
## 0.3.8
|
|
2
32
|
|
|
3
33
|
#### Additions
|
|
4
|
-
* `AIXM.config.mid_region` to
|
|
34
|
+
* `AIXM.config.mid_region` to insert `mid` attributes
|
|
5
35
|
* Refinement `String#insert_payload_hash`
|
|
6
36
|
|
|
7
37
|
#### Changes
|
|
@@ -48,7 +78,7 @@
|
|
|
48
78
|
* Surface for `Runway|Helipad#surface`
|
|
49
79
|
* Extracted `AIXM::MIN`, `AIXM::SEC` and `AIXM::DMS_RE` to scan for coordinates
|
|
50
80
|
in texts
|
|
51
|
-
*
|
|
81
|
+
* Refinements `Array#to_uuid` and `String#payload_hash`
|
|
52
82
|
|
|
53
83
|
#### Breaking Changes
|
|
54
84
|
* Require Ruby 2.6
|
|
@@ -94,7 +124,7 @@
|
|
|
94
124
|
#### Breaking Changes
|
|
95
125
|
* Renamed `Airport#code` to `Airport#id`
|
|
96
126
|
* Renamed `Airspace#short_name` to `Airspace#local_type`
|
|
97
|
-
* Moved `region` attribute from features to Document
|
|
127
|
+
* Moved `region` attribute from features to `Document`
|
|
98
128
|
|
|
99
129
|
#### Changes
|
|
100
130
|
* Be more permissive on `Airport#id` in order to accomodate generated codes
|
data/README.md
CHANGED
|
@@ -1,38 +1,66 @@
|
|
|
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
|
|
|
6
6
|
# AIXM
|
|
7
7
|
|
|
8
|
-
Partial implementation of the [Aeronautical Information Exchange Model (AIXM 4.5)](http://aixm.aero) and it's dialect [Open FlightMaps eXchange format (OFMX 0)](https://
|
|
8
|
+
Partial implementation of the [Aeronautical Information Exchange Model (AIXM 4.5)](http://aixm.aero) and it's dialect [Open FlightMaps eXchange format (OFMX 0)](https://gitlab.com/openflightmaps/ofmx/wikis) for Ruby.
|
|
9
9
|
|
|
10
10
|
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 for snapshot files and does not parse them.
|
|
11
11
|
|
|
12
12
|
* [Homepage](https://github.com/svoop/aixm)
|
|
13
|
-
* [API](
|
|
13
|
+
* [API](https://www.rubydoc.info/gems/aixm)
|
|
14
14
|
* Author: [Sven Schwyn - Bitcetera](http://www.bitcetera.com)
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### Security
|
|
19
|
+
|
|
20
|
+
This gem is [cryptographically signed](https://guides.rubygems.org/security/#using-gems) in order to assure it hasn't been tampered with. Unless already done, please add the author's public key as a trusted certificate now:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
gem cert --add <(curl -Ls https://raw.github.com/svoop/aixm/master/certs/svoop.pem)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Bundler
|
|
27
|
+
|
|
28
|
+
Add the following to the <tt>Gemfile</tt> or <tt>gems.rb</tt> of your [Bundler](https://bundler.io) powered Ruby project:
|
|
19
29
|
|
|
20
30
|
```ruby
|
|
21
31
|
gem aixm
|
|
22
32
|
```
|
|
23
33
|
|
|
34
|
+
And then install the bundle:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
bundle install --trust-policy MediumSecurity
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Standalone
|
|
41
|
+
|
|
42
|
+
If you're only going to use [the executables](#executables), make sure to have the [latest version of Ruby](https://www.ruby-lang.org/en/documentation/installation/) and then install this gem:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
gem install aixm --trust-policy MediumSecurity
|
|
46
|
+
```
|
|
47
|
+
|
|
24
48
|
## Usage
|
|
25
49
|
|
|
26
50
|
Here's how to build a document object, populate it with a simple feature and then render it as AIXM:
|
|
27
51
|
|
|
28
52
|
```ruby
|
|
29
|
-
document = AIXM.document
|
|
30
|
-
|
|
31
|
-
id: "ABIXI",
|
|
32
|
-
xy: AIXM.xy(lat: %q(46°31'54.3"N), long: %q(002°19'55.2"W)),
|
|
33
|
-
type: :icao
|
|
53
|
+
document = AIXM.document(
|
|
54
|
+
region: 'LF'
|
|
34
55
|
)
|
|
35
|
-
document.
|
|
56
|
+
document.add_feature(
|
|
57
|
+
AIXM.designated_point(
|
|
58
|
+
id: "ABIXI",
|
|
59
|
+
xy: AIXM.xy(lat: %q(46°31'54.3"N), long: %q(002°19'55.2"W)),
|
|
60
|
+
type: :icao
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
AIXM.ofmx!
|
|
36
64
|
document.to_xml
|
|
37
65
|
```
|
|
38
66
|
|
|
@@ -66,15 +94,29 @@ AIXM.schema # => :ofmx
|
|
|
66
94
|
AIXM.schema(:version) # => 0
|
|
67
95
|
```
|
|
68
96
|
|
|
69
|
-
### AIXM.config.
|
|
97
|
+
### AIXM.config.region
|
|
70
98
|
|
|
71
|
-
|
|
99
|
+
The `:ofmx` schema requires the [region to be set on all core features](https://gitlab.com/openflightmaps/ofmx/wikis/Features#core-features). You can do so on individual features, however, you might want to configure a default region to simplify your life:
|
|
72
100
|
|
|
73
101
|
```ruby
|
|
74
|
-
AIXM.
|
|
75
|
-
AIXM.
|
|
102
|
+
AIXM.ofmx!
|
|
103
|
+
AIXM.region = 'LF'
|
|
76
104
|
```
|
|
77
105
|
|
|
106
|
+
:warning: This setting has no effect when using the `:aixm` schema.
|
|
107
|
+
|
|
108
|
+
### AIXM.config.mid
|
|
109
|
+
|
|
110
|
+
In order to insert [OFMX-compliant `mid` attributes](https://gitlab.com/openflightmaps/ofmx/wikis/Features#mid) into all `*Uid` elements, you have set the mid configuration option to `true`.
|
|
111
|
+
|
|
112
|
+
```ruby
|
|
113
|
+
AIXM.ofmx!
|
|
114
|
+
AIXM.config.mid # => false - don't insert mid attributes by default
|
|
115
|
+
AIXM.config.mid = true # => true - insert mid attributes
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
:warning: This setting has no effect when using the `:aixm` schema.
|
|
119
|
+
|
|
78
120
|
### AIXM.config.ignored_errors
|
|
79
121
|
|
|
80
122
|
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.
|
|
@@ -83,65 +125,133 @@ In case you want to ignore certain XML schema validation errors, set this config
|
|
|
83
125
|
AIXM.config.ignored_errors = /invalid date/i
|
|
84
126
|
```
|
|
85
127
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
`AIXM::Document#valid?` validates the resulting AIXM or OFMX against its XML schema. If any, you find the errors in `AIXM::Document#errors`.
|
|
89
|
-
|
|
90
|
-
## Model
|
|
128
|
+
## Models
|
|
91
129
|
|
|
92
130
|
### Fundamentals
|
|
93
|
-
* [Document](
|
|
94
|
-
* [XY (longitude and latitude)](
|
|
95
|
-
* [Z (height, elevation or altitude)](
|
|
96
|
-
* [D (distance or length)](
|
|
97
|
-
* [F (frequency)](
|
|
98
|
-
* [A (angle)](
|
|
131
|
+
* [Document](https://www.rubydoc.info/gems/aixm/AIXM/Document.html)
|
|
132
|
+
* [XY (longitude and latitude)](https://www.rubydoc.info/gems/aixm/AIXM/XY.html)
|
|
133
|
+
* [Z (height, elevation or altitude)](https://www.rubydoc.info/gems/aixm/AIXM/Z.html)
|
|
134
|
+
* [D (distance or length)](https://www.rubydoc.info/gems/aixm/AIXM/D.html)
|
|
135
|
+
* [F (frequency)](https://www.rubydoc.info/gems/aixm/AIXM/F.html)
|
|
136
|
+
* [A (angle)](https://www.rubydoc.info/gems/aixm/AIXM/A.html)
|
|
99
137
|
|
|
100
138
|
### Features
|
|
101
|
-
* [Address](
|
|
102
|
-
* [Organisation](
|
|
103
|
-
* [Unit](
|
|
104
|
-
* [Service](
|
|
105
|
-
* [Airport](
|
|
106
|
-
* [Airspace](
|
|
107
|
-
* [Navigational aid](
|
|
108
|
-
* [Designated point](
|
|
109
|
-
* [DME](
|
|
110
|
-
* [Marker](
|
|
111
|
-
* [NDB](
|
|
112
|
-
* [TACAN](
|
|
113
|
-
* [VOR](
|
|
114
|
-
* [Obstacle and obstacle group](
|
|
139
|
+
* [Address](https://www.rubydoc.info/gems/aixm/AIXM/Feature/Address.html)
|
|
140
|
+
* [Organisation](https://www.rubydoc.info/gems/aixm/AIXM/Feature/Organisation.html)
|
|
141
|
+
* [Unit](https://www.rubydoc.info/gems/aixm/AIXM/Feature/Unit.html)
|
|
142
|
+
* [Service](https://www.rubydoc.info/gems/aixm/AIXM/Component/Service.html)
|
|
143
|
+
* [Airport](https://www.rubydoc.info/gems/aixm/AIXM/Feature/Airport.html)
|
|
144
|
+
* [Airspace](https://www.rubydoc.info/gems/aixm/AIXM/Feature/Airspace.html)
|
|
145
|
+
* [Navigational aid](https://www.rubydoc.info/gems/aixm/AIXM/NavigationalAid.html)
|
|
146
|
+
* [Designated point](https://www.rubydoc.info/gems/aixm/AIXM/Feature/DesignatedPoint.html)
|
|
147
|
+
* [DME](https://www.rubydoc.info/gems/aixm/AIXM/Feature/DME.html)
|
|
148
|
+
* [Marker](https://www.rubydoc.info/gems/aixm/AIXM/Feature/Marker.html)
|
|
149
|
+
* [NDB](https://www.rubydoc.info/gems/aixm/AIXM/Feature/NDB.html)
|
|
150
|
+
* [TACAN](https://www.rubydoc.info/gems/aixm/AIXM/Feature/TACAN.html)
|
|
151
|
+
* [VOR](https://www.rubydoc.info/gems/aixm/AIXM/Feature/VOR.html)
|
|
152
|
+
* [Obstacle and obstacle group](https://www.rubydoc.info/gems/aixm/AIXM/Feature/Obstacle.html)
|
|
115
153
|
|
|
116
154
|
### Components
|
|
117
|
-
* [Frequency](
|
|
118
|
-
* [Geometry](
|
|
119
|
-
* [Point](
|
|
120
|
-
* [Arc](
|
|
121
|
-
* [Border](
|
|
122
|
-
* [Circle](
|
|
123
|
-
* [Runway](
|
|
124
|
-
* [Helipad](
|
|
125
|
-
* [FATO](
|
|
126
|
-
* [Surface](
|
|
127
|
-
* [Layer](
|
|
128
|
-
* [Vertical
|
|
129
|
-
* [Timetable](
|
|
155
|
+
* [Frequency](https://www.rubydoc.info/gems/aixm/AIXM/Component/Frequency.html)
|
|
156
|
+
* [Geometry](https://www.rubydoc.info/gems/aixm/AIXM/Component/Geometry.html)
|
|
157
|
+
* [Point](https://www.rubydoc.info/gems/aixm/AIXM/Component/Point.html)
|
|
158
|
+
* [Arc](https://www.rubydoc.info/gems/aixm/AIXM/Component/Arc.html)
|
|
159
|
+
* [Border](https://www.rubydoc.info/gems/aixm/AIXM/Component/Border.html)
|
|
160
|
+
* [Circle](https://www.rubydoc.info/gems/aixm/AIXM/Component/Circle.html)
|
|
161
|
+
* [Runway](https://www.rubydoc.info/gems/aixm/AIXM/Component/Runway.html)
|
|
162
|
+
* [Helipad](https://www.rubydoc.info/gems/aixm/AIXM/Component/Helipad.html)
|
|
163
|
+
* [FATO](https://www.rubydoc.info/gems/aixm/AIXM/Component/FATO.html)
|
|
164
|
+
* [Surface](https://www.rubydoc.info/gems/aixm/AIXM/Component/Surface.html)
|
|
165
|
+
* [Layer](https://www.rubydoc.info/gems/aixm/AIXM/Component/Layer.html)
|
|
166
|
+
* [Vertical limit](https://www.rubydoc.info/gems/aixm/AIXM/Component/VerticalLimit.html)
|
|
167
|
+
* [Timetable](https://www.rubydoc.info/gems/aixm/AIXM/Component/Timetable.html)
|
|
168
|
+
|
|
169
|
+
## Associations
|
|
170
|
+
|
|
171
|
+
The different models are interwoven with [`has_many` and `has_one` associations](https://www.rubydoc.info/gems/aixm/AIXM/Association).
|
|
172
|
+
|
|
173
|
+
Please note that `has_many` associations are instances `AIXM::Association::Array` which mostly behave like normal arrays. However, you must not add or remove elements on the array directly but use the corresponding method on the associating model instead:
|
|
174
|
+
|
|
175
|
+
```ruby
|
|
176
|
+
document.features << airport # => NoMethodError
|
|
177
|
+
document.add_feature airport # okay
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### find_by and find
|
|
181
|
+
|
|
182
|
+
Use `find_by` on `has_many` to filter associations by class and optional attribute values:
|
|
183
|
+
|
|
184
|
+
```ruby
|
|
185
|
+
document.features.find_by(:airport) # => [#<AIXM::Feature::Airport>, #<AIXM::Feature::Airport>]
|
|
186
|
+
document.features.find_by(:airport, id: 'LFNT') # => [#<AIXM::Feature::Airport>]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
To search a `has_many` association for equal objects, use `find`:
|
|
190
|
+
|
|
191
|
+
```ruby
|
|
192
|
+
document.features.find(airport) # => [#<AIXM::Feature::Airport>]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
This may seem redundant at first, but keep in mind that two instances of +AIXM::CLASSES+ which implement `#to_uid` are considered equal if they are instances of the same class and both their UIDs as calculated by `#to_uid` are equal. Attributes which are not part of the `#to_uid` calculation are irrelevant!
|
|
196
|
+
|
|
197
|
+
### duplicates
|
|
198
|
+
|
|
199
|
+
Equally on `has_many` associations, use `duplicates` to find identical or equal associations:
|
|
200
|
+
|
|
201
|
+
```ruby
|
|
202
|
+
document.features.duplicates # => [#<AIXM::Feature::Unit>, #<AIXM::Component::Service>, ...]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Payload Hash
|
|
206
|
+
|
|
207
|
+
OFMX defines a [payload hash function](https://gitlab.com/openflightmaps/ofmx/wikis/Functions) used to facilitate association and modification tracking. It is used internally, but you can also use it in your own code:
|
|
208
|
+
|
|
209
|
+
```ruby
|
|
210
|
+
# Payload hash of XML fragment string
|
|
211
|
+
xml = '<xml><a></a></xml>'
|
|
212
|
+
AIXM::PayloadHash.new(xml).to_uuid
|
|
213
|
+
|
|
214
|
+
# Payload hash of Nokogiri XML fragment
|
|
215
|
+
document = File.open("file.xml") { Nokogiri::XML(_1) }
|
|
216
|
+
AIXM::PayloadHash.new(document).to_uuid
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Validation
|
|
220
|
+
|
|
221
|
+
`AIXM::Document#valid?` validates the resulting AIXM or OFMX against its XML schema. If any, you find the errors in `AIXM::Document#errors`.
|
|
130
222
|
|
|
131
223
|
## Refinements
|
|
132
224
|
|
|
133
|
-
By `using AIXM::Refinements` you get a few handy [extensions to Ruby core classes](
|
|
225
|
+
By `using AIXM::Refinements` you get a few handy [extensions to Ruby core classes](https://www.rubydoc.info/gems/aixm/AIXM/Refinements.html).
|
|
226
|
+
|
|
227
|
+
## Executables
|
|
228
|
+
|
|
229
|
+
### mkmid
|
|
230
|
+
|
|
231
|
+
The `mkmid` executable reads an OFMX file, adds [OFMX-compliant `mid` values](https://gitlab.com/openflightmaps/ofmx/wikis/Features#mid) into all `*Uid` elements and validates the result against the schema.
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
mkmid --help
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### ckmid
|
|
238
|
+
|
|
239
|
+
The `chmid` executable reads an OFMX file, validates it against the schema and checks all `mid` attributes for [OFMX-compliance](https://gitlab.com/openflightmaps/ofmx/wikis/Features#mid).
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
ckmid --help
|
|
243
|
+
```
|
|
134
244
|
|
|
135
245
|
## References
|
|
136
246
|
|
|
137
247
|
### AIXM
|
|
138
248
|
* [AIXM](http://aixm.aero)
|
|
139
|
-
* [AICM 4.5 documentation](https://openflightmaps.
|
|
249
|
+
* [AICM 4.5 documentation](https://openflightmaps.gitlab.io/ofmx/aixm/4.5/manual/aicm/)
|
|
140
250
|
* [AIXM 4.5 specification](http://aixm.aero/document/aixm-45-specification)
|
|
141
251
|
|
|
142
252
|
### OFMX
|
|
143
|
-
* [OFMX](https://
|
|
144
|
-
* [OFMX documentation](https://
|
|
253
|
+
* [OFMX](https://gitlab.com/openflightmaps/ofmx)
|
|
254
|
+
* [OFMX documentation](https://gitlab.com/openflightmaps/ofmx/wikis)
|
|
145
255
|
* [open flightmaps](https://openflightmaps.org)
|
|
146
256
|
|
|
147
257
|
## Tests
|
data/exe/ckmid
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# TODO: hide deprecations unless in gem root until fully complying with Ruby 2.7
|
|
4
|
+
Warning[:deprecated] = Dir.pwd.match? /aixm$/
|
|
5
|
+
|
|
6
|
+
require 'bundler/inline'
|
|
7
|
+
|
|
8
|
+
gemfile do
|
|
9
|
+
source 'https://rubygems.org'
|
|
10
|
+
ruby '>= 2.7'
|
|
11
|
+
gem 'aixm', '~> 0'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
AIXM::Executables::Ckmid.new.run
|
data/exe/mkmid
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# TODO: hide deprecations unless in gem root until fully complying with Ruby 2.7
|
|
4
|
+
Warning[:deprecated] = Dir.pwd.match? /aixm$/
|
|
5
|
+
|
|
6
|
+
require 'bundler/inline'
|
|
7
|
+
|
|
8
|
+
gemfile do
|
|
9
|
+
source 'https://rubygems.org'
|
|
10
|
+
ruby '>= 2.7'
|
|
11
|
+
gem 'aixm', '~> 0'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
AIXM::Executables::Mkmid.new.run
|
data/lib/aixm.rb
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
require 'builder'
|
|
2
1
|
require 'ostruct'
|
|
3
2
|
require 'securerandom'
|
|
4
|
-
require 'nokogiri'
|
|
5
3
|
require 'forwardable'
|
|
6
4
|
require 'digest'
|
|
7
5
|
require 'time'
|
|
8
6
|
require 'pathname'
|
|
7
|
+
require 'optparse'
|
|
8
|
+
|
|
9
|
+
require 'builder'
|
|
10
|
+
require 'nokogiri'
|
|
11
|
+
require 'dry/inflector'
|
|
12
|
+
|
|
13
|
+
require_relative 'aixm/object'
|
|
9
14
|
|
|
10
15
|
require_relative 'aixm/version'
|
|
11
|
-
require_relative 'aixm/constants'
|
|
12
16
|
require_relative 'aixm/refinements'
|
|
13
17
|
require_relative 'aixm/config'
|
|
14
18
|
require_relative 'aixm/errors'
|
|
15
19
|
|
|
20
|
+
require_relative 'aixm/classes'
|
|
21
|
+
require_relative 'aixm/constants'
|
|
22
|
+
require_relative 'aixm/memoize'
|
|
23
|
+
require_relative 'aixm/association'
|
|
24
|
+
require_relative 'aixm/payload_hash'
|
|
25
|
+
|
|
16
26
|
require_relative 'aixm/document'
|
|
17
27
|
require_relative 'aixm/xy'
|
|
18
28
|
require_relative 'aixm/z'
|
|
@@ -22,7 +32,7 @@ require_relative 'aixm/a'
|
|
|
22
32
|
require_relative 'aixm/w'
|
|
23
33
|
require_relative 'aixm/p'
|
|
24
34
|
|
|
25
|
-
require_relative 'aixm/component'
|
|
35
|
+
require_relative 'aixm/component/service'
|
|
26
36
|
require_relative 'aixm/component/frequency'
|
|
27
37
|
require_relative 'aixm/component/geometry'
|
|
28
38
|
require_relative 'aixm/component/geometry/point'
|
|
@@ -30,7 +40,7 @@ require_relative 'aixm/component/geometry/arc'
|
|
|
30
40
|
require_relative 'aixm/component/geometry/border'
|
|
31
41
|
require_relative 'aixm/component/geometry/circle'
|
|
32
42
|
require_relative 'aixm/component/layer'
|
|
33
|
-
require_relative 'aixm/component/
|
|
43
|
+
require_relative 'aixm/component/vertical_limit'
|
|
34
44
|
require_relative 'aixm/component/timetable'
|
|
35
45
|
require_relative 'aixm/component/runway'
|
|
36
46
|
require_relative 'aixm/component/fato'
|
|
@@ -42,7 +52,6 @@ require_relative 'aixm/feature'
|
|
|
42
52
|
require_relative 'aixm/feature/address'
|
|
43
53
|
require_relative 'aixm/feature/organisation'
|
|
44
54
|
require_relative 'aixm/feature/unit'
|
|
45
|
-
require_relative 'aixm/feature/service'
|
|
46
55
|
require_relative 'aixm/feature/airspace'
|
|
47
56
|
require_relative 'aixm/feature/airport'
|
|
48
57
|
require_relative 'aixm/feature/navigational_aid'
|
|
@@ -56,3 +65,4 @@ require_relative 'aixm/feature/obstacle'
|
|
|
56
65
|
require_relative 'aixm/feature/obstacle_group'
|
|
57
66
|
|
|
58
67
|
require_relative 'aixm/shortcuts'
|
|
68
|
+
require_relative 'aixm/executables'
|