Class: AIXM::Component::Helipad

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

Constructor Details

#initialize(name:, xy:) ⇒ Helipad


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

def initialize(name:, xy:)
  self.name, self.xy = name, xy
  @surface = AIXM.surface
  @lightings = []
end

Instance Attribute Details

#airportAIXM::Feature::Airport


43
44
45
# File 'lib/aixm/component/helipad.rb', line 43

def airport
  @airport
end

#fatoAIXM::Component::FATO?


67
68
69
# File 'lib/aixm/component/helipad.rb', line 67

def fato
  @fato
end

#helicopter_classInteger, ...


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

def helicopter_class
  @helicopter_class
end

#lengthAIXM::D?


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

def length
  @length
end

#lightingsArray<AIXM::Component::Lighting> (readonly)


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

def lightings
  @lightings
end

#markingString?


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

def marking
  @marking
end

#nameString


46
47
48
# File 'lib/aixm/component/helipad.rb', line 46

def name
  @name
end

#remarksString?


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

def remarks
  @remarks
end

#statusSymbol?


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

def status
  @status
end

#surfaceAIXM::Component::Surface (readonly)


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

def surface
  @surface
end

#widthAIXM::D?


58
59
60
# File 'lib/aixm/component/helipad.rb', line 58

def width
  @width
end

#xyAIXM::XY


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

def xy
  @xy
end

#zAIXM::Z?


52
53
54
# File 'lib/aixm/component/helipad.rb', line 52

def z
  @z
end

Instance Method Details

#add_lighting(lighting) ⇒ self

Add a lighting system to the runway direction.


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

def add_lighting(lighting)
  fail(ArgumentError, "invalid lighting") unless lighting.is_a? AIXM::Component::Lighting
  lighting.send(:lightable=, self)
  @lightings << lighting
  self
end

#inspectString


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

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

#to_uidString


162
163
164
165
166
167
168
# File 'lib/aixm/component/helipad.rb', line 162

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

#to_xmlString


171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/aixm/component/helipad.rb', line 171

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