Class: AIXM::Component::FATO

Inherits:
Object
  • Object
show all
Defined in:
lib/aixm/component/fato.rb

Overview

FATO (final approach and take-off area) for vertical take-off aircraft such as helicopters.

Cheat Sheet in Pseudo Code:

fato = AIXM.fato(
  name: String
)
fato.length = AIXM.d or nil   # must use same unit as width
fato.width = AIXM.d or nil    # must use same unit as length
fato.surface = AIXM.surface
fato.marking = String or nil
fato.profile = String or nil
fato.status = STATUSES or nil
fato.remarks = String or nil
fato.add_direction(
  name: String
) do |direction|
  direction.geographic_orientation = AIXM.a[precision=3] or nil
  direction.remarks = String or nil
end

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 FATO
  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:) ⇒ FATO


68
69
70
71
72
# File 'lib/aixm/component/fato.rb', line 68

def initialize(name:)
  self.name = name
  @surface = AIXM.surface
  @directions = {}
end

Instance Attribute Details

#airportAIXM::Feature::Airport


39
40
41
# File 'lib/aixm/component/fato.rb', line 39

def airport
  @airport
end

#directionsHash{String => AIXM::Component::FATO::Direction} (readonly)


66
67
68
# File 'lib/aixm/component/fato.rb', line 66

def directions
  @directions
end

#lengthAIXM::D?


45
46
47
# File 'lib/aixm/component/fato.rb', line 45

def length
  @length
end

#markingString?


54
55
56
# File 'lib/aixm/component/fato.rb', line 54

def marking
  @marking
end

#nameString


42
43
44
# File 'lib/aixm/component/fato.rb', line 42

def name
  @name
end

#profileString?


57
58
59
# File 'lib/aixm/component/fato.rb', line 57

def profile
  @profile
end

#remarksString?


63
64
65
# File 'lib/aixm/component/fato.rb', line 63

def remarks
  @remarks
end

#statusSymbol?


60
61
62
# File 'lib/aixm/component/fato.rb', line 60

def status
  @status
end

#surfaceAIXM::Component::Surface (readonly)


51
52
53
# File 'lib/aixm/component/fato.rb', line 51

def surface
  @surface
end

#widthAIXM::D?


48
49
50
# File 'lib/aixm/component/fato.rb', line 48

def width
  @width
end

Instance Method Details

#add_direction(name:) {|direction| ... } ⇒ Object

Yields:

  • (direction)

122
123
124
125
126
# File 'lib/aixm/component/fato.rb', line 122

def add_direction(name:)
  direction = Direction.new(fato: self, name: name)
  yield direction
  @directions[name] = direction
end

#inspectString


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

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

#to_uidString


129
130
131
132
133
134
135
# File 'lib/aixm/component/fato.rb', line 129

def to_uid
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.FtoUid do |fto_uid|
    fto_uid << airport.to_uid.indent(2)
    fto_uid.txtDesig(name)
  end.insert_payload_hash(region: AIXM.config.mid_region)
end

#to_xmlString


138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/aixm/component/fato.rb', line 138

def to_xml
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.Fto do |fto|
    fto << to_uid.indent(2)
    fto.valLen(length.dist.trim) if length
    fto.valWid(width.dist.trim) if width
    fto.uomDim(length.unit.to_s.upcase) if length
    fto.uomDim(width.unit.to_s.upcase) if width && !length
    unless  (xml = surface.to_xml).empty?
      fto << xml.indent(2)
    end
    fto.txtProfile(profile) if profile
    fto.txtMarking(marking) if marking
    fto.codeSts(STATUSES.key(status).to_s) if status
    fto.txtRmk(remarks) if remarks
  end
  directions.values.each do |direction|
    builder << direction.to_xml
  end
  builder.target!
end