class AIXM::Feature::Organisation
Organisations and authorities such as ATS organisations, aircraft operating agencies, states and so forth.
Cheat Sheet in Pseudo Code:¶ ↑
organisation = AIXM.organisation( source: String or nil region: String or nil name: String type: TYPES ) organisation.id = String or nil organisation.remarks = String or nil
@see gitlab.com/openflightmaps/ofmx/wikis/Organisation#org-organisation
Constants
- TYPES
Attributes
id[R]
@return [String, nil] code of the organisation (e.g. “LF”)
name[R]
@return [String] name of organisation (e.g. “FRANCE”)
remarks[R]
@return [String, nil] free text remarks
type[R]
@return [Symbol] type of organisation (see {TYPES})
Public Class Methods
new(source: nil, region: nil)
click to toggle source
# File lib/aixm/feature.rb 15 def initialize(source: nil, region: nil) 16 self.source = source 17 self.region = region || AIXM.config.region 18 end
new(source: nil, region: nil, name:, type:)
click to toggle source
Calls superclass method
AIXM::Feature::new
# File lib/aixm/feature/organisation.rb 61 def initialize(source: nil, region: nil, name:, type:) 62 super(source: source, region: region) 63 self.name, self.type = name, type 64 end
Public Instance Methods
id=(value)
click to toggle source
# File lib/aixm/feature/organisation.rb 80 def id=(value) 81 fail(ArgumentError, "invalid id") unless value.nil? || value.is_a?(String) 82 @id = value&.upcase 83 end
inspect()
click to toggle source
@return [String]
# File lib/aixm/feature/organisation.rb 67 def inspect 68 %Q(#<#{self.class} name=#{name.inspect} type=#{type.inspect}>) 69 end
name=(value)
click to toggle source
# File lib/aixm/feature/organisation.rb 71 def name=(value) 72 fail(ArgumentError, "invalid name") unless value.is_a? String 73 @name = value.uptrans 74 end
remarks=(value)
click to toggle source
# File lib/aixm/feature/organisation.rb 85 def remarks=(value) 86 @remarks = value&.to_s 87 end
to_uid()
click to toggle source
@return [String] UID markup
# File lib/aixm/feature/organisation.rb 90 def to_uid 91 builder = Builder::XmlMarkup.new(indent: 2) 92 builder.OrgUid({ region: (region if AIXM.ofmx?) }.compact) do |org_uid| 93 org_uid.txtName(name) 94 end 95 end
to_xml()
click to toggle source
@return [String] AIXM
or OFMX markup
# File lib/aixm/feature/organisation.rb 99 def to_xml 100 builder = Builder::XmlMarkup.new(indent: 2) 101 builder.comment! "Organisation: #{name}" 102 builder.Org({ source: (source if AIXM.ofmx?) }.compact) do |org| 103 org << to_uid.indent(2) 104 org.codeId(id) if id 105 org.codeType(TYPES.key(type).to_s) 106 org.txtRmk(remarks) if remarks 107 end 108 end
type=(value)
click to toggle source
# File lib/aixm/feature/organisation.rb 76 def type=(value) 77 @type = TYPES.lookup(value&.to_s&.to_sym, nil) || fail(ArgumentError, "invalid type") 78 end