Class: AIXM::Component::Runway

Inherits:
Object
  • Object
show all
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

Examples:

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

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 Also:

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

Instance Method Summary collapse

Constructor Details

#initialize(name:) ⇒ 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

#airportAIXM::Feature::Airport


59
60
61
# File 'lib/aixm/component/runway.rb', line 59

def airport
  @airport
end

#backAIXM::Component::Runway::Direction


83
84
85
# File 'lib/aixm/component/runway.rb', line 83

def back
  @back
end

#forthAIXM::Component::Runway::Direction


80
81
82
# File 'lib/aixm/component/runway.rb', line 80

def forth
  @forth
end

#lengthAIXM::D?


65
66
67
# File 'lib/aixm/component/runway.rb', line 65

def length
  @length
end

#nameString


62
63
64
# File 'lib/aixm/component/runway.rb', line 62

def name
  @name
end

#remarksString?


77
78
79
# File 'lib/aixm/component/runway.rb', line 77

def remarks
  @remarks
end

#statusSymbol?


74
75
76
# File 'lib/aixm/component/runway.rb', line 74

def status
  @status
end

#surfaceAIXM::Component::Surface (readonly)


71
72
73
# File 'lib/aixm/component/runway.rb', line 71

def surface
  @surface
end

#widthAIXM::D?


68
69
70
# File 'lib/aixm/component/runway.rb', line 68

def width
  @width
end

Instance Method Details

#inspectString


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_uidString


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.insert_payload_hash(region: AIXM.config.mid_region)
end

#to_xmlString


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