Class: AIXM::Component::Runway

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

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

Methods included from Memoize

cache, included, method

Methods included from Association

included

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

#lengthAIXM::D?

Returns length.

Returns:


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

def length
  @length
end

#nameString

Returns full name of runway (e.g. “12/30” or “16L/34R”).

Returns:

  • (String)

    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

#remarksString?

Returns free text remarks.

Returns:

  • (String, nil)

    free text remarks


93
94
95
# File 'lib/aixm/component/runway.rb', line 93

def remarks
  @remarks
end

#statusSymbol?

Returns status of the runway (see STATUSES) or nil for normal operation.

Returns:

  • (Symbol, nil)

    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

#surfaceAIXM::Component::Surface (readonly)

Returns surface of the runway.

Returns:


87
88
89
# File 'lib/aixm/component/runway.rb', line 87

def surface
  @surface
end

#widthAIXM::D?

Returns width.

Returns:


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

def width
  @width
end

Instance Method Details

#airportAIXM::Feature::Airport

Returns airport the runway belongs to.

Returns:


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

belongs_to :airport

#backAIXM::Component::Runway::Direction?

Returns reverse direction.

Returns:


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

has_one :back, accept: 'AIXM::Component::Runway::Direction', allow_nil: true

#back=(back) ⇒ Object

Parameters:


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

has_one :back, accept: 'AIXM::Component::Runway::Direction', allow_nil: true

#forthAIXM::Component::Runway::Direction

Returns main direction.

Returns:


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'

#inspectString

Returns:

  • (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_uidString

Returns UID markup.

Returns:

  • (String)

    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_xmlString

Returns AIXM or OFMX markup.

Returns:

  • (String)

    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