Class: AIXM::Component::Helipad

Inherits:
Object
  • Object
show all
Includes:
Association, Memoize
Defined in:
lib/aixm/component/helipad.rb

Overview

Helipads are TLOF (touch-down and lift-off areas) for vertical take-off aircraft such as helicopters.

Cheat Sheet in Pseudo Code:

helipad = AIXM.helipad(
  name: String
  xy = AIXM.xy
)
helipad.z = AIXM.z or nil
helipad.length = AIXM.d or nil   # must use same unit as width
helipad.width = AIXM.d or nil    # must use same unit as length
helipad.surface = AIXM.surface
helipad.marking = String or nil
helipad.fato = AIXM.fato or nil
helipad.helicopter_class = HELICOPTER_CLASSES or nil
helipad.status = STATUSES or nil
helipad.remarks = String or nil

Constant Summary collapse

HELICOPTER_CLASSES =
{
  '1': :'1',
  '2': :'2',
  '3': :'3',
  OTHER: :other   # specify in remarks
}.freeze
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
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Memoize

cache, included, method

Methods included from Association

included

Constructor Details

#initialize(name:, xy:) ⇒ Helipad

Returns a new instance of Helipad.


95
96
97
98
# File 'lib/aixm/component/helipad.rb', line 95

def initialize(name:, xy:)
  self.name, self.xy = name, xy
  self.surface = AIXM.surface
end

Instance Attribute Details

#helicopter_classInteger, ...

Returns suitable helicopter class.

Returns:

  • (Integer, Symbol, nil)

    suitable helicopter class


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

def helicopter_class
  @helicopter_class
end

#lengthAIXM::D?

Returns length.

Returns:


78
79
80
# File 'lib/aixm/component/helipad.rb', line 78

def length
  @length
end

#markingString?

Returns markings.

Returns:

  • (String, nil)

    markings


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

def marking
  @marking
end

#nameString

Returns full name (e.g. “H1”).

Returns:

  • (String)

    full name (e.g. “H1”)


69
70
71
# File 'lib/aixm/component/helipad.rb', line 69

def name
  @name
end

#remarksString?

Returns free text remarks.

Returns:

  • (String, nil)

    free text remarks


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

def remarks
  @remarks
end

#statusSymbol?

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

Returns:

  • (Symbol, nil)

    status of the helipad (see STATUSES) or nil for normal operation


90
91
92
# File 'lib/aixm/component/helipad.rb', line 90

def status
  @status
end

#widthAIXM::D?

Returns width.

Returns:


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

def width
  @width
end

#xyAIXM::XY

Returns center point.

Returns:


72
73
74
# File 'lib/aixm/component/helipad.rb', line 72

def xy
  @xy
end

#zAIXM::Z?

Returns elevation in :qnh.

Returns:

  • (AIXM::Z, nil)

    elevation in :qnh


75
76
77
# File 'lib/aixm/component/helipad.rb', line 75

def z
  @z
end

Instance Method Details

#add_lighting(lighting) ⇒ self

Parameters:

Returns:

  • (self)

62
# File 'lib/aixm/component/helipad.rb', line 62

has_many :lightings, as: :lightable

#airportAIXM::Feature::Airport

Returns airport this helipad belongs to.

Returns:


66
# File 'lib/aixm/component/helipad.rb', line 66

belongs_to :airport

#fatoAIXM::Component::FATO?

Returns FATO the helipad is situated on.

Returns:


49
# File 'lib/aixm/component/helipad.rb', line 49

has_one :fato, allow_nil: true

#fato=(fato) ⇒ Object

Parameters:


49
# File 'lib/aixm/component/helipad.rb', line 49

has_one :fato, allow_nil: true

#inspectString

Returns:

  • (String)

101
102
103
# File 'lib/aixm/component/helipad.rb', line 101

def inspect
  %Q(#<#{self.class} airport=#{airport&.id.inspect} name=#{name.inspect}>)
end

#lightingsArray<AIXM::Component::Lighting>

Returns installed lighting systems.

Returns:


62
# File 'lib/aixm/component/helipad.rb', line 62

has_many :lightings, as: :lightable

#surfaceAIXM::Component::Surface

Returns surface of the helipad.

Returns:


55
# File 'lib/aixm/component/helipad.rb', line 55

has_one :surface

#surface=(surface) ⇒ Object

Parameters:


55
# File 'lib/aixm/component/helipad.rb', line 55

has_one :surface

#to_uidString

Returns UID markup.

Returns:

  • (String)

    UID markup


153
154
155
156
157
158
159
# File 'lib/aixm/component/helipad.rb', line 153

def to_uid
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.TlaUid do |tla_uid|
    tla_uid << airport.to_uid.indent(2)
    tla_uid.txtDesig(name)
  end
end

#to_xmlString

Returns AIXM or OFMX markup.

Returns:

  • (String)

    AIXM or OFMX markup


163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/aixm/component/helipad.rb', line 163

def to_xml
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.Tla do |tla|
    tla << to_uid.indent(2)
    tla << fato.to_uid.indent(2) if fato
    tla.geoLat(xy.lat(AIXM.schema))
    tla.geoLong(xy.long(AIXM.schema))
    tla.codeDatum('WGE')
    if z
      tla.valElev(z.alt)
      tla.uomDistVer(z.unit.upcase.to_s)
    end
    tla.valLen(length.dist.trim) if length
    tla.valWid(width.dist.trim) if width
    tla.uomDim(length.unit.to_s.upcase) if length
    tla.uomDim(width.unit.to_s.upcase) if width && !length
    unless  (xml = surface.to_xml).empty?
      tla << xml.indent(2)
    end
    tla.codeClassHel(HELICOPTER_CLASSES.key(helicopter_class).to_s) if helicopter_class
    tla.txtMarking(marking) if marking
    tla.codeSts(STATUSES.key(status).to_s) if status
    tla.txtRmk(remarks) if remarks
  end
  lightings.each do |lighting|
    builder << lighting.to_xml(as: :Tls)
  end
  builder.target!
end