Class: AIXM::Component::VerticalLimits
- Inherits:
-
Object
- Object
- AIXM::Component::VerticalLimits
- Defined in:
- lib/aixm/component/vertical_limits.rb
Overview
Vertical limits define a 3D airspace vertically. They are often noted in AIP as follows:
upper_z
(max_z) whichever is higher
-------
lower_z
(min_z) whichever is lower
Cheat Sheet in Pseudo Code:
vertical_limits = AIXM.vertical_limits(
upper_z: AIXM.z
max_z: AIXM.z or nil
lower_z: AIXM.z
min_z: AIXM.z or nil
)
Shortcuts:
-
AIXM::GROUND- surface expressed as “0 ft QFE” -
AIXM::UNLIMITED- no upper limit expressed as “FL 999”
Constant Summary collapse
- TAGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ upper_z: :Upper, lower_z: :Lower, max_z: :Max, min_z: :Mnm }.freeze
- CODES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ qfe: :HEI, qnh: :ALT, qne: :STD }.freeze
Instance Attribute Summary collapse
-
#lower_z ⇒ AIXM::Z
Lower limit.
-
#max_z ⇒ AIXM::Z
Alternative upper limit (“whichever is higher”).
-
#min_z ⇒ AIXM::Z
Alternative lower limit (“whichever is lower”).
-
#upper_z ⇒ AIXM::Z
Upper limit.
Instance Method Summary collapse
-
#initialize(upper_z:, max_z: nil, lower_z:, min_z: nil) ⇒ VerticalLimits
constructor
A new instance of VerticalLimits.
- #inspect ⇒ String
-
#to_xml ⇒ String
AIXM or OFMX markup.
Constructor Details
#initialize(upper_z:, max_z: nil, lower_z:, min_z: nil) ⇒ VerticalLimits
Returns a new instance of VerticalLimits.
47 48 49 |
# File 'lib/aixm/component/vertical_limits.rb', line 47 def initialize(upper_z:, max_z: nil, lower_z:, min_z: nil) self.upper_z, self.max_z, self.lower_z, self.min_z = upper_z, max_z, lower_z, min_z end |
Instance Attribute Details
#lower_z ⇒ AIXM::Z
Returns lower limit.
39 40 41 |
# File 'lib/aixm/component/vertical_limits.rb', line 39 def lower_z @lower_z end |
#max_z ⇒ AIXM::Z
Returns alternative upper limit (“whichever is higher”).
42 43 44 |
# File 'lib/aixm/component/vertical_limits.rb', line 42 def max_z @max_z end |
#min_z ⇒ AIXM::Z
Returns alternative lower limit (“whichever is lower”).
45 46 47 |
# File 'lib/aixm/component/vertical_limits.rb', line 45 def min_z @min_z end |
#upper_z ⇒ AIXM::Z
Returns upper limit.
36 37 38 |
# File 'lib/aixm/component/vertical_limits.rb', line 36 def upper_z @upper_z end |
Instance Method Details
#inspect ⇒ String
52 53 54 55 |
# File 'lib/aixm/component/vertical_limits.rb', line 52 def inspect payload = i(upper_z max_z lower_z min_z).map { |l| %Q(#{l}="#{send(l)}") if send(l) }.compact %Q(#<#{self.class} #{payload.join(' ')}>) end |
#to_xml ⇒ String
Returns AIXM or OFMX markup.
78 79 80 81 82 83 84 85 86 |
# File 'lib/aixm/component/vertical_limits.rb', line 78 def to_xml TAGS.keys.each_with_object(Builder::XmlMarkup.new(indent: 2)) do |limit, builder| if z = send(limit) builder.tag!(:"codeDistVer#{TAGS[limit]}", CODES[z.code].to_s) builder.tag!(:"valDistVer#{TAGS[limit]}", z.alt.to_s) builder.tag!(:"uomDistVer#{TAGS[limit]}", z.unit.upcase.to_s) end end.target! end |