Class: AIPP::LF::AIP::ServicedAirspaces
- Inherits:
-
AIP::Parser
- Object
- Parser
- AIP::Parser
- AIPP::LF::AIP::ServicedAirspaces
- Includes:
- Helpers::Base
- Defined in:
- lib/aipp/regions/LF/aip/serviced_airspaces.rb
Constant Summary collapse
- SOURCE_TYPES =
Map source types to type and optional local type and skip regexp
{ 'FIR' => { type: 'FIR' }, 'UIR' => { type: 'UIR' }, 'UTA' => { type: 'UTA' }, 'CTA' => { type: 'CTA' }, 'LTA' => { type: 'CTA', local_type: 'LTA' }, 'TMA' => { type: 'TMA', skip: /geneve/i }, # Geneva listed FYI only 'SIV' => { type: 'SECTOR', local_type: 'FIZ/SIV' }, # providing FIS 'CTR' => { type: 'CTR' }, 'RMZ' => { type: 'RMZ' }, 'TMZ' => { type: 'TMZ' }, 'RMZ-TMZ' => { type: ['RMZ', 'TMZ'] } # two separate airspaces }.freeze
- FIR_LOCATION_INDICATORS =
Map airspace “<type> <name>” to location indicator
{ 'BORDEAUX' => 'LFBB', 'BREST' => 'LFRR', 'MARSEILLE' => 'LFMM', 'PARIS' => 'LFFF', 'REIMS' => 'LFRR' }.freeze
- DELEGATED_RE =
/(?:deleg\.|delegated|delegation)/i.freeze
Constants included from Helpers::Base
Instance Attribute Summary
Attributes inherited from Parser
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
#parse ⇒ Object
34 35 36 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 |
# File 'lib/aipp/regions/LF/aip/serviced_airspaces.rb', line 34 def parse SOURCE_TYPES.each do |source_type, target| verbose_info("processing #{source_type}") AIPP.cache.espace.css(%Q(Espace[lk^="[LF][#{source_type} "])).each do |espace_node| next if espace_node.(:Nom).match? DELEGATED_RE next if (re = target[:skip]) && espace_node.(:Nom).match?(re) # Build airspaces and layers partie_nodes = AIPP.cache.partie.css(%Q(Partie:has(Espace[pk="#{espace_node['pk']}"]))) partie_nodes.each_with_index do |partie_node, index| next if partie_node.(:NomPartie).match? DELEGATED_RE partie_nom = partie_node.(:NomPartie).remove(/^\.$/).blank_to_nil partie_index = if partie_nodes.count > 1 if partie_nom.match?(/^\d+$/) partie_nom.to_i # use declared index if numerical... else index # ...or positional index otherwise end end [target[:type]].flatten.each do |type| add( AIXM.airspace( source: source(part: 'ENR', position: espace_node.line), id: id_from(espace_node, partie_index), name: name_from(espace_node, partie_nom), type: type, local_type: target[:local_type] ).tap do |airspace| airspace. = espace_node.attr('pk') airspace.geometry = geometry_from(partie_node.(:Contour)) fail("geometry is not closed") unless airspace.geometry.closed? AIPP.cache.volume.css(%Q(Volume:has(Partie[pk="#{partie_node['pk']}"]))).each do |volume_node| airspace.add_layer( layer_from(volume_node).tap do |layer| layer.location_indicator = FIR_LOCATION_INDICATORS.fetch(airspace.name) if airspace.type == :flight_information_region end ) end end ) end end end end end |