class AIXM::Component::Layer

Each airspace has one or more layers with optional airspace class and mandatory vertical limit.

Cheat Sheet in Pseudo Code:

layer = AIXM.layer(
  class: String or nil
  location_indicator: String or nil
  vertical_limit: AIXM.vertical_limit
)
layer.activity = String or nil
layer.timetable = AIXM.timetable or nil
layer.selective = true or false (default)
layer.remarks = String or nil
airspace.add_service(AIXM.service)

@see gitlab.com/openflightmaps/ofmx/wikis/Airspace

Constants

ACTIVITIES
CLASSES

Attributes

activity[R]

@return [String, nil] primary activity (e.g. “GLIDER”)

location_indicator[R]

@return [String, nil] four letter location identifier as published in the ICAO DOC 7910

remarks[R]

@return [String, nil] free text remarks

timetable[R]

@return [AIXM::Component::Timetable, nil] activation hours

Public Class Methods

new(class: nil, location_indicator: nil, vertical_limit:) click to toggle source
    # File lib/aixm/component/layer.rb
119 def initialize(class: nil, location_indicator: nil, vertical_limit:)
120   self.class = binding.local_variable_get(:class)
121   self.location_indicator, self.vertical_limit = location_indicator, vertical_limit
122   self.selective = false
123 end

Public Instance Methods

activity=(value) click to toggle source
    # File lib/aixm/component/layer.rb
146 def activity=(value)
147   @activity = value.nil? ? nil : ACTIVITIES.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid activity")
148 end
class() click to toggle source

@!attribute class @return [Symbol] class of layer (see {CLASSES})

    # File lib/aixm/component/layer.rb
132 def class
133   @klass
134 end
class=(value) click to toggle source
    # File lib/aixm/component/layer.rb
136 def class=(value)
137   @klass = value&.to_sym&.upcase
138   fail(ArgumentError, "invalid class") unless @klass.nil? || CLASSES.include?(@klass)
139 end
inspect() click to toggle source

@return [String]

    # File lib/aixm/component/layer.rb
126 def inspect
127   %Q(#<#{__class__} class=#{@klass.inspect}>)
128 end
location_indicator=(value) click to toggle source
    # File lib/aixm/component/layer.rb
141 def location_indicator=(value)
142   fail(ArgumentError, "invalid location indicator") unless value.nil? || (value.is_a?(String) && value.length == 4)
143   @location_indicator = value&.uptrans
144 end
remarks=(value) click to toggle source
    # File lib/aixm/component/layer.rb
166 def remarks=(value)
167   @remarks = value&.to_s
168 end
selective=(value) click to toggle source
    # File lib/aixm/component/layer.rb
161 def selective=(value)
162   fail(ArgumentError, "invalid selective") unless [true, false].include? value
163   @selective = value
164 end
selective?() click to toggle source

@!attribute [w] selective @return [Boolean] whether the layer may be activated selectively

    # File lib/aixm/component/layer.rb
157 def selective?
158   @selective
159 end
timetable=(value) click to toggle source
    # File lib/aixm/component/layer.rb
150 def timetable=(value)
151   fail(ArgumentError, "invalid timetable") unless value.nil? || value.is_a?(AIXM::Component::Timetable)
152   @timetable = value
153 end
to_xml() click to toggle source

@return [String] AIXM or OFMX markup

    # File lib/aixm/component/layer.rb
171 def to_xml
172   builder = Builder::XmlMarkup.new(indent: 2)
173   builder.codeClass(self.class.to_s) if self.class
174   builder.codeLocInd(location_indicator) if location_indicator
175   if activity
176     builder.codeActivity(ACTIVITIES.key(activity).to_s.then_if(AIXM.aixm?) { { 'AIRMODEL' => 'UAV', 'WINCH' => 'GLIDER' }[_1] || _1 })
177   end
178   builder << vertical_limit.to_xml
179   builder << timetable.to_xml(as: :Att) if timetable
180   builder.codeSelAvbl(selective? ? 'Y' : 'N') if AIXM.ofmx?
181   builder.txtRmk(remarks) if remarks
182   builder.target!
183 end