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

Inherits:
Object
  • Object
show all
Includes:
Association, Memoize
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

Methods included from Memoize

cache, included, method

Methods included from Association

included

Constructor Details

#initialize(name:) ⇒ Direction

Returns a new instance of Direction.


189
190
191
# File 'lib/aixm/component/fato.rb', line 189

def initialize(name:)
  self.name = name
end

Instance Attribute Details

#geographic_orientationAIXM::A?

Returns geographic orientation (true bearing) in degrees.

Returns:

  • (AIXM::A, nil)

    geographic orientation (true bearing) in degrees


184
185
186
# File 'lib/aixm/component/fato.rb', line 184

def geographic_orientation
  @geographic_orientation
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”)


181
182
183
# File 'lib/aixm/component/fato.rb', line 181

def name
  @name
end

#remarksString?

Returns free text remarks.

Returns:

  • (String, nil)

    free text remarks


187
188
189
# File 'lib/aixm/component/fato.rb', line 187

def remarks
  @remarks
end

Instance Method Details

#add_lighting(lighting) ⇒ Object

Parameters:


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

has_many :lightings, as: :lightable

#fatoAIXM::Component::FATO

Returns FATO the FATO direction is further describing.

Returns:


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

belongs_to :fato

#inspectString

Returns:

  • (String)

194
195
196
# File 'lib/aixm/component/fato.rb', line 194

def inspect
  %Q(#<#{self.class} airport=#{fato&.airport&.id.inspect} name=#{name.inspect}>)
end

#lightingsArray<AIXM::Component::Lighting>

Returns installed lighting systems.

Returns:


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

has_many :lightings, as: :lightable

#magnetic_orientationAIXM::A

Returns magnetic orientation (magnetic bearing) in degrees.

Returns:

  • (AIXM::A)

    magnetic orientation (magnetic bearing) in degrees


214
215
216
217
218
# File 'lib/aixm/component/fato.rb', line 214

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


221
222
223
224
225
226
227
# File 'lib/aixm/component/fato.rb', line 221

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_xmlString

Returns AIXM or OFMX markup.

Returns:

  • (String)

    AIXM or OFMX markup


231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/aixm/component/fato.rb', line 231

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