lib/aixm/component/helipad.rb in aixm-1.2.1 vs lib/aixm/component/helipad.rb in aixm-1.3.0

- old
+ new

@@ -21,12 +21,11 @@ # helipad.status = STATUSES or nil # helipad.remarks = String or nil # # @see https://gitlab.com/openflightmaps/ofmx/wikis/Airport#tla-helipad-tlof class Helipad < Component - include AIXM::Association - include AIXM::Memoize + include AIXM::Concerns::Association include AIXM::Concerns::Marking include AIXM::Concerns::Remarks PERFORMANCE_CLASSES = { '1': :'1', @@ -157,49 +156,43 @@ def status=(value) @status = value.nil? ? nil : (STATUSES.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid status")) end - # @return [String] UID markup - def to_uid - builder = Builder::XmlMarkup.new(indent: 2) + # @!visibility private + def add_uid_to(builder) builder.TlaUid do |tla_uid| - tla_uid << airport.to_uid.indent(2) + airport.add_uid_to(tla_uid) tla_uid.txtDesig(name) end end - memoize :to_uid - # @return [String] AIXM or OFMX markup - def to_xml - builder = Builder::XmlMarkup.new(indent: 2) + # @!visibility private + def add_to(builder) builder.Tla do |tla| - tla << to_uid.indent(2) - tla << fato.to_uid.indent(2) if fato + add_uid_to(tla) + fato.add_uid_to(tla) if fato tla.geoLat(xy.lat(AIXM.schema)) tla.geoLong(xy.long(AIXM.schema)) tla.codeDatum('WGE') if z tla.valElev(z.alt) - tla.uomDistVer(z.unit.upcase.to_s) + tla.uomDistVer(z.unit.upcase) end if dimensions tla.valLen(dimensions.length.to_m.dim.trim) tla.valWid(dimensions.width.to_m.dim.trim) tla.uomDim('M') end - unless (xml = surface.to_xml).empty? - tla << xml.indent(2) - end - tla.codeClassHel(PERFORMANCE_CLASSES.key(performance_class).to_s) if performance_class + surface.add_to(tla) if surface + tla.codeClassHel(PERFORMANCE_CLASSES.key(performance_class)) if performance_class tla.txtMarking(marking) if marking - tla.codeSts(STATUSES.key(status).to_s) if status + tla.codeSts(STATUSES.key(status)) if status tla.txtRmk(remarks) if remarks end lightings.each do |lighting| - builder << lighting.to_xml(as: :Tls) + lighting.add_to(builder, as: :Tls) end - builder.target! end end end end