Sha256: 78778e951ade098f00f8de692ad43f5c089082a9c40a642f8c26aaa1ae0dad78

Contents?: true

Size: 1.57 KB

Versions: 13

Compression:

Stored size: 1.57 KB

Contents

using AIXM::Refinements

module AIXM
  class Component
    class Geometry

      # Starting point of a rhumb line which describes a spiral on a sphere
      # crossing all meridians at the same angle. Defined by {#xy} coordinates.
      #
      # ===Cheat Sheet in Pseudo Code:
      #   point = AIXM.rhumb_line(
      #     xy: AIXM.xy
      #   )
      #
      # @see https://gitlab.com/openflightmaps/ofmx/wikis/Airspace#rhumb-line
      class RhumbLine
        include AIXM::Concerns::Association
        include AIXM::Concerns::XMLBuilder

        # @!method geometry
        #   @return [AIXM::Component::Geometry] geometry this segment belongs to
        belongs_to :geometry, as: :segment

        # (Starting) point
        #
        # @overload xy
        #   @return [AIXM::XY]
        # @overload xy=(value)
        #   @param value [AIXM::XY]
        attr_reader :xy

        # See the {cheat sheet}[AIXM::Component::Geometry::RhumbLine] for
        # examples on how to create instances of this class.
        def initialize(xy:)
          self.xy = xy
        end

        # @return [String]
        def inspect
          %Q(#<#{self.class} xy="#{xy}">)
        end

        def xy=(value)
          fail(ArgumentError, "invalid xy") unless value.is_a? AIXM::XY
          @xy = value
        end

        # @!visibility private
        def add_to(builder)
          builder.Avx do |avx|
            avx.codeType('RHL')
            avx.geoLat(xy.lat(AIXM.schema))
            avx.geoLong(xy.long(AIXM.schema))
            avx.codeDatum('WGE')
          end
        end
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
aixm-1.5.3 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.5.2 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.5.1 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.5.0 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.4.3 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.4.2 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.4.1 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.4.0 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.3.4 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.3.3 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.3.2 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.3.1 lib/aixm/component/geometry/rhumb_line.rb
aixm-1.3.0 lib/aixm/component/geometry/rhumb_line.rb