Class: AIXM::Component::VerticalLimit

Inherits:
Object
  • Object
show all
Includes:
Association
Defined in:
lib/aixm/component/vertical_limit.rb

Overview

Vertical limit defines a 3D airspace vertically. It is 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_limit = AIXM.vertical_limit(
  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

Methods included from Association

included

Constructor Details

#initialize(upper_z:, max_z: nil, lower_z:, min_z: nil) ⇒ VerticalLimit

Returns a new instance of VerticalLimit.


53
54
55
# File 'lib/aixm/component/vertical_limit.rb', line 53

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

Returns lower limit.

Returns:


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

def lower_z
  @lower_z
end

#max_zAIXM::Z

Returns alternative upper limit (“whichever is higher”).

Returns:

  • (AIXM::Z)

    alternative upper limit (“whichever is higher”)


48
49
50
# File 'lib/aixm/component/vertical_limit.rb', line 48

def max_z
  @max_z
end

#min_zAIXM::Z

Returns alternative lower limit (“whichever is lower”).

Returns:

  • (AIXM::Z)

    alternative lower limit (“whichever is lower”)


51
52
53
# File 'lib/aixm/component/vertical_limit.rb', line 51

def min_z
  @min_z
end

#upper_zAIXM::Z

Returns upper limit.

Returns:


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

def upper_z
  @upper_z
end

Instance Method Details

#inspectString

Returns:

  • (String)

58
59
60
61
# File 'lib/aixm/component/vertical_limit.rb', line 58

def inspect
  payload = %i(upper_z max_z lower_z min_z).map { %Q(#{_1}="#{send(_1)}") if send(_1) }.compact
  %Q(#<#{self.class} #{payload.join(' ')}>)
end

#layerAIXM::Component::Layer

Returns layer to which this vertical limit applies.

Returns:


39
# File 'lib/aixm/component/vertical_limit.rb', line 39

belongs_to :layer

#to_xmlString

Returns AIXM or OFMX markup.

Returns:

  • (String)

    AIXM or OFMX markup


84
85
86
87
88
89
90
91
92
# File 'lib/aixm/component/vertical_limit.rb', line 84

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