Class: AIPP::LF::AIP::DangerousActivities

Inherits:
AIP::Parser show all
Includes:
Helpers::Base
Defined in:
lib/aipp/regions/LF/aip/dangerous_activities.rb

Constant Summary collapse

ACTIVITIES =

Map raw activities to type of activity airspace

{
  'AP' => { activity: :other, airspace: :dangerous_activities_area },
  'Aer' => { activity: :aeromodelling, airspace: :dangerous_activities_area },
  'Bal' => { activity: :balloon, airspace: :dangerous_activities_area },
  'Pje' => { activity: :parachuting, airspace: :dangerous_activities_area },
  'TrPVL' => { activity: :glider_winch, airspace: :dangerous_activities_area },
  'TrPla' => { activity: :glider_winch, airspace: :dangerous_activities_area },
  'TrVL' => { activity: :glider_winch, airspace: :dangerous_activities_area },
  'Vol' => { activity: :acrobatics, airspace: :dangerous_activities_area }
}.freeze

Constants included from Helpers::Base

Helpers::Base::VERSION

Instance Attribute Summary

Attributes inherited from Parser

#aixm

Instance Method Summary collapse

Methods included from Helpers::Base

#b_from, #d_from, #geometry_from, #layer_from, #organisation_lf, #origin_for, #setup, #source, #timetable_from, #xy_from, #z_from

Methods inherited from Parser

#add, dependencies, depends_on, #find, #find_by, #given, #initialize, #inspect, #link_to, #origin_for, #read, #section

Methods included from Patcher

#attach_patches, #detach_patches, included

Methods included from Debugger

#info, #original_warn, #verbose_info, #warn, #with_debugger

Constructor Details

This class inherits a constructor from AIPP::Parser

Instance Method Details

#parseObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/aipp/regions/LF/aip/dangerous_activities.rb', line 18

def parse
  ACTIVITIES.each do |code, type|
    verbose_info("processing #{code}")
    AIPP.cache.espace.css(%Q(Espace[lk^="[LF][#{code} "])).each do |espace_node|
# HACK: Missing partie/volume as of AIRAC 2312 (reported)
next if espace_node['pk'] == '302508'
      partie_node = AIPP.cache.partie.at_css(%Q(Partie:has(Espace[pk="#{espace_node['pk']}"])))
      volume_node = AIPP.cache.volume.at_css(%Q(Volume:has(Partie[pk="#{partie_node['pk']}"])))
      add(
        AIXM.airspace(
          source: source(part: 'ENR', position: espace_node.line),
          id: espace_node.(:Nom),
          type: type[:airspace],
          local_type: code.upcase,
          name: [espace_node.(:Nom), partie_node.(:NomUsuel)].join(' ')
        ).tap do |airspace|
          airspace.geometry = geometry_from partie_node.(:Contour)
          layer_from(volume_node).then do |layer|
            layer.activity = type[:activity]
            airspace.add_layer layer
          end
          airspace.layers.first.timetable = timetable_from(volume_node.(:HorCode))
          airspace.layers.first.remarks = volume_node.(:Remarque)
        end
      )
    end
  end
end