Class: AIXM::Component::Runway
- Inherits:
-
Object
- Object
- AIXM::Component::Runway
- 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
-
#airport ⇒ AIXM::Feature::Airport
readonly
Airport the runway belongs to.
-
#back ⇒ AIXM::Component::Runway::Direction
Reverse direction.
-
#forth ⇒ AIXM::Component::Runway::Direction
Main direction.
-
#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
nilfor normal operation. -
#surface ⇒ AIXM::Component::Surface
readonly
Surface of the runway.
-
#width ⇒ AIXM::D?
Width.
Instance Method Summary collapse
-
#initialize(name:) ⇒ Runway
constructor
A new instance of Runway.
- #inspect ⇒ String
-
#to_uid ⇒ String
UID markup.
-
#to_xml ⇒ String
AIXM or OFMX markup.
Constructor Details
#initialize(name:) ⇒ Runway
Returns a new instance of Runway.
85 86 87 88 89 90 91 92 93 |
# File 'lib/aixm/component/runway.rb', line 85 def initialize(name:) self.name = name @name.split("/").tap do |forth, back| @forth = Direction.new(runway: self, name: AIXM.a(forth)) @back = Direction.new(runway: self, name: AIXM.a(back)) if back fail(ArgumentError, "invalid name") unless !@back || @back.name.inverse_of?(@forth.name) end @surface = AIXM.surface end |
Instance Attribute Details
#airport ⇒ AIXM::Feature::Airport
Returns airport the runway belongs to.
59 60 61 |
# File 'lib/aixm/component/runway.rb', line 59 def airport @airport end |
#back ⇒ AIXM::Component::Runway::Direction
Returns reverse direction.
83 84 85 |
# File 'lib/aixm/component/runway.rb', line 83 def back @back end |
#forth ⇒ AIXM::Component::Runway::Direction
Returns main direction.
80 81 82 |
# File 'lib/aixm/component/runway.rb', line 80 def forth @forth end |
#length ⇒ AIXM::D?
Returns length.
65 66 67 |
# File 'lib/aixm/component/runway.rb', line 65 def length @length end |
#name ⇒ String
Returns full name of runway (e.g. “12/30” or “16L/34R”).
62 63 64 |
# File 'lib/aixm/component/runway.rb', line 62 def name @name end |
#remarks ⇒ String?
Returns free text remarks.
77 78 79 |
# File 'lib/aixm/component/runway.rb', line 77 def remarks @remarks end |
#status ⇒ Symbol?
Returns status of the runway (see STATUSES) or nil for normal operation.
74 75 76 |
# File 'lib/aixm/component/runway.rb', line 74 def status @status end |
#surface ⇒ AIXM::Component::Surface (readonly)
Returns surface of the runway.
71 72 73 |
# File 'lib/aixm/component/runway.rb', line 71 def surface @surface end |
#width ⇒ AIXM::D?
Returns width.
68 69 70 |
# File 'lib/aixm/component/runway.rb', line 68 def width @width end |
Instance Method Details
#inspect ⇒ String
96 97 98 |
# File 'lib/aixm/component/runway.rb', line 96 def inspect %Q(#<#{self.class} airport=#{airport&.id.inspect} name=#{name.inspect}>) end |
#to_uid ⇒ String
Returns UID markup.
136 137 138 139 140 141 142 |
# File 'lib/aixm/component/runway.rb', line 136 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.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/aixm/component/runway.rb', line 145 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 |