aixm 0.2.3 → 0.3.0

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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.yardopts +3 -0
  5. data/CHANGELOG.md +34 -14
  6. data/Guardfile +1 -0
  7. data/README.md +64 -257
  8. data/lib/aixm.rb +16 -7
  9. data/lib/aixm/component.rb +6 -0
  10. data/lib/aixm/component/frequency.rb +135 -0
  11. data/lib/aixm/component/geometry.rb +34 -23
  12. data/lib/aixm/component/geometry/arc.rb +37 -22
  13. data/lib/aixm/component/geometry/border.rb +29 -20
  14. data/lib/aixm/component/geometry/circle.rb +39 -22
  15. data/lib/aixm/component/geometry/point.rb +29 -13
  16. data/lib/aixm/component/helipad.rb +154 -0
  17. data/lib/aixm/component/layer.rb +91 -0
  18. data/lib/aixm/component/runway.rb +294 -0
  19. data/lib/aixm/component/service.rb +170 -0
  20. data/lib/aixm/component/timetable.rb +65 -0
  21. data/lib/aixm/component/vertical_limits.rb +65 -29
  22. data/lib/aixm/config.rb +87 -0
  23. data/lib/aixm/document.rb +66 -42
  24. data/lib/aixm/errors.rb +11 -0
  25. data/lib/aixm/f.rb +34 -20
  26. data/lib/aixm/feature.rb +38 -0
  27. data/lib/aixm/feature/airport.rb +473 -0
  28. data/lib/aixm/feature/airspace.rb +145 -92
  29. data/lib/aixm/feature/navigational_aid.rb +94 -0
  30. data/lib/aixm/feature/navigational_aid/designated_point.rb +50 -54
  31. data/lib/aixm/feature/navigational_aid/dme.rb +48 -40
  32. data/lib/aixm/feature/navigational_aid/marker.rb +55 -45
  33. data/lib/aixm/feature/navigational_aid/ndb.rb +54 -50
  34. data/lib/aixm/feature/navigational_aid/tacan.rb +38 -31
  35. data/lib/aixm/feature/navigational_aid/vor.rb +84 -76
  36. data/lib/aixm/feature/organisation.rb +97 -0
  37. data/lib/aixm/feature/unit.rb +152 -0
  38. data/lib/aixm/refinements.rb +132 -47
  39. data/lib/aixm/shortcuts.rb +11 -6
  40. data/lib/aixm/version.rb +1 -1
  41. data/lib/aixm/xy.rb +64 -20
  42. data/lib/aixm/z.rb +51 -22
  43. data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-DataTypes.xsd +0 -0
  44. data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-Features.xsd +0 -0
  45. data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-Snapshot.xsd +0 -0
  46. data/schemas/ofmx/0/OFMX-DataTypes.xsd +5077 -0
  47. data/schemas/ofmx/0/OFMX-Features.xsd +9955 -0
  48. data/schemas/ofmx/0/OFMX-Snapshot.xsd +217 -0
  49. data/spec/factory.rb +209 -33
  50. data/spec/lib/aixm/component/frequency_spec.rb +75 -0
  51. data/spec/lib/aixm/component/geometry/arc_spec.rb +28 -22
  52. data/spec/lib/aixm/component/geometry/border_spec.rb +23 -20
  53. data/spec/lib/aixm/component/geometry/circle_spec.rb +31 -22
  54. data/spec/lib/aixm/component/geometry/point_spec.rb +11 -14
  55. data/spec/lib/aixm/component/geometry_spec.rb +150 -69
  56. data/spec/lib/aixm/component/helipad_spec.rb +136 -0
  57. data/spec/lib/aixm/component/layer_spec.rb +110 -0
  58. data/spec/lib/aixm/component/runway_spec.rb +402 -0
  59. data/spec/lib/aixm/component/service_spec.rb +61 -0
  60. data/spec/lib/aixm/component/timetable_spec.rb +49 -0
  61. data/spec/lib/aixm/component/vertical_limits_spec.rb +39 -20
  62. data/spec/lib/aixm/config_spec.rb +41 -0
  63. data/spec/lib/aixm/document_spec.rb +637 -147
  64. data/spec/lib/aixm/errors_spec.rb +14 -0
  65. data/spec/lib/aixm/f_spec.rb +17 -10
  66. data/spec/lib/aixm/feature/airport_spec.rb +546 -0
  67. data/spec/lib/aixm/feature/airspace_spec.rb +349 -226
  68. data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +47 -36
  69. data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +61 -36
  70. data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +61 -113
  71. data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +65 -79
  72. data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +57 -36
  73. data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +86 -112
  74. data/spec/lib/aixm/feature/navigational_aid_spec.rb +52 -0
  75. data/spec/lib/aixm/feature/organisation_spec.rb +77 -0
  76. data/spec/lib/aixm/feature/unit_spec.rb +227 -0
  77. data/spec/lib/aixm/feature_spec.rb +58 -0
  78. data/spec/lib/aixm/refinements_spec.rb +187 -178
  79. data/spec/lib/aixm/xy_spec.rb +45 -34
  80. data/spec/lib/aixm/z_spec.rb +19 -21
  81. data/spec/macros/organisation.rb +11 -0
  82. data/spec/macros/remarks.rb +12 -0
  83. data/spec/macros/timetable.rb +11 -0
  84. data/spec/macros/xy.rb +11 -0
  85. data/spec/macros/z_qnh.rb +11 -0
  86. data/spec/spec_helper.rb +26 -0
  87. metadata +60 -19
  88. data/lib/aixm/base.rb +0 -10
  89. data/lib/aixm/component/base.rb +0 -6
  90. data/lib/aixm/component/class_layer.rb +0 -46
  91. data/lib/aixm/component/geometry/base.rb +0 -8
  92. data/lib/aixm/component/schedule.rb +0 -43
  93. data/lib/aixm/feature/base.rb +0 -6
  94. data/lib/aixm/feature/navigational_aid/base.rb +0 -79
  95. data/spec/lib/aixm/component/class_layer_spec.rb +0 -74
  96. data/spec/lib/aixm/component/schedule_spec.rb +0 -33
  97. data/spec/lib/aixm/feature/navigational_aid/base_spec.rb +0 -41
@@ -1,21 +1,40 @@
1
+ using AIXM::Refinements
2
+
1
3
  module AIXM
2
- module Feature
3
- module NavigationalAid
4
+ class Feature
5
+ class NavigationalAid
4
6
 
5
- ##
6
- # DME (distance measuring equipment) operate in the frequency band
7
- # between 962 MHz and 1213 MHz.
7
+ # Distance measuring equipment (DME) is a transponder-based radio navigation
8
+ # technology which measures slant range distance by timing the propagation
9
+ # delay of VHF or UHF signals. They operate in the frequency band between
10
+ # 962 MHz and 1213 MHz.
11
+ #
12
+ # ===Cheat Sheet in Pseudo Code:
13
+ # dme = AIXM.dme(
14
+ # source: String or nil
15
+ # region: String or nil (falls back to AIXM.config.region)
16
+ # organisation: AIXM.organisation
17
+ # id: String
18
+ # name: String
19
+ # xy: AIXM.xy
20
+ # z: AIXM.z or nil
21
+ # channel: String
22
+ # )
23
+ # dme.timetable = AIXM.timetable or nil
24
+ # dme.remarks = String or nil
8
25
  #
9
- # https://en.wikipedia.org/wiki/Distance_measuring_equipment
10
- class DME < Base
11
- using AIXM::Refinements
26
+ # @see https://github.com/openflightmaps/ofmx/wiki/Navigational-aid#dme-dme
27
+ class DME < NavigationalAid
28
+ public_class_method :new
12
29
 
13
- attr_reader :channel, :vor
30
+ # @return [String] radio channel
31
+ attr_reader :channel
14
32
 
15
- public_class_method :new
33
+ # @return [AIXM::Feature::NavigationalAid::VOR, nil] associated VOR
34
+ attr_reader :vor
16
35
 
17
- def initialize(id:, name:, xy:, z: nil, channel:)
18
- super(id: id, name: name, xy: xy, z: z)
36
+ def initialize(channel:, **arguments)
37
+ super(**arguments)
19
38
  self.channel = channel
20
39
  end
21
40
 
@@ -28,46 +47,35 @@ module AIXM
28
47
  fail(ArgumentError, "invalid VOR") unless value.is_a? VOR
29
48
  @vor = value
30
49
  end
50
+ private :vor=
31
51
 
32
- ##
33
- # Digest to identify the payload
34
- def to_digest
35
- [super, channel].to_digest
36
- end
37
-
38
- ##
39
- # Render UID markup
40
- def to_uid(*extensions)
52
+ # @return [String] UID markup
53
+ def to_uid
41
54
  builder = Builder::XmlMarkup.new(indent: 2)
42
- builder.DmeUid({ mid: to_digest, newEntity: (true if extensions >> :ofm) }.compact) do |dmeuid|
43
- dmeuid.codeId(id)
44
- dmeuid.geoLat(xy.lat(format_for(*extensions)))
45
- dmeuid.geoLong(xy.long(format_for(*extensions)))
55
+ builder.DmeUid({ region: (region if AIXM.ofmx?) }.compact) do |dme_uid|
56
+ dme_uid.codeId(id)
57
+ dme_uid.geoLat(xy.lat(AIXM.schema))
58
+ dme_uid.geoLong(xy.long(AIXM.schema))
46
59
  end
47
60
  end
48
61
 
49
- ##
50
- # Render AIXM markup
51
- def to_aixm(*extensions)
52
- builder = to_builder(*extensions)
53
- builder.Dme do |dme|
54
- dme << to_uid(*extensions).indent(2)
55
- dme.OrgUid
56
- dme << vor.to_uid(*extensions).indent(2) if vor
62
+ # @return [String] AIXM or OFMX markup
63
+ def to_xml
64
+ builder = to_builder
65
+ builder.Dme({ source: (source if AIXM.ofmx?) }.compact) do |dme|
66
+ dme << to_uid.indent(2)
67
+ dme << organisation.to_uid.indent(2)
68
+ dme << vor.to_uid.indent(2) if vor
57
69
  dme.txtName(name) if name
58
70
  dme.codeChannel(channel)
59
71
  dme.codeDatum('WGE')
60
72
  if z
61
73
  dme.valElev(z.alt)
62
- dme.uomDistVer(z.unit.to_s)
63
- end
64
- if schedule
65
- dme.Dtt do |dtt|
66
- dtt << schedule.to_aixm(*extensions).indent(4)
67
- end
74
+ dme.uomDistVer(z.unit.upcase.to_s)
68
75
  end
76
+ dme << timetable.to_xml(as: :Dtt).indent(2) if timetable
69
77
  dme.txtRmk(remarks) if remarks
70
- dme.target! # see https://github.com/jimweirich/builder/issues/42
78
+ dme.target!
71
79
  end
72
80
  end
73
81
  end
@@ -1,82 +1,92 @@
1
+ using AIXM::Refinements
2
+
1
3
  module AIXM
2
- module Feature
3
- module NavigationalAid
4
+ class Feature
5
+ class NavigationalAid
4
6
 
5
- ##
6
- # Marker (marker beacons) operate on 75 MHz.
7
+ # Marker beacons guide an aircraft on a specific route e.g. towards a
8
+ # runway (which is why marker beacons are often part of an ILS). Their
9
+ # VHF radio beacons are transmitted on 75 MHz.
10
+ #
11
+ # ===Cheat Sheet in Pseudo Code:
12
+ # marker = AIXM.marker(
13
+ # source: String or nil
14
+ # region: String or nil (falls back to AIXM.config.region)
15
+ # organisation: AIXM.organisation
16
+ # id: String
17
+ # name: String
18
+ # xy: AIXM.xy
19
+ # z: AIXM.z or nil
20
+ # type: :outer or :middle or :inner or :backcourse
21
+ # )
22
+ # marker.timetable = AIXM.timetable or nil
23
+ # marker.remarks = String or nil
7
24
  #
8
- # Types:
9
- # * +:outer+ (+:O+) - outer marker
10
- # * +:middle+ (+:M+) - middle marker
11
- # * +:inner+ (+:I+) - inner marker
12
- # * +:backcourse+ (+:C+) - backcourse marker
25
+ # @note Marker are not fully implemented because they usually have to be
26
+ # associated with an ILS which are not implemented as of now.
13
27
  #
14
- # https://en.wikipedia.org/wiki/Marker_beacon
15
- class Marker < Base
16
- using AIXM::Refinements
28
+ # @see https://github.com/openflightmaps/ofmx/wiki/Navigational-aid#mkr-marker-beacon
29
+ class Marker < NavigationalAid
30
+ public_class_method :new
17
31
 
18
32
  TYPES = {
19
33
  O: :outer,
20
34
  M: :middle,
21
35
  I: :inner,
22
- C: :backcourse
36
+ C: :backcourse,
37
+ OTHER: :other # specify in remarks
23
38
  }
24
39
 
40
+ # @return [Symbol] type of marker (see {TYPES})
25
41
  attr_reader :type
26
42
 
27
- public_class_method :new
28
-
29
- # TODO: Marker require an associated ILS
30
- def initialize(id:, name:, xy:, z: nil, type:)
31
- super(id: id, name: name, xy: xy, z: z)
43
+ # TODO: Marker require an associated ILS (not yet implemented)
44
+ def initialize(type:, **arguments)
45
+ super(**arguments)
32
46
  self.type = type
33
47
  warn("WARNING: Maker is not fully implemented yet due to the lack of ILS")
34
48
  end
35
49
 
36
50
  def type=(value)
37
- @type = TYPES.lookup(value&.to_sym, nil) || fail(ArgumentError, "invalid type")
51
+ @type = value.nil? ? nil : TYPES.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid type")
38
52
  end
39
53
 
40
- def type_key
41
- TYPES.key(type)
42
- end
43
-
44
- ##
45
- # Render UID markup
46
- def to_uid(*extensions)
54
+ # @return [String] UID markup
55
+ def to_uid
47
56
  builder = Builder::XmlMarkup.new(indent: 2)
48
- builder.MkrUid({ mid: to_digest, newEntity: (true if extensions >> :ofm) }.compact) do |mkruid|
49
- mkruid.codeId(id)
50
- mkruid.geoLat(xy.lat(format_for(*extensions)))
51
- mkruid.geoLong(xy.long(format_for(*extensions)))
57
+ builder.MkrUid({ region: (region if AIXM.ofmx?) }.compact) do |mkr_uid|
58
+ mkr_uid.codeId(id)
59
+ mkr_uid.geoLat(xy.lat(AIXM.schema))
60
+ mkr_uid.geoLong(xy.long(AIXM.schema))
52
61
  end
53
62
  end
54
63
 
55
- ##
56
- # Render AIXM markup
57
- def to_aixm(*extensions)
58
- builder = to_builder(*extensions)
59
- builder.Mkr do |mkr|
60
- mkr << to_uid(*extensions).indent(2)
61
- mkr.OrgUid
62
- mkr.codePsnIls(type_key.to_s)
64
+ # @return [String] AIXM or OFMX markup
65
+ def to_xml
66
+ builder = to_builder
67
+ builder.Mkr({ source: (source if AIXM.ofmx?) }.compact) do |mkr|
68
+ mkr << to_uid.indent(2)
69
+ mkr << organisation.to_uid.indent(2)
70
+ mkr.codePsnIls(type_key.to_s) if type_key
63
71
  mkr.valFreq(75)
64
72
  mkr.uomFreq('MHZ')
65
73
  mkr.txtName(name) if name
66
74
  mkr.codeDatum('WGE')
67
75
  if z
68
76
  mkr.valElev(z.alt)
69
- mkr.uomDistVer(z.unit.to_s)
70
- end
71
- if schedule
72
- mkr.Mtt do |mtt|
73
- mtt << schedule.to_aixm(*extensions).indent(4)
74
- end
77
+ mkr.uomDistVer(z.unit.upcase.to_s)
75
78
  end
79
+ mkr << timetable.to_xml(as: :Mtt).indent(2) if timetable
76
80
  mkr.txtRmk(remarks) if remarks
77
- mkr.target! # see https://github.com/jimweirich/builder/issues/42
81
+ mkr.target!
78
82
  end
79
83
  end
84
+
85
+ private
86
+
87
+ def type_key
88
+ TYPES.key(type)
89
+ end
80
90
  end
81
91
 
82
92
  end
@@ -1,41 +1,51 @@
1
+ using AIXM::Refinements
2
+
1
3
  module AIXM
2
- module Feature
3
- module NavigationalAid
4
+ class Feature
5
+ class NavigationalAid
4
6
 
5
- ##
6
- # NDB (non-directional beacon) operate in the frequency band between
7
- # 190 kHz and 1750 kHz.
7
+ # A non-directional radio beacon (NDB) is a radio transmitter at a known
8
+ # location operating in the frequency band between 190 kHz and 1750 kHz.
8
9
  #
9
- # Types:
10
- # * +:en_route+ (+:B+) - high powered NDB
11
- # * +:locator+ (+:L+) - locator (low powered NDB)
12
- # * +:marine+ (+:M+) - marine beacon
10
+ # ===Cheat Sheet in Pseudo Code:
11
+ # ndb = AIXM.ndb(
12
+ # source: String or nil
13
+ # region: String or nil (falls back to AIXM.config.region)
14
+ # organisation: AIXM.organisation
15
+ # id: String
16
+ # name: String
17
+ # xy: AIXM.xy
18
+ # z: AIXM.z or nil
19
+ # type: TYPES
20
+ # f: AIXM.f
21
+ # )
22
+ # ndb.timetable = AIXM.timetable or nil
23
+ # ndb.remarks = String or nil
13
24
  #
14
- # https://en.wikipedia.org/wiki/Non-directional_beacon
15
- class NDB < Base
16
- using AIXM::Refinements
25
+ # @see https://github.com/openflightmaps/ofmx/wiki/Navigational-aid#ndb-ndb
26
+ class NDB < NavigationalAid
27
+ public_class_method :new
17
28
 
18
29
  TYPES = {
19
30
  B: :en_route,
20
31
  L: :locator,
21
- M: :marine
32
+ M: :marine,
33
+ OTHER: :other # specify in remarks
22
34
  }.freeze
23
35
 
24
- attr_reader :type, :f
36
+ # @return [Symbol, nil] type of NDB (see {TYPES})
37
+ attr_reader :type
25
38
 
26
- public_class_method :new
39
+ # @return [AIXM::F] radio frequency
40
+ attr_reader :f
27
41
 
28
- def initialize(id:, name:, xy:, z: nil, type:, f:)
29
- super(id: id, name: name, xy: xy, z: z)
42
+ def initialize(type:, f:, **arguments)
43
+ super(**arguments)
30
44
  self.type, self.f = type, f
31
45
  end
32
46
 
33
47
  def type=(value)
34
- @type = TYPES.lookup(value&.to_sym, nil) || fail(ArgumentError, "invalid type")
35
- end
36
-
37
- def type_key
38
- TYPES.key(type)
48
+ @type = value.nil? ? nil : TYPES.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid type")
39
49
  end
40
50
 
41
51
  def f=(value)
@@ -43,48 +53,42 @@ module AIXM
43
53
  @f = value
44
54
  end
45
55
 
46
- ##
47
- # Digest to identify the payload
48
- def to_digest
49
- [super, f.to_digest].to_digest
50
- end
51
-
52
- ##
53
- # Render UID markup
54
- def to_uid(*extensions)
56
+ # @return [String] UID markup
57
+ def to_uid
55
58
  builder = Builder::XmlMarkup.new(indent: 2)
56
- builder.NdbUid({ mid: to_digest, newEntity: (true if extensions >> :ofm) }.compact) do |ndbuid|
57
- ndbuid.codeId(id)
58
- ndbuid.geoLat(xy.lat(format_for(*extensions)))
59
- ndbuid.geoLong(xy.long(format_for(*extensions)))
59
+ builder.NdbUid({ region: (region if AIXM.ofmx?) }.compact) do |ndb_uid|
60
+ ndb_uid.codeId(id)
61
+ ndb_uid.geoLat(xy.lat(AIXM.schema))
62
+ ndb_uid.geoLong(xy.long(AIXM.schema))
60
63
  end
61
64
  end
62
65
 
63
- ##
64
- # Render AIXM markup
65
- def to_aixm(*extensions)
66
- builder = to_builder(*extensions)
67
- builder.Ndb do |ndb|
68
- ndb << to_uid(*extensions).indent(2)
69
- ndb.OrgUid
66
+ # @return [String] AIXM or OFMX markup
67
+ def to_xml
68
+ builder = to_builder
69
+ builder.Ndb({ source: (source if AIXM.ofmx?) }.compact) do |ndb|
70
+ ndb << to_uid.indent(2)
71
+ ndb << organisation.to_uid.indent(2)
70
72
  ndb.txtName(name) if name
71
73
  ndb.valFreq(f.freq.trim)
72
74
  ndb.uomFreq(f.unit.upcase.to_s)
73
- ndb.codeClass(type_key.to_s)
75
+ ndb.codeClass(type_key.to_s) if type
74
76
  ndb.codeDatum('WGE')
75
77
  if z
76
78
  ndb.valElev(z.alt)
77
- ndb.uomDistVer(z.unit.to_s)
78
- end
79
- if schedule
80
- ndb.Ntt do |ntt|
81
- ntt << schedule.to_aixm(*extensions).indent(4)
82
- end
79
+ ndb.uomDistVer(z.unit.upcase.to_s)
83
80
  end
81
+ ndb << timetable.to_xml(as: :Ntt).indent(2) if timetable
84
82
  ndb.txtRmk(remarks) if remarks
85
- ndb.target! # see https://github.com/jimweirich/builder/issues/42
83
+ ndb.target!
86
84
  end
87
85
  end
86
+
87
+ private
88
+
89
+ def type_key
90
+ TYPES.key(type)
91
+ end
88
92
  end
89
93
 
90
94
  end
@@ -1,51 +1,58 @@
1
+ using AIXM::Refinements
2
+
1
3
  module AIXM
2
- module Feature
3
- module NavigationalAid
4
+ class Feature
5
+ class NavigationalAid
4
6
 
5
- ##
6
- # TACAN (tactical air navigation system) can be used as a DME by civilian
7
- # aircraft and therefore operate in the frequency band between 960 MHz
8
- # and 1215 MHz.
7
+ # TACAN (tactical air navigation system) are military systems which also
8
+ # provide DME service to civilian aircraft and therefore operate in the
9
+ # frequency band between 960 MHz and 1215 MHz.
10
+ #
11
+ # ===Cheat Sheet in Pseudo Code:
12
+ # tacan = AIXM.tacan(
13
+ # source: String or nil
14
+ # region: String or nil (to use +AIXM.config.region+)
15
+ # organisation: AIXM.organisation
16
+ # id: String
17
+ # name: String
18
+ # xy: AIXM.xy
19
+ # z: AIXM.z or nil
20
+ # channel: String
21
+ # )
22
+ # tacan.timetable = AIXM.timetable or nil
23
+ # tacan.remarks = String or nil
9
24
  #
10
- # https://en.wikipedia.org/wiki/Tactical_air_navigation_system
25
+ # @see https://github.com/openflightmaps/ofmx/wiki/Navigational-aid#tcn-tacan
11
26
  class TACAN < DME
12
- using AIXM::Refinements
13
-
14
27
  public_class_method :new
15
28
 
16
- ##
17
- # Render UID markup
18
- def to_uid(*extensions)
29
+ # @return [String] UID markup
30
+ def to_uid
19
31
  builder = Builder::XmlMarkup.new(indent: 2)
20
- builder.TcnUid({ mid: to_digest, newEntity: (true if extensions >> :ofm) }.compact) do |tcnuid|
21
- tcnuid.codeId(id)
22
- tcnuid.geoLat(xy.lat(format_for(*extensions)))
23
- tcnuid.geoLong(xy.long(format_for(*extensions)))
32
+ builder.TcnUid({ region: (region if AIXM.ofmx?) }.compact) do |tcn_uid|
33
+ tcn_uid.codeId(id)
34
+ tcn_uid.geoLat(xy.lat(AIXM.schema))
35
+ tcn_uid.geoLong(xy.long(AIXM.schema))
24
36
  end
25
37
  end
26
38
 
27
- ##
28
- # Render AIXM markup
29
- def to_aixm(*extensions)
30
- builder = to_builder(*extensions)
31
- builder.Tcn do |tcn|
32
- tcn << to_uid(*extensions).indent(2)
33
- tcn.OrgUid
34
- tcn << vor.to_uid(*extensions).indent(2) if vor
39
+ # @return [String] AIXM or OFMX markup
40
+ def to_xml
41
+ builder = to_builder
42
+ builder.Tcn({ source: (source if AIXM.ofmx?) }.compact) do |tcn|
43
+ tcn << to_uid.indent(2)
44
+ tcn << organisation.to_uid.indent(2)
45
+ tcn << vor.to_uid.indent(2) if vor
35
46
  tcn.txtName(name) if name
36
47
  tcn.codeChannel(channel)
37
48
  tcn.codeDatum('WGE')
38
49
  if z
39
50
  tcn.valElev(z.alt)
40
- tcn.uomDistVer(z.unit.to_s)
41
- end
42
- if schedule
43
- tcn.Ttt do |ttt|
44
- ttt << schedule.to_aixm(*extensions).indent(4)
45
- end
51
+ tcn.uomDistVer(z.unit.upcase.to_s)
46
52
  end
53
+ tcn << timetable.to_xml(as: :Ttt).indent(2) if timetable
47
54
  tcn.txtRmk(remarks) if remarks
48
- tcn.target! # see https://github.com/jimweirich/builder/issues/42
55
+ tcn.target!
49
56
  end
50
57
  end
51
58
  end