Class: NOTAM::Q

Inherits:
Item
  • Object
show all
Defined in:
lib/notam/item/q.rb

Overview

The Q item provides the context such as the FIR or conditions.

Constant Summary collapse

RE =
%r(
  \A
  Q\)\s?
  (?<fir>#{ICAO_RE})/
  Q(?<subject>[A-Z]{2})(?<condition>[A-Z]{2})/
  (?<traffic>IV|(?:[IVK]\s?))/
  (?<purpose>NBO|BO\s?|(?:[BMK]\s{0,2}))/
  (?<scope>A[EW]|(?:[AEWK]\s?))/
  (?<lower_limit>\d{3})/
  (?<upper_limit>\d{3})/
  (?<lat_deg>\d{2})(?<lat_min>\d{2})(?<lat_dir>[NS])
  (?<long_deg>\d{3})(?<long_min>\d{2})(?<long_dir>[EW])
  (?<radius>\d{3})
  \z
)x.freeze

Constants inherited from Item

Item::ICAO_RE, Item::ID_RE, Item::TIME_RE

Instance Attribute Summary

Attributes inherited from Item

#captures, #data, #text

Instance Method Summary collapse

Methods inherited from Item

#fail!, #initialize, #inspect, #parse, #type, type

Constructor Details

This class inherits a constructor from NOTAM::Item

Instance Method Details

#center_pointAIXM::XY

Returns approximately affected area center point.

Returns:

  • (AIXM::XY)

    approximately affected area center point



81
82
83
84
85
86
# File 'lib/notam/item/q.rb', line 81

def center_point
  AIXM.xy(
    lat: %Q(#{captures['lat_deg']}°#{captures['lat_min']}'00"#{captures['lat_dir']}),
    long: %Q(#{captures['long_deg']}°#{captures['long_min']}'00"#{captures['long_dir']})
  )
end

#conditionSymbol

Returns:

  • (Symbol)


45
46
47
# File 'lib/notam/item/q.rb', line 45

def condition
  NOTAM.condition_for(captures['condition'])
end

#condition_groupSymbol

Returns:

  • (Symbol)


40
41
42
# File 'lib/notam/item/q.rb', line 40

def condition_group
  NOTAM.condition_group_for(captures['condition'][0,1])
end

#firString

Returns:

  • (String)


25
26
27
# File 'lib/notam/item/q.rb', line 25

def fir
  captures['fir']
end

#lower_limitAIXM::Z

Returns lower limit (QNE flight level) or AIXM::GROUND (aka: 0ft QFE).

Returns:

  • (AIXM::Z)

    lower limit (QNE flight level) or AIXM::GROUND (aka: 0ft QFE)



66
67
68
69
70
71
72
# File 'lib/notam/item/q.rb', line 66

def lower_limit
  if (limit = captures['lower_limit'].to_i).zero?
    AIXM::GROUND
  else
    AIXM.z(captures['lower_limit'].to_i, :qne)
  end
end

#mergeObject

See Also:



94
95
96
# File 'lib/notam/item/q.rb', line 94

def merge
  super(:fir, :subject_group, :subject, :condition_group, :condition, :traffic, :purpose, :scope, :lower_limit, :upper_limit, :center_point, :radius)
end

#purposeArray<Symbol>

Returns:

  • (Array<Symbol>)


55
56
57
# File 'lib/notam/item/q.rb', line 55

def purpose
  captures['purpose'].strip.chars.map { NOTAM.purpose_for(_1) }
end

#radiusAIXM::D

Returns approximately affected area radius.

Returns:

  • (AIXM::D)

    approximately affected area radius



89
90
91
# File 'lib/notam/item/q.rb', line 89

def radius
  AIXM.d(captures['radius'].to_i, :nm)
end

#scopeArray<Symbol>

Returns:

  • (Array<Symbol>)


60
61
62
# File 'lib/notam/item/q.rb', line 60

def scope
  captures['scope'].strip.chars.map { NOTAM.scope_for(_1) }
end

#subjectSymbol

Returns:

  • (Symbol)


35
36
37
# File 'lib/notam/item/q.rb', line 35

def subject
  NOTAM.subject_for(captures['subject'])
end

#subject_groupSymbol

Returns:

  • (Symbol)


30
31
32
# File 'lib/notam/item/q.rb', line 30

def subject_group
  NOTAM.subject_group_for(captures['subject'][0,1])
end

#trafficSymbol

Returns:

  • (Symbol)


50
51
52
# File 'lib/notam/item/q.rb', line 50

def traffic
  NOTAM.traffic_for(captures['traffic'].strip)
end

#upper_limitAIXM::Z

Returns upper limit (QNE flight level) or AIXM::UNLIMITED (aka: FL999 QNE).

Returns:

  • (AIXM::Z)

    upper limit (QNE flight level) or AIXM::UNLIMITED (aka: FL999 QNE)



76
77
78
# File 'lib/notam/item/q.rb', line 76

def upper_limit
  AIXM.z(captures['upper_limit'].to_i, :qne)
end