aixm 0.3.8 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +1 -0
  3. data.tar.gz.sig +0 -0
  4. data/CHANGELOG.md +33 -3
  5. data/README.md +166 -56
  6. data/exe/ckmid +14 -0
  7. data/exe/mkmid +14 -0
  8. data/lib/aixm.rb +16 -6
  9. data/lib/aixm/association.rb +369 -0
  10. data/lib/aixm/classes.rb +43 -0
  11. data/lib/aixm/component/fato.rb +45 -53
  12. data/lib/aixm/component/frequency.rb +11 -12
  13. data/lib/aixm/component/geometry.rb +36 -38
  14. data/lib/aixm/component/geometry/arc.rb +2 -2
  15. data/lib/aixm/component/geometry/border.rb +6 -3
  16. data/lib/aixm/component/geometry/circle.rb +8 -2
  17. data/lib/aixm/component/geometry/point.rb +8 -2
  18. data/lib/aixm/component/helipad.rb +30 -38
  19. data/lib/aixm/component/layer.rb +28 -19
  20. data/lib/aixm/component/lighting.rb +12 -13
  21. data/lib/aixm/component/runway.rb +44 -48
  22. data/lib/aixm/{feature → component}/service.rb +37 -36
  23. data/lib/aixm/component/surface.rb +3 -3
  24. data/lib/aixm/component/timetable.rb +2 -2
  25. data/lib/aixm/component/{vertical_limits.rb → vertical_limit.rb} +12 -6
  26. data/lib/aixm/config.rb +2 -1
  27. data/lib/aixm/document.rb +27 -50
  28. data/lib/aixm/executables.rb +85 -0
  29. data/lib/aixm/feature.rb +13 -3
  30. data/lib/aixm/feature/address.rb +12 -13
  31. data/lib/aixm/feature/airport.rb +103 -128
  32. data/lib/aixm/feature/airspace.rb +44 -17
  33. data/lib/aixm/feature/navigational_aid.rb +7 -9
  34. data/lib/aixm/feature/navigational_aid/designated_point.rb +13 -15
  35. data/lib/aixm/feature/navigational_aid/dme.rb +11 -12
  36. data/lib/aixm/feature/navigational_aid/marker.rb +7 -3
  37. data/lib/aixm/feature/navigational_aid/ndb.rb +7 -3
  38. data/lib/aixm/feature/navigational_aid/tacan.rb +7 -3
  39. data/lib/aixm/feature/navigational_aid/vor.rb +23 -15
  40. data/lib/aixm/feature/obstacle.rb +29 -43
  41. data/lib/aixm/feature/obstacle_group.rb +37 -34
  42. data/lib/aixm/feature/organisation.rb +21 -5
  43. data/lib/aixm/feature/unit.rb +36 -46
  44. data/lib/aixm/memoize.rb +89 -0
  45. data/lib/aixm/object.rb +9 -0
  46. data/lib/aixm/payload_hash.rb +114 -0
  47. data/lib/aixm/refinements.rb +29 -76
  48. data/lib/aixm/shortcuts.rb +5 -42
  49. data/lib/aixm/version.rb +1 -1
  50. data/lib/aixm/xy.rb +1 -1
  51. data/schemas/ofmx/0/OFMX-Features.xsd +152 -20
  52. data/schemas/ofmx/0/OFMX-Snapshot.xsd +0 -5
  53. metadata +107 -156
  54. metadata.gz.sig +2 -0
  55. data/.github/workflows/test.yml +0 -26
  56. data/.gitignore +0 -6
  57. data/.ruby-version +0 -1
  58. data/.yardopts +0 -3
  59. data/Guardfile +0 -8
  60. data/aixm.gemspec +0 -35
  61. data/gems.rb +0 -3
  62. data/lib/aixm/component.rb +0 -6
  63. data/rakefile.rb +0 -36
  64. data/spec/factory.rb +0 -559
  65. data/spec/lib/aixm/a_spec.rb +0 -203
  66. data/spec/lib/aixm/component/fato_spec.rb +0 -267
  67. data/spec/lib/aixm/component/frequency_spec.rb +0 -74
  68. data/spec/lib/aixm/component/geometry/arc_spec.rb +0 -73
  69. data/spec/lib/aixm/component/geometry/border_spec.rb +0 -38
  70. data/spec/lib/aixm/component/geometry/circle_spec.rb +0 -68
  71. data/spec/lib/aixm/component/geometry/point_spec.rb +0 -37
  72. data/spec/lib/aixm/component/geometry_spec.rb +0 -316
  73. data/spec/lib/aixm/component/helipad_spec.rb +0 -193
  74. data/spec/lib/aixm/component/layer_spec.rb +0 -135
  75. data/spec/lib/aixm/component/lighting_spec.rb +0 -94
  76. data/spec/lib/aixm/component/runway_spec.rb +0 -479
  77. data/spec/lib/aixm/component/surface_spec.rb +0 -124
  78. data/spec/lib/aixm/component/timetable_spec.rb +0 -47
  79. data/spec/lib/aixm/component/vertical_limits_spec.rb +0 -94
  80. data/spec/lib/aixm/config_spec.rb +0 -41
  81. data/spec/lib/aixm/d_spec.rb +0 -150
  82. data/spec/lib/aixm/document_spec.rb +0 -1884
  83. data/spec/lib/aixm/errors_spec.rb +0 -14
  84. data/spec/lib/aixm/f_spec.rb +0 -85
  85. data/spec/lib/aixm/feature/address_spec.rb +0 -60
  86. data/spec/lib/aixm/feature/airport_spec.rb +0 -776
  87. data/spec/lib/aixm/feature/airspace_spec.rb +0 -394
  88. data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +0 -103
  89. data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +0 -98
  90. data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +0 -85
  91. data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +0 -95
  92. data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +0 -94
  93. data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +0 -251
  94. data/spec/lib/aixm/feature/navigational_aid_spec.rb +0 -52
  95. data/spec/lib/aixm/feature/obstacle_group_spec.rb +0 -330
  96. data/spec/lib/aixm/feature/obstacle_spec.rb +0 -284
  97. data/spec/lib/aixm/feature/organisation_spec.rb +0 -83
  98. data/spec/lib/aixm/feature/service_spec.rb +0 -59
  99. data/spec/lib/aixm/feature/unit_spec.rb +0 -238
  100. data/spec/lib/aixm/feature_spec.rb +0 -38
  101. data/spec/lib/aixm/p_spec.rb +0 -189
  102. data/spec/lib/aixm/refinements_spec.rb +0 -430
  103. data/spec/lib/aixm/version_spec.rb +0 -7
  104. data/spec/lib/aixm/w_spec.rb +0 -150
  105. data/spec/lib/aixm/xy_spec.rb +0 -180
  106. data/spec/lib/aixm/z_spec.rb +0 -94
  107. data/spec/macros/marking.rb +0 -12
  108. data/spec/macros/organisation.rb +0 -11
  109. data/spec/macros/remarks.rb +0 -12
  110. data/spec/macros/timetable.rb +0 -11
  111. data/spec/macros/xy.rb +0 -11
  112. data/spec/macros/z_qnh.rb +0 -11
  113. data/spec/sounds/failure.mp3 +0 -0
  114. data/spec/sounds/success.mp3 +0 -0
  115. data/spec/spec_helper.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca15626c3948c7f7914face0ccef421502a3b9103bba33bb9f8197696f083a2c
4
- data.tar.gz: 8cd271b55758819f0593be1150d4a88484717a0221467c532f852aa011b270a9
3
+ metadata.gz: e3f6bbccc417b5489c0406281f074c0e2ba763681f2ba93eecce13fc4512a5a3
4
+ data.tar.gz: 2ee3415fd70d683ed60911ddb78f3cd2fa2277aaeea5546cb3e22ab1c22b2d73
5
5
  SHA512:
6
- metadata.gz: edee618c607d2e67ac4705a26ff4401f6479958ba84313f9fffc0ca8a3003f3110e8ddfe6a877333c2f29395eaa85cfdf3245c57bd4f3867d8bf48d26f1dc112
7
- data.tar.gz: 60fe778dcbf871980ce4b477819be4e1d8a8b4e055365c00837dab226646b714b40f42edd40906acc9726f0f9cd29b4144a1a7506538349ef7e8bb5743146509
6
+ metadata.gz: c8105e111e3ee60f5ad28b99a2beccd05ce719297c9bb836cca7742dc4b6dec6187fd3cc32b2f09d3924deea35e863329350ca02db869079a2a0f0855a60a6d5
7
+ data.tar.gz: 5d620f1fb1d47d8a8e6f542029bba5e29d31db796baa6dba3c418d8aef0a6dd75e8996c95d68fa5f45187aae66119bf765af9ebc9d304c8179287c1bb395927c
@@ -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"�(_�ذ���#
Binary file
@@ -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 generate `mid` attributes on all features
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
- * Refinement `String#payload_hash`
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
  [![Version](https://img.shields.io/gem/v/aixm.svg?style=flat)](https://rubygems.org/gems/aixm)
2
- [![Tests](https://github.com/svoop/aixm/workflows/Test/badge.svg)](https://github.com/svoop/aixm/actions?workflow=Test)
2
+ [![Tests](https://img.shields.io/github/workflow/status/svoop/aixm/Test.svg?style=flat&label=tests)](https://github.com/svoop/aixm/actions?workflow=Test)
3
3
  [![Code Climate](https://img.shields.io/codeclimate/maintainability/svoop/aixm.svg?style=flat)](https://codeclimate.com/github/svoop/aixm/)
4
4
  [![Donorbox](https://img.shields.io/badge/donate-on_donorbox-yellow.svg)](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://github.com/openflightmaps/ofmx) for Ruby.
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](http://www.rubydoc.info/gems/aixm)
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
- Add this to your <tt>Gemfile</tt> or <tt>gems.rb</tt>:
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
- document.features << AIXM.designated_point(
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.aixm! # not really necessary since AIXM is the default schema
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.mid_region
97
+ ### AIXM.config.region
70
98
 
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.
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.config.mid_region # => nil - don't insert any mid attributes
75
- AIXM.config.mid_region = 'LF' # => 'LF' - insert mid attributes for region LF
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
- ## Validation
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](http://www.rubydoc.info/gems/aixm/AIXM/Document.html)
94
- * [XY (longitude and latitude)](http://www.rubydoc.info/gems/aixm/AIXM/XY.html)
95
- * [Z (height, elevation or altitude)](http://www.rubydoc.info/gems/aixm/AIXM/Z.html)
96
- * [D (distance or length)](http://www.rubydoc.info/gems/aixm/AIXM/D.html)
97
- * [F (frequency)](http://www.rubydoc.info/gems/aixm/AIXM/F.html)
98
- * [A (angle)](http://www.rubydoc.info/gems/aixm/AIXM/A.html)
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](http://www.rubydoc.info/gems/aixm/AIXM/Feature/Address.html)
102
- * [Organisation](http://www.rubydoc.info/gems/aixm/AIXM/Feature/Organisation.html)
103
- * [Unit](http://www.rubydoc.info/gems/aixm/AIXM/Feature/Unit.html)
104
- * [Service](http://www.rubydoc.info/gems/aixm/AIXM/Component/Service.html)
105
- * [Airport](http://www.rubydoc.info/gems/aixm/AIXM/Feature/Airport.html)
106
- * [Airspace](http://www.rubydoc.info/gems/aixm/AIXM/Feature/Airspace.html)
107
- * [Navigational aid](http://www.rubydoc.info/gems/aixm/AIXM/NavigationalAid.html)
108
- * [Designated point](http://www.rubydoc.info/gems/aixm/AIXM/Feature/DesignatedPoint.html)
109
- * [DME](http://www.rubydoc.info/gems/aixm/AIXM/Feature/DME.html)
110
- * [Marker](http://www.rubydoc.info/gems/aixm/AIXM/Feature/Marker.html)
111
- * [NDB](http://www.rubydoc.info/gems/aixm/AIXM/Feature/NDB.html)
112
- * [TACAN](http://www.rubydoc.info/gems/aixm/AIXM/Feature/TACAN.html)
113
- * [VOR](http://www.rubydoc.info/gems/aixm/AIXM/Feature/VOR.html)
114
- * [Obstacle and obstacle group](http://www.rubydoc.info/gems/aixm/AIXM/Feature/Obstacle.html)
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](http://www.rubydoc.info/gems/aixm/AIXM/Component/Frequency.html)
118
- * [Geometry](http://www.rubydoc.info/gems/aixm/AIXM/Component/Geometry.html)
119
- * [Point](http://www.rubydoc.info/gems/aixm/AIXM/Component/Point.html)
120
- * [Arc](http://www.rubydoc.info/gems/aixm/AIXM/Component/Arc.html)
121
- * [Border](http://www.rubydoc.info/gems/aixm/AIXM/Component/Border.html)
122
- * [Circle](http://www.rubydoc.info/gems/aixm/AIXM/Component/Circle.html)
123
- * [Runway](http://www.rubydoc.info/gems/aixm/AIXM/Component/Runway.html)
124
- * [Helipad](http://www.rubydoc.info/gems/aixm/AIXM/Component/Helipad.html)
125
- * [FATO](http://www.rubydoc.info/gems/aixm/AIXM/Component/FATO.html)
126
- * [Surface](http://www.rubydoc.info/gems/aixm/AIXM/Component/Surface.html)
127
- * [Layer](http://www.rubydoc.info/gems/aixm/AIXM/Component/Layer.html)
128
- * [Vertical limits](http://www.rubydoc.info/gems/aixm/AIXM/Component/VerticalLimits.html)
129
- * [Timetable](http://www.rubydoc.info/gems/aixm/AIXM/Component/Timetable.html)
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](http://www.rubydoc.info/gems/aixm/AIXM/Refinements.html).
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.github.io/ofmx/aixm/4.5/manual/aicm/)
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://github.com/openflightmaps/ofmx)
144
- * [OFMX documentation](https://github.com/openflightmaps/ofmx/wiki)
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
@@ -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
@@ -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
@@ -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/vertical_limits'
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'