Class: AIXM::Component::FATO::Direction
- Inherits:
-
Object
- Object
- AIXM::Component::FATO::Direction
- Defined in:
- lib/aixm/component/fato.rb
Overview
FATO directions further describe each direction to and from the FATO.
Instance Attribute Summary collapse
- #fato ⇒ Object writeonly
-
#geographic_orientation ⇒ AIXM::A?
Geographic orientation (true bearing) in degrees.
-
#lightings ⇒ Array<AIXM::Component::Lighting>
readonly
Installed lighting systems.
-
#name ⇒ AIXM::A
Name of the FATO direction (e.g. “12” or “16L”).
-
#remarks ⇒ String?
Free text remarks.
Instance Method Summary collapse
-
#add_lighting(lighting) ⇒ self
Add a lighting system to the FATO direction.
-
#initialize(fato:, name:) ⇒ Direction
constructor
A new instance of Direction.
- #inspect ⇒ String
-
#magnetic_orientation ⇒ AIXM::A
Magnetic orientation (magnetic bearing) in degrees.
-
#to_uid ⇒ String
UID markup.
-
#to_xml ⇒ String
AIXM or OFMX markup.
Constructor Details
#initialize(fato:, name:) ⇒ Direction
Returns a new instance of Direction.
180 181 182 183 |
# File 'lib/aixm/component/fato.rb', line 180 def initialize(fato:, name:) self.fato, self.name = fato, name @lightings = [] end |
Instance Attribute Details
#fato=(value) ⇒ Object
190 191 192 193 |
# File 'lib/aixm/component/fato.rb', line 190 def fato=(value) fail(ArgumentError, "invalid FATO") unless value.is_a? AIXM::Component::FATO @fato = value end |
#geographic_orientation ⇒ AIXM::A?
Returns geographic orientation (true bearing) in degrees.
172 173 174 |
# File 'lib/aixm/component/fato.rb', line 172 def geographic_orientation @geographic_orientation end |
#lightings ⇒ Array<AIXM::Component::Lighting> (readonly)
Returns installed lighting systems.
178 179 180 |
# File 'lib/aixm/component/fato.rb', line 178 def lightings @lightings end |
#name ⇒ AIXM::A
Returns name of the FATO direction (e.g. “12” or “16L”).
169 170 171 |
# File 'lib/aixm/component/fato.rb', line 169 def name @name end |
#remarks ⇒ String?
Returns free text remarks.
175 176 177 |
# File 'lib/aixm/component/fato.rb', line 175 def remarks @remarks end |
Instance Method Details
#add_lighting(lighting) ⇒ self
Add a lighting system to the FATO direction.
215 216 217 218 219 220 |
# File 'lib/aixm/component/fato.rb', line 215 def add_lighting(lighting) fail(ArgumentError, "invalid lighting") unless lighting.is_a? AIXM::Component::Lighting lighting.send(:lightable=, self) @lightings << lighting self end |
#inspect ⇒ String
186 187 188 |
# File 'lib/aixm/component/fato.rb', line 186 def inspect %Q(#<#{self.class} airport=#{fato&.airport&.id.inspect} name=#{name.inspect}>) end |
#magnetic_orientation ⇒ AIXM::A
Returns magnetic orientation (magnetic bearing) in degrees.
223 224 225 226 227 |
# File 'lib/aixm/component/fato.rb', line 223 def magnetic_orientation if geographic_orientation && fato.airport.declination geographic_orientation + fato.airport.declination end end |
#to_uid ⇒ String
Returns UID markup.
230 231 232 233 234 235 236 |
# File 'lib/aixm/component/fato.rb', line 230 def to_uid builder = Builder::XmlMarkup.new(indent: 2) builder.FdnUid do |fdn_uid| fdn_uid << fato.to_uid.indent(2) fdn_uid.txtDesig(name) end end |
#to_xml ⇒ String
Returns AIXM or OFMX markup.
239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/aixm/component/fato.rb', line 239 def to_xml builder = Builder::XmlMarkup.new(indent: 2) builder.Fdn do |fdn| fdn << to_uid.indent(2) fdn.valTrueBrg(geographic_orientation) if geographic_orientation fdn.valMagBrg(magnetic_orientation) if magnetic_orientation fdn.txtRmk(remarks) if remarks end lightings.each do |lighting| builder << lighting.to_xml(as: :Fls) end builder.target! end |