class AIXM::Component::Runway::Direction

Runway directions further describe each direction {#forth} and {#back} of a runway.

@see gitlab.com/openflightmaps/ofmx/wikis/Airport#rdn-runway-direction

Constants

VFR_PATTERNS

Attributes

displaced_threshold[R]

@return [AIXM::XY, AIXM::D, nil] displaced threshold point either as

coordinates (AIXM::XY) or distance (AIXM::D) from the beginning
point
geographic_orientation[R]

@return [AIXM::A, nil] geographic orientation (true bearing) in degrees

name[R]

@return [AIXM::A] partial name of runway (e.g. ā€œ12ā€ or ā€œ16Lā€)

remarks[R]

@return [String, nil] free text remarks

vfr_pattern[R]

@return [Symbol, nil] direction of the VFR flight pattern (see {VFR_PATTERNS})

xy[R]

@return [AIXM::XY] beginning point (middle of the runway width)

z[R]

@return [AIXM::Z, nil] elevation of the touch down zone in qnh

Public Class Methods

new(name:) click to toggle source
    # File lib/aixm/component/runway.rb
220 def initialize(name:)
221   self.name = name
222 end

Public Instance Methods

displaced_threshold=(value) click to toggle source
    # File lib/aixm/component/runway.rb
250 def displaced_threshold=(value)
251   case value
252   when AIXM::XY
253     @displaced_threshold = @xy.distance(value)
254   when AIXM::D
255     fail(ArgumentError, "invalid displaced threshold") unless value.dist > 0
256     @displaced_threshold = value
257   when NilClass
258     @displaced_threshold = nil
259   else
260     fail(ArgumentError, "invalid displaced threshold")
261   end
262 end
geographic_orientation=(value) click to toggle source
    # File lib/aixm/component/runway.rb
234 def geographic_orientation=(value)
235   return @geographic_orientation = nil if value.nil?
236   fail(ArgumentError, "invalid geographic orientation") unless value.is_a? AIXM::A
237   @geographic_orientation = value
238 end
inspect() click to toggle source

@return [String]

    # File lib/aixm/component/runway.rb
225 def inspect
226   %Q(#<#{self.class} airport=#{runway&.airport&.id.inspect} name=#{name.inspect}>)
227 end
magnetic_orientation() click to toggle source

@return [AIXM::A] magnetic orientation (magnetic bearing) in degrees

    # File lib/aixm/component/runway.rb
273 def magnetic_orientation
274   if geographic_orientation && runway.airport.declination
275     geographic_orientation - runway.airport.declination
276   end
277 end
name=(value) click to toggle source
    # File lib/aixm/component/runway.rb
229 def name=(value)
230   fail(ArgumentError, "invalid name") unless value.is_a? AIXM::A
231   @name = value
232 end
remarks=(value) click to toggle source
    # File lib/aixm/component/runway.rb
268 def remarks=(value)
269   @remarks = value&.to_s
270 end
to_uid() click to toggle source

@return [String] UID markup

    # File lib/aixm/component/runway.rb
280 def to_uid
281   builder = Builder::XmlMarkup.new(indent: 2)
282   builder.RdnUid do |rdn_uid|
283     rdn_uid << runway.to_uid.indent(2)
284     rdn_uid.txtDesig(name)
285   end
286 end
to_xml() click to toggle source

@return [String] AIXM or OFMX markup

    # File lib/aixm/component/runway.rb
290 def to_xml
291   builder = Builder::XmlMarkup.new(indent: 2)
292   builder.Rdn do |rdn|
293     rdn << to_uid.indent(2)
294     rdn.geoLat(xy.lat(AIXM.schema))
295     rdn.geoLong(xy.long(AIXM.schema))
296     rdn.valTrueBrg(geographic_orientation) if geographic_orientation
297     rdn.valMagBrg(magnetic_orientation) if magnetic_orientation
298     if z
299       rdn.valElevTdz(z.alt)
300       rdn.uomElevTdz(z.unit.upcase.to_s)
301     end
302     rdn.codeVfrPattern(VFR_PATTERNS.key(vfr_pattern).to_s) if vfr_pattern
303     rdn.txtRmk(remarks) if remarks
304   end
305   if displaced_threshold
306     builder.Rdd do |rdd|
307       rdd.RddUid do |rdd_uid|
308         rdd_uid << to_uid.indent(4)
309         rdd_uid.codeType('DPLM')
310         rdd_uid.codeDayPeriod('A')
311       end
312       rdd.valDist(displaced_threshold.dist.trim)
313       rdd.uomDist(displaced_threshold.unit.to_s.upcase)
314       rdd.txtRmk(remarks) if remarks
315     end
316   end
317   lightings.each do |lighting|
318     builder << lighting.to_xml(as: :Rls)
319   end
320   builder.target!
321 end
vfr_pattern=(value) click to toggle source
    # File lib/aixm/component/runway.rb
264 def vfr_pattern=(value)
265   @vfr_pattern = value.nil? ? nil : (VFR_PATTERNS.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid VFR pattern"))
266 end
xy=(value) click to toggle source
    # File lib/aixm/component/runway.rb
240 def xy=(value)
241   fail(ArgumentError, "invalid xy") unless value.is_a? AIXM::XY
242   @xy = value
243 end
z=(value) click to toggle source
    # File lib/aixm/component/runway.rb
245 def z=(value)
246   fail(ArgumentError, "invalid z") unless value.nil? || (value.is_a?(AIXM::Z) && value.qnh?)
247   @z = value
248 end