Class: AIXM::Component::Runway
- Includes:
- Association, Memoize
- Defined in:
- lib/aixm/component/runway.rb
Overview
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
Defined Under Namespace
Classes: Direction
Constant Summary collapse
- STATUSES =
{ CLSD: :closed, WIP: :work_in_progress, # e.g. construction work PARKED: :parked_aircraft, # parked or disabled aircraft on helipad FAILAID: :visual_aids_failure, # failure or irregular operation of visual aids SPOWER: :secondary_power, # secondary power supply in operation OTHER: :other # specify in remarks }
Instance Attribute Summary collapse
-
#length ⇒ AIXM::D?
Length.
-
#name ⇒ String
Full name of runway (e.g. “12/30” or “16L/34R”).
-
#remarks ⇒ String?
Free text remarks.
-
#status ⇒ Symbol?
Status of the runway (see STATUSES) or
nil
for normal operation. -
#surface ⇒ AIXM::Component::Surface
readonly
Surface of the runway.
-
#width ⇒ AIXM::D?
Width.
Instance Method Summary collapse
-
#airport ⇒ AIXM::Feature::Airport
Airport the runway belongs to.
-
#back ⇒ AIXM::Component::Runway::Direction?
Reverse direction.
- #back=(back) ⇒ Object
-
#forth ⇒ AIXM::Component::Runway::Direction
Main direction.
- #forth=(forth) ⇒ Object
-
#initialize(name:) ⇒ Runway
constructor
A new instance of Runway.
- #inspect ⇒ String
-
#to_uid ⇒ String
UID markup.
-
#to_xml ⇒ String
AIXM or OFMX markup.
Methods included from Memoize
Methods included from Association
Constructor Details
#initialize(name:) ⇒ Runway
Returns a new instance of Runway.
95 96 97 98 99 100 101 102 103 |
# File 'lib/aixm/component/runway.rb', line 95 def initialize(name:) self.name = name @name.split("/").tap do |forth_name, back_name| self.forth = Direction.new(name: AIXM.a(forth_name)) self.back = Direction.new(name: AIXM.a(back_name)) if back_name fail(ArgumentError, "invalid name") unless !back || back.name.inverse_of?(@forth.name) end @surface = AIXM.surface end |
Instance Attribute Details
#length ⇒ AIXM::D?
Returns length.
81 82 83 |
# File 'lib/aixm/component/runway.rb', line 81 def length @length end |
#name ⇒ String
Returns full name of runway (e.g. “12/30” or “16L/34R”).
78 79 80 |
# File 'lib/aixm/component/runway.rb', line 78 def name @name end |
#remarks ⇒ String?
Returns free text remarks.
93 94 95 |
# File 'lib/aixm/component/runway.rb', line 93 def remarks @remarks end |
#status ⇒ Symbol?
Returns status of the runway (see STATUSES) or nil
for normal operation.
90 91 92 |
# File 'lib/aixm/component/runway.rb', line 90 def status @status end |
#surface ⇒ AIXM::Component::Surface (readonly)
Returns surface of the runway.
87 88 89 |
# File 'lib/aixm/component/runway.rb', line 87 def surface @surface end |
#width ⇒ AIXM::D?
Returns width.
84 85 86 |
# File 'lib/aixm/component/runway.rb', line 84 def width @width end |
Instance Method Details
#airport ⇒ AIXM::Feature::Airport
Returns airport the runway belongs to.
75 |
# File 'lib/aixm/component/runway.rb', line 75 belongs_to :airport |
#back ⇒ AIXM::Component::Runway::Direction?
Returns reverse direction.
71 |
# File 'lib/aixm/component/runway.rb', line 71 has_one :back, accept: 'AIXM::Component::Runway::Direction', allow_nil: true |
#back=(back) ⇒ Object
71 |
# File 'lib/aixm/component/runway.rb', line 71 has_one :back, accept: 'AIXM::Component::Runway::Direction', allow_nil: true |
#forth ⇒ AIXM::Component::Runway::Direction
Returns main direction.
65 |
# File 'lib/aixm/component/runway.rb', line 65 has_one :forth, accept: 'AIXM::Component::Runway::Direction' |
#forth=(forth) ⇒ Object
65 |
# File 'lib/aixm/component/runway.rb', line 65 has_one :forth, accept: 'AIXM::Component::Runway::Direction' |
#inspect ⇒ String
106 107 108 |
# File 'lib/aixm/component/runway.rb', line 106 def inspect %Q(#<#{self.class} airport=#{airport&.id.inspect} name=#{name.inspect}>) end |
#to_uid ⇒ String
Returns UID markup.
140 141 142 143 144 145 146 |
# File 'lib/aixm/component/runway.rb', line 140 def to_uid builder = Builder::XmlMarkup.new(indent: 2) builder.RwyUid do |rwy_uid| rwy_uid << airport.to_uid.indent(2) rwy_uid.txtDesig(name) end end |
#to_xml ⇒ String
Returns AIXM or OFMX markup.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/aixm/component/runway.rb', line 150 def to_xml builder = Builder::XmlMarkup.new(indent: 2) builder.Rwy do |rwy| rwy << to_uid.indent(2) rwy.valLen(length.dist.trim) if length rwy.valWid(width.dist.trim) if width rwy.uomDimRwy(length.unit.to_s.upcase) if length rwy.uomDimRwy(width.unit.to_s.upcase) if width && !length unless (xml = surface.to_xml).empty? rwy << xml.indent(2) end rwy.codeSts(STATUSES.key(status).to_s) if status rwy.txtRmk(remarks) if remarks end %i(@forth @back).each do |direction| if direction = instance_variable_get(direction) builder << direction.to_xml end end builder.target! end |