Class: AIXM::Component::FATO

Inherits:
Object
  • Object
show all
Includes:
Association, Memoize
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

Methods included from Memoize

cache, included, method

Methods included from Association

included

Constructor Details

#initialize(name:) ⇒ FATO


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

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

Instance Attribute Details

#lengthAIXM::D?


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

def length
  @length
end

#markingString?


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

def marking
  @marking
end

#nameString


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

def name
  @name
end

#profileString?


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

def profile
  @profile
end

#remarksString?


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

def remarks
  @remarks
end

#statusSymbol?


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

def status
  @status
end

#widthAIXM::D?


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

def width
  @width
end

Instance Method Details

#add_direction(direction) ⇒ self


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

has_many :directions, accept: 'AIXM::Component::FATO::Direction' do |direction, name:| end

#airportAIXM::Feature::Airport


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

belongs_to :airport

#directionsArray<AIXM::Component::FATO::Direction>


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

has_many :directions, accept: 'AIXM::Component::FATO::Direction' do |direction, name:| end

#helipadAIXM::Component::Helipad


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

belongs_to :helipad

#inspectString


89
90
91
# File 'lib/aixm/component/fato.rb', line 89

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

#surfaceAIXM::Component::Surface


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

has_one :surface

#surface=(surface) ⇒ Object


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

has_one :surface

#to_uidString


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

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
end

#to_xmlString


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

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.each do |direction|
    builder << direction.to_xml
  end
  builder.target!
end