class AIXM::Component::Runway

Runways are landing and takeoff strips for forward propelled aircraft.

By convention, the runway name is usually the composition of the runway forth name (smaller number) and the runway back name (bigger number) joined with a forward slash e.g. “12/30” or “16R/34L”.

A runway has one or to directions accessible as runway.forth (mandatory) and runway.back (optional). Both have identical properties.

Cheat Sheet in Pseudo Code:

runway = AIXM.runway(
  name: String
)
runway.length = AIXM.d or nil   # must use same unit as width
runway.width = AIXM.d or nil    # must use same unit as length
runway.surface = AIXM.surface
runway.status = STATUSES or nil
runway.remarks = String or nil
runway.forth.name = AIXM.a[precision=2]   # preset based on the runway name
runway.forth.geographic_orientation = AIXM.a[precision=3] or nil
runway.forth.xy = AIXM.xy
runway.forth.z = AIXM.z or nil
runway.forth.displaced_threshold = AIXM.xy or AIXM.d or nil
runway.forth.vfr_pattern = VFR_PATTERNS or nil
runway.forth.remarks = String or nil

@example Bidirectional runway

runway = AIXM.runway(name: '16L/34R')
runway.name   # => '16L/34R'
runway.forth.name.to_s = '16L'
runway.forth.geographic_orientation = 165
runway.back.name.to_s = '34R'
runway.back.geographic_orientation = 345

@example Unidirectional runway:

runway = AIXM.runway(name: '16L')
runway.name   # => '16L'
runway.forth.name.to_s = '16L'
runway.forth.geographic_orientation = 165
runway.back = nil

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

Constants

STATUSES

Attributes

length[R]

@return [AIXM::D, nil] length

name[R]

@return [String] full name of runway (e.g. “12/30” or “16L/34R”)

remarks[R]

@return [String, nil] free text remarks

status[R]

@return [Symbol, nil] status of the runway (see {STATUSES}) or nil for normal operation

surface[R]

@return [AIXM::Component::Surface] surface of the runway

width[R]

@return [AIXM::D, nil] width

Public Class Methods

new(name:) click to toggle source
    # File lib/aixm/component/runway.rb
 95 def initialize(name:)
 96   self.name = name
 97   @name.split("/").tap do |forth_name, back_name|
 98     self.forth = Direction.new(name: AIXM.a(forth_name))
 99     self.back = Direction.new(name: AIXM.a(back_name)) if back_name
100     fail(ArgumentError, "invalid name") unless !back || back.name.inverse_of?(@forth.name)
101   end
102   @surface = AIXM.surface
103 end

Public Instance Methods

inspect() click to toggle source

@return [String]

    # File lib/aixm/component/runway.rb
106 def inspect
107   %Q(#<#{self.class} airport=#{airport&.id.inspect} name=#{name.inspect}>)
108 end
length=(value) click to toggle source
    # File lib/aixm/component/runway.rb
115 def length=(value)
116   @length = if value
117     fail(ArgumentError, "invalid length") unless value.is_a?(AIXM::D) && value.dist > 0
118     fail(ArgumentError, "invalid length unit") if width && width.unit != value.unit
119     @length = value
120   end
121 end
name=(value) click to toggle source
    # File lib/aixm/component/runway.rb
110 def name=(value)
111   fail(ArgumentError, "invalid name") unless value.is_a? String
112   @name = value.uptrans
113 end
remarks=(value) click to toggle source
    # File lib/aixm/component/runway.rb
135 def remarks=(value)
136   @remarks = value&.to_s
137 end
status=(value) click to toggle source
    # File lib/aixm/component/runway.rb
131 def status=(value)
132   @status = value.nil? ? nil : (STATUSES.lookup(value.to_s.to_sym, nil) || fail(ArgumentError, "invalid status"))
133 end
to_uid() click to toggle source

@return [String] UID markup

    # File lib/aixm/component/runway.rb
140 def to_uid
141   builder = Builder::XmlMarkup.new(indent: 2)
142   builder.RwyUid do |rwy_uid|
143     rwy_uid << airport.to_uid.indent(2)
144     rwy_uid.txtDesig(name)
145   end
146 end
to_xml() click to toggle source

@return [String] AIXM or OFMX markup

    # File lib/aixm/component/runway.rb
150 def to_xml
151   builder = Builder::XmlMarkup.new(indent: 2)
152   builder.Rwy do |rwy|
153     rwy << to_uid.indent(2)
154     rwy.valLen(length.dist.trim) if length
155     rwy.valWid(width.dist.trim) if width
156     rwy.uomDimRwy(length.unit.to_s.upcase) if length
157     rwy.uomDimRwy(width.unit.to_s.upcase) if width && !length
158     unless  (xml = surface.to_xml).empty?
159       rwy << xml.indent(2)
160     end
161     rwy.codeSts(STATUSES.key(status).to_s) if status
162     rwy.txtRmk(remarks) if remarks
163   end
164   %i(@forth @back).each do |direction|
165     if direction = instance_variable_get(direction)
166       builder << direction.to_xml
167     end
168   end
169   builder.target!
170 end
width=(value) click to toggle source
    # File lib/aixm/component/runway.rb
123 def width=(value)
124   @width = if value
125     fail(ArgumentError, "invalid width") unless value.is_a?(AIXM::D)  && value.dist > 0
126     fail(ArgumentError, "invalid width unit") if length && length.unit != value.unit
127     @width = value
128   end
129 end