aixm 1.2.1 → 1.3.1
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 +0 -0
- data/CHANGELOG.md +23 -3
- data/README.md +37 -2
- data/exe/ckmid +1 -7
- data/exe/mkmid +1 -7
- data/lib/aixm/classes.rb +3 -1
- data/lib/aixm/component/address.rb +12 -15
- data/lib/aixm/component/approach_lighting.rb +11 -16
- data/lib/aixm/component/fato.rb +22 -34
- data/lib/aixm/component/frequency.rb +10 -15
- data/lib/aixm/component/geometry/arc.rb +2 -3
- data/lib/aixm/component/geometry/border.rb +6 -10
- data/lib/aixm/component/geometry/circle.rb +4 -4
- data/lib/aixm/component/geometry/point.rb +4 -4
- data/lib/aixm/component/geometry/rhumb_line.rb +4 -4
- data/lib/aixm/component/geometry.rb +4 -4
- data/lib/aixm/component/helipad.rb +13 -20
- data/lib/aixm/component/layer.rb +6 -8
- data/lib/aixm/component/lighting.rb +12 -17
- data/lib/aixm/component/runway.rb +26 -38
- data/lib/aixm/component/service.rb +12 -16
- data/lib/aixm/component/surface.rb +8 -10
- data/lib/aixm/component/timesheet.rb +9 -10
- data/lib/aixm/component/timetable.rb +6 -7
- data/lib/aixm/component/vasis.rb +6 -8
- data/lib/aixm/component/vertical_limit.rb +8 -8
- data/lib/aixm/component.rb +3 -2
- data/lib/aixm/concerns/association.rb +381 -0
- data/lib/aixm/concerns/memoize.rb +107 -0
- data/lib/aixm/concerns/xml_builder.rb +34 -0
- data/lib/aixm/document.rb +52 -21
- data/lib/aixm/feature/airport.rb +44 -47
- data/lib/aixm/feature/airspace.rb +29 -34
- data/lib/aixm/feature/generic.rb +67 -0
- data/lib/aixm/feature/navigational_aid/designated_point.rb +11 -13
- data/lib/aixm/feature/navigational_aid/dme.rb +12 -15
- data/lib/aixm/feature/navigational_aid/marker.rb +12 -15
- data/lib/aixm/feature/navigational_aid/ndb.rb +13 -16
- data/lib/aixm/feature/navigational_aid/tacan.rb +15 -17
- data/lib/aixm/feature/navigational_aid/vor.rb +16 -19
- data/lib/aixm/feature/navigational_aid.rb +7 -7
- data/lib/aixm/feature/obstacle.rb +20 -21
- data/lib/aixm/feature/obstacle_group.rb +19 -20
- data/lib/aixm/feature/organisation.rb +11 -12
- data/lib/aixm/feature/unit.rb +16 -18
- data/lib/aixm/feature.rb +26 -7
- data/lib/aixm/object.rb +1 -1
- data/lib/aixm/refinements.rb +57 -0
- data/lib/aixm/schedule/date.rb +13 -1
- data/lib/aixm/schedule/date_time.rb +56 -0
- data/lib/aixm/schedule/time.rb +5 -1
- data/lib/aixm/shortcuts.rb +8 -2
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm.rb +5 -3
- data/schemas/ofmx/0.1/OFMX-Snapshot.xsd +6 -1
- data.tar.gz.sig +2 -3
- metadata +26 -38
- metadata.gz.sig +2 -3
- data/lib/aixm/association.rb +0 -378
- data/lib/aixm/memoize.rb +0 -105
data/lib/aixm/feature/airport.rb
CHANGED
@@ -23,6 +23,7 @@ module AIXM
|
|
23
23
|
# airport.timetable = AIXM.timetable or nil
|
24
24
|
# airport.operator = String or nil
|
25
25
|
# airport.remarks = String or nil
|
26
|
+
# airport.comment = Object or nil
|
26
27
|
# airport.add_runway(AIXM.runway)
|
27
28
|
# airport.add_fato(AIXM.fato)
|
28
29
|
# airport.add_helipad(AIXM.helipad)
|
@@ -36,8 +37,7 @@ module AIXM
|
|
36
37
|
#
|
37
38
|
# @see https://gitlab.com/openflightmaps/ofmx/wikis/Airport#ahp-airport
|
38
39
|
class Airport < Feature
|
39
|
-
include AIXM::Association
|
40
|
-
include AIXM::Memoize
|
40
|
+
include AIXM::Concerns::Association
|
41
41
|
include AIXM::Concerns::Timetable
|
42
42
|
include AIXM::Concerns::Remarks
|
43
43
|
|
@@ -269,81 +269,78 @@ module AIXM
|
|
269
269
|
@operator = value&.uptrans
|
270
270
|
end
|
271
271
|
|
272
|
-
#
|
273
|
-
def
|
274
|
-
builder
|
275
|
-
builder.tag!(as, ({ region: (region if AIXM.ofmx?) }.compact)) do |tag|
|
272
|
+
# @!visibility private
|
273
|
+
def add_uid_to(builder, as: :AhpUid)
|
274
|
+
builder.send(as, { region: (region if AIXM.ofmx?) }.compact) do |tag|
|
276
275
|
tag.codeId(id)
|
277
276
|
end
|
278
277
|
end
|
279
|
-
memoize :to_uid
|
280
278
|
|
281
|
-
#
|
282
|
-
def
|
283
|
-
builder
|
284
|
-
|
285
|
-
tag << to_uid(as: as).indent(2)
|
279
|
+
# @!visibility private
|
280
|
+
def add_wrapped_uid_to(builder, as: :AhpUid, with:)
|
281
|
+
builder.send(with) do |tag|
|
282
|
+
add_uid_to(builder, as: as)
|
286
283
|
end
|
287
284
|
end
|
288
285
|
|
289
|
-
#
|
290
|
-
def
|
291
|
-
builder
|
292
|
-
builder.
|
286
|
+
# @!visibility private
|
287
|
+
def add_to(builder)
|
288
|
+
builder.comment "Airport: #{id} #{name}".dress
|
289
|
+
builder.text "\n"
|
293
290
|
builder.Ahp({ source: (source if AIXM.ofmx?) }.compact) do |ahp|
|
294
|
-
ahp
|
295
|
-
ahp
|
291
|
+
ahp.comment(indented_comment) if comment
|
292
|
+
add_uid_to(ahp)
|
293
|
+
organisation.add_uid_to(ahp)
|
296
294
|
ahp.txtName(name)
|
297
295
|
ahp.codeIcao(id) if id.length == 4
|
298
296
|
ahp.codeIata(id) if id.length == 3
|
299
297
|
ahp.codeGps(gps) if AIXM.ofmx? && gps
|
300
|
-
ahp.codeType(TYPES.key(type)
|
298
|
+
ahp.codeType(TYPES.key(type)) if type
|
301
299
|
ahp.geoLat(xy.lat(AIXM.schema))
|
302
300
|
ahp.geoLong(xy.long(AIXM.schema))
|
303
301
|
ahp.codeDatum('WGE')
|
304
302
|
if z
|
305
303
|
ahp.valElev(z.alt)
|
306
|
-
ahp.uomDistVer(z.unit.upcase
|
304
|
+
ahp.uomDistVer(z.unit.upcase)
|
307
305
|
end
|
308
306
|
ahp.valMagVar(declination) if declination
|
309
307
|
ahp.txtNameAdmin(operator) if operator
|
310
308
|
if transition_z
|
311
309
|
ahp.valTransitionAlt(transition_z.alt)
|
312
|
-
ahp.uomTransitionAlt(transition_z.unit.upcase
|
310
|
+
ahp.uomTransitionAlt(transition_z.unit.upcase)
|
313
311
|
end
|
314
|
-
|
312
|
+
timetable.add_to(ahp, as: :Aht) if timetable
|
315
313
|
ahp.txtRmk(remarks) if remarks
|
316
314
|
end
|
317
315
|
runways.each do |runway|
|
318
|
-
|
316
|
+
runway.add_to(builder)
|
319
317
|
end
|
320
318
|
fatos.each do |fato|
|
321
|
-
|
319
|
+
fato.add_to(builder)
|
322
320
|
end
|
323
321
|
helipads.each do |helipad|
|
324
|
-
|
322
|
+
helipad.add_to(builder)
|
325
323
|
end
|
326
324
|
if usage_limitations.any?
|
327
325
|
builder.Ahu do |ahu|
|
328
|
-
ahu
|
326
|
+
add_wrapped_uid_to(ahu, with: :AhuUid)
|
329
327
|
usage_limitations.each do |usage_limitation|
|
330
|
-
|
328
|
+
usage_limitation.add_to(ahu)
|
331
329
|
end
|
332
330
|
end
|
333
331
|
end
|
334
332
|
addresses.each.with_object({}) do |address, sequences|
|
335
333
|
sequences[address.type] = (sequences[address.type] || 0) + 1
|
336
|
-
|
334
|
+
address.add_to(builder, as: :Aha, sequence: sequences[address.type])
|
337
335
|
end
|
338
336
|
services.each do |service|
|
339
337
|
builder.Sah do |sah|
|
340
338
|
sah.SahUid do |sah_uid|
|
341
|
-
sah_uid
|
342
|
-
|
339
|
+
add_uid_to(sah_uid)
|
340
|
+
service.add_uid_to(sah_uid)
|
343
341
|
end
|
344
342
|
end
|
345
343
|
end
|
346
|
-
builder.target!
|
347
344
|
end
|
348
345
|
|
349
346
|
# Limitations concerning the availability of an airport for certain flight
|
@@ -376,7 +373,8 @@ module AIXM
|
|
376
373
|
# @see AIXM::Feature::Airport#add_usage_limitation
|
377
374
|
# @see https://gitlab.com/openflightmaps/ofmx/wikis/Airport#ahu-airport-usage
|
378
375
|
class UsageLimitation
|
379
|
-
include AIXM::Association
|
376
|
+
include AIXM::Concerns::Association
|
377
|
+
include AIXM::Concerns::XMLBuilder
|
380
378
|
include AIXM::Concerns::Timetable
|
381
379
|
include AIXM::Concerns::Remarks
|
382
380
|
|
@@ -422,15 +420,14 @@ module AIXM
|
|
422
420
|
@type = TYPES.lookup(value&.to_s&.to_sym, nil) || fail(ArgumentError, "invalid type")
|
423
421
|
end
|
424
422
|
|
425
|
-
#
|
426
|
-
def
|
427
|
-
builder = Builder::XmlMarkup.new(indent: 2)
|
423
|
+
# @!visibility private
|
424
|
+
def add_to(builder)
|
428
425
|
builder.UsageLimitation do |usage_limitation|
|
429
|
-
usage_limitation.codeUsageLimitation(TYPES.key(type)
|
426
|
+
usage_limitation.codeUsageLimitation(TYPES.key(type))
|
430
427
|
conditions.each do |condition|
|
431
|
-
|
428
|
+
condition.add_to(usage_limitation)
|
432
429
|
end
|
433
|
-
|
430
|
+
timetable.add_to(usage_limitation, as: :Timetable) if timetable
|
434
431
|
usage_limitation.txtRmk(remarks) if remarks
|
435
432
|
end
|
436
433
|
end
|
@@ -441,7 +438,8 @@ module AIXM
|
|
441
438
|
# @see AIXM::Feature::Airport#add_usage_limitation
|
442
439
|
# @see https://gitlab.com/openflightmaps/ofmx/wikis/Airport#ahu-airport-usage
|
443
440
|
class Condition
|
444
|
-
include AIXM::Association
|
441
|
+
include AIXM::Concerns::Association
|
442
|
+
include AIXM::Concerns::XMLBuilder
|
445
443
|
|
446
444
|
AIRCRAFT = {
|
447
445
|
L: :landplane,
|
@@ -557,21 +555,20 @@ module AIXM
|
|
557
555
|
@purpose = value.nil? ? nil : PURPOSES.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid purpose")
|
558
556
|
end
|
559
557
|
|
560
|
-
#
|
561
|
-
def
|
562
|
-
builder = Builder::XmlMarkup.new(indent: 2)
|
558
|
+
# @!visibility private
|
559
|
+
def add_to(builder)
|
563
560
|
builder.UsageCondition do |usage_condition|
|
564
561
|
if aircraft
|
565
562
|
usage_condition.AircraftClass do |aircraft_class|
|
566
|
-
aircraft_class.codeType(AIRCRAFT.key(aircraft)
|
563
|
+
aircraft_class.codeType(AIRCRAFT.key(aircraft))
|
567
564
|
end
|
568
565
|
end
|
569
566
|
if rule || realm || origin || purpose
|
570
567
|
usage_condition.FlightClass do |flight_class|
|
571
|
-
flight_class.codeRule(RULES.key(rule)
|
572
|
-
flight_class.codeMil(REALMS.key(realm)
|
573
|
-
flight_class.codeOrigin(ORIGINS.key(origin)
|
574
|
-
flight_class.codePurpose(PURPOSES.key(purpose)
|
568
|
+
flight_class.codeRule(RULES.key(rule)) if rule
|
569
|
+
flight_class.codeMil(REALMS.key(realm)) if realm
|
570
|
+
flight_class.codeOrigin(ORIGINS.key(origin)) if origin
|
571
|
+
flight_class.codePurpose(PURPOSES.key(purpose)) if purpose
|
575
572
|
end
|
576
573
|
end
|
577
574
|
end
|
@@ -14,9 +14,12 @@ module AIXM
|
|
14
14
|
# local_type: String or nil
|
15
15
|
# name: String or nil
|
16
16
|
# )
|
17
|
+
# airspace.comment = Object or nil
|
17
18
|
# airspace.add_layer(AIXM.layer)
|
18
19
|
# airspace.geometry.add_segment(AIXM.point or AIXM.arc or AIXM.border or AIXM.circle)
|
19
20
|
#
|
21
|
+
# Timetables and remarks have to be set on the layer!
|
22
|
+
#
|
20
23
|
# The +id+ is mandatory, however, you may omit it when initializing a new
|
21
24
|
# airspace or assign +nil+ to an existing airspace which will generate a 8
|
22
25
|
# character digest from +type+, +local_type+ and +name+.
|
@@ -30,8 +33,7 @@ module AIXM
|
|
30
33
|
#
|
31
34
|
# @see https://gitlab.com/openflightmaps/ofmx/wikis/Airspace#ase-airspace
|
32
35
|
class Airspace < Feature
|
33
|
-
include AIXM::Association
|
34
|
-
include AIXM::Memoize
|
36
|
+
include AIXM::Concerns::Association
|
35
37
|
|
36
38
|
public_class_method :new
|
37
39
|
|
@@ -165,61 +167,55 @@ module AIXM
|
|
165
167
|
@name = value&.uptrans
|
166
168
|
end
|
167
169
|
|
168
|
-
#
|
169
|
-
def
|
170
|
-
builder
|
171
|
-
|
172
|
-
tag.codeType(TYPES.key(type).to_s)
|
170
|
+
# @!visibility private
|
171
|
+
def add_uid_to(builder, as: :AseUid)
|
172
|
+
builder.send(as, ({ region: (region if AIXM.ofmx?) }.compact)) do |tag|
|
173
|
+
tag.codeType(TYPES.key(type))
|
173
174
|
tag.codeId(id)
|
174
175
|
tag.txtLocalType(local_type) if AIXM.ofmx? && local_type && local_type != name
|
175
176
|
end
|
176
177
|
end
|
177
|
-
memoize :to_uid
|
178
178
|
|
179
|
-
#
|
180
|
-
def
|
181
|
-
builder
|
182
|
-
|
183
|
-
tag << to_uid(as: as).indent(2)
|
179
|
+
# @!visibility private
|
180
|
+
def add_wrapped_uid_to(builder, as: :AseUid, with:)
|
181
|
+
builder.send(with) do |tag|
|
182
|
+
add_uid_to(tag, as: as)
|
184
183
|
end
|
185
184
|
end
|
186
185
|
|
187
|
-
#
|
188
|
-
|
189
|
-
# @return [String] AIXM or OFMX markup
|
190
|
-
def to_xml
|
186
|
+
# @!visibility private
|
187
|
+
def add_to(builder)
|
191
188
|
fail(LayerError.new("no layers defined", self)) unless layers.any?
|
192
|
-
builder
|
193
|
-
builder.
|
189
|
+
builder.comment "Airspace: [#{TYPES.key(type)}] #{name || :UNNAMED}".dress
|
190
|
+
builder.text "\n"
|
194
191
|
builder.Ase({ source: (source if AIXM.ofmx?) }.compact) do |ase|
|
195
|
-
ase
|
192
|
+
ase.comment(indented_comment) if comment
|
193
|
+
add_uid_to(ase)
|
196
194
|
ase.txtLocalType(local_type) if AIXM.aixm? && local_type && local_type != name
|
197
195
|
ase.txtName(name) if name
|
198
|
-
unless layered?
|
199
|
-
ase << layers.first.to_xml.indent(2)
|
200
|
-
end
|
196
|
+
layers.first.add_to(ase) unless layered?
|
201
197
|
end
|
202
198
|
builder.Abd do |abd|
|
203
|
-
abd
|
204
|
-
|
199
|
+
add_wrapped_uid_to(abd, with: :AbdUid)
|
200
|
+
geometry.add_to(abd)
|
205
201
|
end
|
206
202
|
if layered?
|
207
203
|
layers.each.with_index do |layer, index|
|
208
204
|
layer_airspace = AIXM.airspace(region: region, type: 'CLASS', name: "#{name} LAYER #{index + 1}")
|
209
205
|
builder.Ase do |ase|
|
210
|
-
|
206
|
+
layer_airspace.add_uid_to(ase)
|
211
207
|
ase.txtName(layer_airspace.name)
|
212
|
-
|
208
|
+
layers[index].add_to(ase)
|
213
209
|
end
|
214
210
|
builder.Adg do |adg|
|
215
|
-
|
216
|
-
adg
|
211
|
+
layer_airspace.add_wrapped_uid_to(adg, with: :AdgUid)
|
212
|
+
add_uid_to(adg, as: :AseUidSameExtent)
|
217
213
|
end
|
218
214
|
layer.services.each do |service|
|
219
215
|
builder.Sae do |sae|
|
220
216
|
sae.SaeUid do |sae_uid|
|
221
|
-
|
222
|
-
|
217
|
+
service.add_uid_to(sae_uid)
|
218
|
+
layer_airspace.add_uid_to(sae_uid)
|
223
219
|
end
|
224
220
|
end
|
225
221
|
end
|
@@ -228,13 +224,12 @@ module AIXM
|
|
228
224
|
layers.first.services.each do |service|
|
229
225
|
builder.Sae do |sae|
|
230
226
|
sae.SaeUid do |sae_uid|
|
231
|
-
|
232
|
-
sae_uid
|
227
|
+
service.add_uid_to(sae_uid)
|
228
|
+
add_uid_to(sae_uid)
|
233
229
|
end
|
234
230
|
end
|
235
231
|
end
|
236
232
|
end
|
237
|
-
builder.target!
|
238
233
|
end
|
239
234
|
|
240
235
|
private
|
@@ -0,0 +1,67 @@
|
|
1
|
+
using AIXM::Refinements
|
2
|
+
|
3
|
+
module AIXM
|
4
|
+
class Feature
|
5
|
+
|
6
|
+
# Generic feature represented as XML document fragment.
|
7
|
+
#
|
8
|
+
# ===Cheat Sheet in Pseudo Code:
|
9
|
+
# generic = AIXM.generic(
|
10
|
+
# fragment: Nokogiri::XML::DocumentFragment or String
|
11
|
+
# )
|
12
|
+
class Generic < Feature
|
13
|
+
public_class_method :new
|
14
|
+
|
15
|
+
# XML document fragment
|
16
|
+
#
|
17
|
+
# @overload fragment
|
18
|
+
# @return [Nokogiri::XML::DocumentFragment]
|
19
|
+
# @overload fragment=(value)
|
20
|
+
# @param value [Nokogiri::XML::DocumentFragment, Object] XML document
|
21
|
+
# fragment or object which is converted to string and then parsed
|
22
|
+
attr_reader :fragment
|
23
|
+
|
24
|
+
# See the {cheat sheet}[AIXM::Feature::Generic] for examples on how to
|
25
|
+
# create instances of this class.
|
26
|
+
def initialize(source: nil, region: nil, fragment:)
|
27
|
+
super(source: source, region: region)
|
28
|
+
self.fragment = fragment
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [String]
|
32
|
+
def inspect
|
33
|
+
%Q(#<#{self.class} #{fragment.elements.first.name}>)
|
34
|
+
end
|
35
|
+
|
36
|
+
def fragment=(value)
|
37
|
+
@fragment = case value
|
38
|
+
when Nokogiri::XML::DocumentFragment then value
|
39
|
+
else Nokogiri::XML::DocumentFragment.parse(value.to_s)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Integer] pseudo UID fragment
|
44
|
+
def to_uid
|
45
|
+
fragment.to_xml.hash
|
46
|
+
end
|
47
|
+
|
48
|
+
# @!visibility private
|
49
|
+
def add_to(builder)
|
50
|
+
builder.comment "Generic".dress
|
51
|
+
builder.text "\n"
|
52
|
+
if comment
|
53
|
+
builder.comment(indented_comment)
|
54
|
+
builder.text "\n"
|
55
|
+
end
|
56
|
+
decorated_fragment = fragment.dup
|
57
|
+
if AIXM.ofmx?
|
58
|
+
decorated_fragment.css('*').each do |element|
|
59
|
+
element['region'] ||= region if element.name.match?(/Uid$/)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
builder << decorated_fragment.to_xml
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -18,11 +18,11 @@ module AIXM
|
|
18
18
|
# )
|
19
19
|
# designated_point.airport = AIXM.airport or nil
|
20
20
|
# designated_point.remarks = String or nil
|
21
|
+
# designated_point.comment = Object or nil
|
21
22
|
#
|
22
23
|
# @see https://gitlab.com/openflightmaps/ofmx/wikis/Navigational-aid#dpn-designated-point
|
23
24
|
class DesignatedPoint < NavigationalAid
|
24
|
-
include AIXM::Association
|
25
|
-
include AIXM::Memoize
|
25
|
+
include AIXM::Concerns::Association
|
26
26
|
|
27
27
|
public_class_method :new
|
28
28
|
|
@@ -60,28 +60,26 @@ module AIXM
|
|
60
60
|
@type = TYPES.lookup(value&.to_s&.to_sym, nil) || fail(ArgumentError, "invalid type")
|
61
61
|
end
|
62
62
|
|
63
|
-
#
|
64
|
-
def
|
65
|
-
builder = Builder::XmlMarkup.new(indent: 2)
|
63
|
+
# @!visibility private
|
64
|
+
def add_uid_to(builder)
|
66
65
|
builder.DpnUid({ region: (region if AIXM.ofmx?) }.compact) do |dpn_uid|
|
67
66
|
dpn_uid.codeId(id)
|
68
67
|
dpn_uid.geoLat(xy.lat(AIXM.schema))
|
69
68
|
dpn_uid.geoLong(xy.long(AIXM.schema))
|
70
69
|
end
|
71
70
|
end
|
72
|
-
memoize :to_uid
|
73
71
|
|
74
|
-
#
|
75
|
-
def
|
76
|
-
|
72
|
+
# @!visibility private
|
73
|
+
def add_to(builder)
|
74
|
+
super
|
77
75
|
builder.Dpn({ source: (source if AIXM.ofmx?) }.compact) do |dpn|
|
78
|
-
dpn
|
79
|
-
dpn
|
76
|
+
dpn.comment(indented_comment) if comment
|
77
|
+
add_uid_to(dpn)
|
78
|
+
airport.add_uid_to(dpn, as: :AhpUidAssoc) if airport
|
80
79
|
dpn.codeDatum('WGE')
|
81
|
-
dpn.codeType(AIXM.aixm? && type_key =~ /^VFR/ ? 'OTHER' : type_key
|
80
|
+
dpn.codeType(AIXM.aixm? && type_key =~ /^VFR/ ? 'OTHER' : type_key)
|
82
81
|
dpn.txtName(name) if name
|
83
82
|
dpn.txtRmk(remarks) if remarks
|
84
|
-
dpn.target!
|
85
83
|
end
|
86
84
|
end
|
87
85
|
|
@@ -23,11 +23,10 @@ module AIXM
|
|
23
23
|
# )
|
24
24
|
# dme.timetable = AIXM.timetable or nil
|
25
25
|
# dme.remarks = String or nil
|
26
|
+
# dme.comment = Object or nil
|
26
27
|
#
|
27
28
|
# @see https://gitlab.com/openflightmaps/ofmx/wikis/Navigational-aid#dme-dme
|
28
29
|
class DME < NavigationalAid
|
29
|
-
include AIXM::Memoize
|
30
|
-
|
31
30
|
public_class_method :new
|
32
31
|
|
33
32
|
CHANNEL_RE = /\A([1-9]|[1-9]\d|1[0-1]\d|12[0-6])[XY]\z/.freeze
|
@@ -93,24 +92,23 @@ module AIXM
|
|
93
92
|
end
|
94
93
|
end
|
95
94
|
|
96
|
-
#
|
97
|
-
def
|
98
|
-
builder = Builder::XmlMarkup.new(indent: 2)
|
95
|
+
# @!visibility private
|
96
|
+
def add_uid_to(builder)
|
99
97
|
builder.DmeUid({ region: (region if AIXM.ofmx?) }.compact) do |dme_uid|
|
100
98
|
dme_uid.codeId(id)
|
101
99
|
dme_uid.geoLat(xy.lat(AIXM.schema))
|
102
100
|
dme_uid.geoLong(xy.long(AIXM.schema))
|
103
101
|
end
|
104
102
|
end
|
105
|
-
memoize :to_uid
|
106
103
|
|
107
|
-
#
|
108
|
-
def
|
109
|
-
|
104
|
+
# @!visibility private
|
105
|
+
def add_to(builder)
|
106
|
+
super
|
110
107
|
builder.Dme({ source: (source if AIXM.ofmx?) }.compact) do |dme|
|
111
|
-
dme
|
112
|
-
dme
|
113
|
-
|
108
|
+
dme.comment(indented_comment) if comment
|
109
|
+
add_uid_to(dme)
|
110
|
+
organisation.add_uid_to(dme)
|
111
|
+
vor.add_uid_to(dme) if vor
|
114
112
|
dme.txtName(name) if name
|
115
113
|
dme.codeChannel(channel)
|
116
114
|
unless vor
|
@@ -120,11 +118,10 @@ module AIXM
|
|
120
118
|
dme.codeDatum('WGE')
|
121
119
|
if z
|
122
120
|
dme.valElev(z.alt)
|
123
|
-
dme.uomDistVer(z.unit.upcase
|
121
|
+
dme.uomDistVer(z.unit.upcase)
|
124
122
|
end
|
125
|
-
|
123
|
+
timetable.add_to(dme, as: :Dtt) if timetable
|
126
124
|
dme.txtRmk(remarks) if remarks
|
127
|
-
dme.target!
|
128
125
|
end
|
129
126
|
end
|
130
127
|
end
|
@@ -21,14 +21,13 @@ module AIXM
|
|
21
21
|
# )
|
22
22
|
# marker.timetable = AIXM.timetable or nil
|
23
23
|
# marker.remarks = String or nil
|
24
|
+
# marker.comment = Object or nil
|
24
25
|
#
|
25
26
|
# @note Marker are not fully implemented because they usually have to be
|
26
27
|
# associated with an ILS which are not implemented as of now.
|
27
28
|
#
|
28
29
|
# @see https://gitlab.com/openflightmaps/ofmx/wikis/Navigational-aid#mkr-marker-beacon
|
29
30
|
class Marker < NavigationalAid
|
30
|
-
include AIXM::Memoize
|
31
|
-
|
32
31
|
public_class_method :new
|
33
32
|
|
34
33
|
TYPES = {
|
@@ -60,35 +59,33 @@ module AIXM
|
|
60
59
|
@type = value.nil? ? nil : TYPES.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid type")
|
61
60
|
end
|
62
61
|
|
63
|
-
#
|
64
|
-
def
|
65
|
-
builder = Builder::XmlMarkup.new(indent: 2)
|
62
|
+
# @!visibility private
|
63
|
+
def add_uid_to(builder)
|
66
64
|
builder.MkrUid({ region: (region if AIXM.ofmx?) }.compact) do |mkr_uid|
|
67
65
|
mkr_uid.codeId(id)
|
68
66
|
mkr_uid.geoLat(xy.lat(AIXM.schema))
|
69
67
|
mkr_uid.geoLong(xy.long(AIXM.schema))
|
70
68
|
end
|
71
69
|
end
|
72
|
-
memoize :to_uid
|
73
70
|
|
74
|
-
#
|
75
|
-
def
|
76
|
-
|
71
|
+
# @!visibility private
|
72
|
+
def add_to(builder)
|
73
|
+
super
|
77
74
|
builder.Mkr({ source: (source if AIXM.ofmx?) }.compact) do |mkr|
|
78
|
-
mkr
|
79
|
-
mkr
|
80
|
-
|
75
|
+
mkr.comment(indented_comment) if comment
|
76
|
+
add_uid_to(mkr)
|
77
|
+
organisation.add_uid_to(mkr)
|
78
|
+
mkr.codePsnIls(type_key) if type_key
|
81
79
|
mkr.valFreq(75)
|
82
80
|
mkr.uomFreq('MHZ')
|
83
81
|
mkr.txtName(name) if name
|
84
82
|
mkr.codeDatum('WGE')
|
85
83
|
if z
|
86
84
|
mkr.valElev(z.alt)
|
87
|
-
mkr.uomDistVer(z.unit.upcase
|
85
|
+
mkr.uomDistVer(z.unit.upcase)
|
88
86
|
end
|
89
|
-
|
87
|
+
timetable.add_to(mkr, as: :Mtt) if timetable
|
90
88
|
mkr.txtRmk(remarks) if remarks
|
91
|
-
mkr.target!
|
92
89
|
end
|
93
90
|
end
|
94
91
|
|
@@ -21,11 +21,10 @@ module AIXM
|
|
21
21
|
# )
|
22
22
|
# ndb.timetable = AIXM.timetable or nil
|
23
23
|
# ndb.remarks = String or nil
|
24
|
+
# ndb.comment = Object or nil
|
24
25
|
#
|
25
26
|
# @see https://gitlab.com/openflightmaps/ofmx/wikis/Navigational-aid#ndb-ndb
|
26
27
|
class NDB < NavigationalAid
|
27
|
-
include AIXM::Memoize
|
28
|
-
|
29
28
|
public_class_method :new
|
30
29
|
|
31
30
|
TYPES = {
|
@@ -67,35 +66,33 @@ module AIXM
|
|
67
66
|
@f = value
|
68
67
|
end
|
69
68
|
|
70
|
-
#
|
71
|
-
def
|
72
|
-
builder = Builder::XmlMarkup.new(indent: 2)
|
69
|
+
# @!visibility private
|
70
|
+
def add_uid_to(builder)
|
73
71
|
builder.NdbUid({ region: (region if AIXM.ofmx?) }.compact) do |ndb_uid|
|
74
72
|
ndb_uid.codeId(id)
|
75
73
|
ndb_uid.geoLat(xy.lat(AIXM.schema))
|
76
74
|
ndb_uid.geoLong(xy.long(AIXM.schema))
|
77
75
|
end
|
78
76
|
end
|
79
|
-
memoize :to_uid
|
80
77
|
|
81
|
-
#
|
82
|
-
def
|
83
|
-
|
78
|
+
# @!visibility private
|
79
|
+
def add_to(builder)
|
80
|
+
super
|
84
81
|
builder.Ndb({ source: (source if AIXM.ofmx?) }.compact) do |ndb|
|
85
|
-
ndb
|
86
|
-
ndb
|
82
|
+
ndb.comment(indented_comment) if comment
|
83
|
+
add_uid_to(ndb)
|
84
|
+
organisation.add_uid_to(ndb)
|
87
85
|
ndb.txtName(name) if name
|
88
86
|
ndb.valFreq(f.freq.trim)
|
89
|
-
ndb.uomFreq(f.unit.upcase
|
90
|
-
ndb.codeClass(type_key
|
87
|
+
ndb.uomFreq(f.unit.upcase)
|
88
|
+
ndb.codeClass(type_key) if type
|
91
89
|
ndb.codeDatum('WGE')
|
92
90
|
if z
|
93
91
|
ndb.valElev(z.alt)
|
94
|
-
ndb.uomDistVer(z.unit.upcase
|
92
|
+
ndb.uomDistVer(z.unit.upcase)
|
95
93
|
end
|
96
|
-
|
94
|
+
timetable.add_to(ndb, as: :Ntt) if timetable
|
97
95
|
ndb.txtRmk(remarks) if remarks
|
98
|
-
ndb.target!
|
99
96
|
end
|
100
97
|
end
|
101
98
|
|