Class: AIPP::LF::AIP::Aerodromes
- Inherits:
-
AIP::Parser
- Object
- Parser
- AIP::Parser
- AIPP::LF::AIP::Aerodromes
- Includes:
- Helpers::Base, Helpers::Surface, Helpers::UsageLimitation
- Defined in:
- lib/aipp/regions/LF/aip/aerodromes.rb
Constant Summary collapse
- APPROACH_LIGHTING_TYPES =
{ 'CAT I' => :cat_1, 'CAT II' => :cat_2, 'CAT III' => :cat_3, 'CAT II-III' => :cat_2_and_3 }.freeze
- LIGHTING_POSITIONS =
{ threshold: 'Thr', touch_down_zone: 'Tdz', center_line: 'Axe', edge: 'Bord', runway_end: 'Fin', stopway_center_line: 'Swy' }.freeze
- LIGHTING_COLORS =
{ 'W' => :white, 'R' => :red, 'G' => :green, 'B' => :blue, 'Y' => :yellow }.freeze
- ICAO_LIGHTING_COLORS =
{ center_line: :white, edge: :white }.freeze
Constants included from Helpers::Surface
Constants included from Helpers::UsageLimitation
Helpers::UsageLimitation::LIMITATION_TYPES
Constants included from Helpers::Base
Instance Attribute Summary
Attributes inherited from Parser
Instance Method Summary collapse
Methods included from Helpers::Surface
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
#parse ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/aipp/regions/LF/aip/aerodromes.rb', line 37 def parse AIPP.cache.ad.css(%Q(Ad[lk^="[LF]"])).each do |ad_node| # Build airport next unless limitation_type = LIMITATION_TYPES.fetch(ad_node.(:AdStatut)) airport = AIXM.airport( source: source(part: 'AD', position: ad_node.line), organisation: organisation_lf, id: id_from(ad_node.(:AdCode)), name: ad_node.(:AdNomComplet), xy: xy_from(ad_node.(:Geometrie)) ).tap do |airport| airport. = ad_node.attr('pk') airport.z = given(ad_node.(:AdRefAltFt)) { AIXM.z(_1.to_i, :qnh) } airport.declination = ad_node.(:AdMagVar)&.to_f airport.add_usage_limitation(type: limitation_type.fetch(:limitation)) do |limitation| limitation.remarks = limitation_type[:remarks] [ (:scheduled if ad_node.(:TfcRegulier?)), (:not_scheduled if ad_node.(:TfcNonRegulier?)), (:private if ad_node.(:TfcPrive?)), (:other unless ad_node.(:TfcRegulier?) || ad_node.(:TfcNonRegulier?) || ad_node.(:TfcPrive?)) ].compact.each do |purpose| limitation.add_condition do |condition| condition.realm = limitation_type.fetch(:realm) condition.origin = case when ad_node.(:TfcIntl?) && ad_node.(:TfcNtl?) then :any when ad_node.(:TfcIntl?) then :international when ad_node.(:TfcNtl?) then :national else :other end condition.rule = case when ad_node.(:TfcIfr?) && ad_node.(:TfcVfr?) then :ifr_and_vfr when ad_node.(:TfcIfr?) then :ifr when ad_node.(:TfcVfr?) then :vfr else warn("falling back to VFR rule for `#{airport.id}'", severe: false) :vfr end condition.purpose = purpose end end end # TODO: link to VAC once supported downstream # # Link to VAC # airport.remarks = [ # airport.remarks.to_s, # link_to('VAC-AD', origin_for("VAC-#{airport.id}").file) # ].join("\n") AIPP.cache.rwy.css(%Q(Rwy:has(Ad[pk="#{ad_node.attr(:pk)}"]))).each do |rwy_node| add_runway_to(airport, rwy_node) end end add airport end end |