Class: AIXM::Component::Layer
- Includes:
- Association
- Defined in:
- lib/aixm/component/layer.rb
Overview
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)
Constant Summary collapse
- CLASSES =
(:A..:G).freeze
- ACTIVITIES =
{ ACCIDENT: :accident_investigation, ACROBAT: :acrobatics, AIRGUN: :aerial_gunnery, AIRMODEL: :aeromodelling, AIRSHOW: :air_show, ANTIHAIL: :anti_hail_rocket, ARTILERY: :artillary_firing, ASCENT: :probe, ATS: :air_traffic_services, BALLOON: :balloon, BIRD: :bird_hazard, 'BIRD-MGR': :bird_migration, BLAST: :blasting_operation, DROP: :dropping, DUSTING: :crop_dusting, EQUIPMENT: :special_equipment_required, 'EQUIPMENT-833': :radio_8_33_required, 'EQUIPMENT-RNAV': :rnav_equipment_required, 'EQUIPMENT-RSVM': :rsvm_equipment_required, EXERCISE: :combat_exercise, FAUNA: :sensitive_fauna, FIRE: :fire_suppression, FIREWORK: :fireworks, GAZ: :gaz_field, GLIDER: :gliding, HANGGLIDER: :hanggliding, 'HI-LIGHT': :high_intensity_light, 'HI-RADIO': :high_intensity_radio, 'IND-CHEM': :chemical_plant, 'IND-NUCLEAR': :nuclear_activity, 'IND-OIL': :oil_refinery, JETCLIMB: :jet_climb, LASER: :laser_light, MILOPS: :military_operation, MISSILES: :guided_missiles, NATURE: :natural_reserve, NAVAL: :ship_exercise, 'NO-NOISE': :noise_abatement, OIL: :oil_field, PARACHUTE: :parachuting, PARAGLIDER: :paragliding, POPULATION: :highly_populated, PROCEDURE: :special_procedure, REFUEL: :refuelling, SHOOT: :shooting_from_ground, SPACEFLT: :space_flight, SPORT: :sport, TECHNICAL: :technical_activity, 'TFC-AD': :aerodrome_traffic, 'TFC-HELI': :helicopter_traffic, TOWING: :towing_traffic, TRG: :training, UAV: :drone, ULM: :ultra_light_flight, VIP: :vip, 'VIP-PRES': :president, 'VIP-VICE': :vice_president, WATERBLAST: :underwater_explosion, WINCH: :glider_winch, WORK: :aerial_work, OTHER: :other }.freeze
Instance Attribute Summary collapse
-
#activity ⇒ String?
Primary activity (e.g. “GLIDER”).
-
#class ⇒ Symbol
Class of layer (see CLASSES).
-
#location_indicator ⇒ String?
Four letter location identifier as published in the ICAO DOC 7910.
-
#remarks ⇒ String?
Free text remarks.
-
#selective ⇒ Boolean
writeonly
Whether the layer may be activated selectively.
-
#timetable ⇒ AIXM::Component::Timetable?
Activation hours.
Instance Method Summary collapse
- #add_service(service) ⇒ Object
-
#airspace ⇒ AIXM::Feature::Airspace
Airspace the layer defines.
-
#initialize(class: nil, location_indicator: nil, vertical_limit:) ⇒ Layer
constructor
A new instance of Layer.
- #inspect ⇒ String
-
#selective? ⇒ Boolean
Whether the layer may be activated selectively.
-
#services ⇒ Array<AIXM::Component::Service>
Services.
-
#to_xml ⇒ String
AIXM or OFMX markup.
-
#vertical_limit ⇒ AIXM::Component::VerticalLimit
Vertical limit of this layer.
- #vertical_limit=(vertical_limit) ⇒ Object
Methods included from Association
Constructor Details
#initialize(class: nil, location_indicator: nil, vertical_limit:) ⇒ Layer
Returns a new instance of Layer.
119 120 121 122 123 |
# File 'lib/aixm/component/layer.rb', line 119 def initialize(class: nil, location_indicator: nil, vertical_limit:) self.class = binding.local_variable_get(:class) self.location_indicator, self.vertical_limit = location_indicator, vertical_limit self.selective = false end |
Instance Attribute Details
#activity ⇒ String?
Returns primary activity (e.g. “GLIDER”).
111 112 113 |
# File 'lib/aixm/component/layer.rb', line 111 def activity @activity end |
#class ⇒ Symbol
Returns class of layer (see CLASSES).
132 133 134 |
# File 'lib/aixm/component/layer.rb', line 132 def class @klass end |
#location_indicator ⇒ String?
Returns four letter location identifier as published in the ICAO DOC 7910.
108 109 110 |
# File 'lib/aixm/component/layer.rb', line 108 def location_indicator @location_indicator end |
#remarks ⇒ String?
Returns free text remarks.
117 118 119 |
# File 'lib/aixm/component/layer.rb', line 117 def remarks @remarks end |
#selective=(value) ⇒ Boolean (writeonly)
Returns whether the layer may be activated selectively.
157 158 159 |
# File 'lib/aixm/component/layer.rb', line 157 def selective? @selective end |
#timetable ⇒ AIXM::Component::Timetable?
Returns activation hours.
114 115 116 |
# File 'lib/aixm/component/layer.rb', line 114 def @timetable end |
Instance Method Details
#add_service(service) ⇒ Object
101 |
# File 'lib/aixm/component/layer.rb', line 101 has_many :services |
#airspace ⇒ AIXM::Feature::Airspace
Returns airspace the layer defines.
105 |
# File 'lib/aixm/component/layer.rb', line 105 belongs_to :airspace |
#inspect ⇒ String
126 127 128 |
# File 'lib/aixm/component/layer.rb', line 126 def inspect %Q(#<#{__class__} class=#{@klass.inspect}>) end |
#selective? ⇒ Boolean
Returns whether the layer may be activated selectively.
157 158 159 |
# File 'lib/aixm/component/layer.rb', line 157 def selective? @selective end |
#services ⇒ Array<AIXM::Component::Service>
Returns services.
101 |
# File 'lib/aixm/component/layer.rb', line 101 has_many :services |
#to_xml ⇒ String
Returns AIXM or OFMX markup.
171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/aixm/component/layer.rb', line 171 def to_xml builder = Builder::XmlMarkup.new(indent: 2) builder.codeClass(self.class.to_s) if self.class builder.codeLocInd(location_indicator) if location_indicator if activity builder.codeActivity(ACTIVITIES.key(activity).to_s.then_if(AIXM.aixm?) { { 'AIRMODEL' => 'UAV', 'WINCH' => 'GLIDER' }[_1] || _1 }) end builder << vertical_limit.to_xml builder << .to_xml(as: :Att) if builder.codeSelAvbl(selective? ? 'Y' : 'N') if AIXM.ofmx? builder.txtRmk(remarks) if remarks builder.target! end |
#vertical_limit ⇒ AIXM::Component::VerticalLimit
Returns vertical limit of this layer.
95 |
# File 'lib/aixm/component/layer.rb', line 95 has_one :vertical_limit |
#vertical_limit=(vertical_limit) ⇒ Object
95 |
# File 'lib/aixm/component/layer.rb', line 95 has_one :vertical_limit |