Class: AIXM::Component::VerticalLimits

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(upper_z:, max_z: nil, lower_z:, min_z: nil) ⇒ 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_zAIXM::Z


39
40
41
# File 'lib/aixm/component/vertical_limits.rb', line 39

def lower_z
  @lower_z
end

#max_zAIXM::Z


42
43
44
# File 'lib/aixm/component/vertical_limits.rb', line 42

def max_z
  @max_z
end

#min_zAIXM::Z


45
46
47
# File 'lib/aixm/component/vertical_limits.rb', line 45

def min_z
  @min_z
end

#upper_zAIXM::Z


36
37
38
# File 'lib/aixm/component/vertical_limits.rb', line 36

def upper_z
  @upper_z
end

Instance Method Details

#inspectString


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_xmlString


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