Class: AIXM::Component::FATO::Direction

Inherits:
Object
  • Object
show all
Defined in:
lib/aixm/component/fato.rb

Overview

FATO directions further describe each direction to and from the FATO.

Instance Attribute Summary collapse

Instance Method Summary collapse

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_orientationAIXM::A?

Returns geographic orientation (true bearing) in degrees.

Returns:

  • (AIXM::A, nil)

    geographic orientation (true bearing) in degrees


172
173
174
# File 'lib/aixm/component/fato.rb', line 172

def geographic_orientation
  @geographic_orientation
end

#lightingsArray<AIXM::Component::Lighting> (readonly)

Returns installed lighting systems.

Returns:


178
179
180
# File 'lib/aixm/component/fato.rb', line 178

def lightings
  @lightings
end

#nameAIXM::A

Returns name of the FATO direction (e.g. “12” or “16L”).

Returns:

  • (AIXM::A)

    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

#remarksString?

Returns free text remarks.

Returns:

  • (String, nil)

    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.

Parameters:

Returns:

  • (self)

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

#inspectString

Returns:

  • (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_orientationAIXM::A

Returns magnetic orientation (magnetic bearing) in degrees.

Returns:

  • (AIXM::A)

    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_uidString

Returns UID markup.

Returns:

  • (String)

    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.insert_payload_hash(region: AIXM.config.mid_region)
end

#to_xmlString

Returns AIXM or OFMX markup.

Returns:

  • (String)

    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