Sha256: 75aac604f5df59056c89d7c99568b3d232a7481920b9be6aa38a6b6217a46452

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

using AIXM::Refinements

module AIXM
  class Component
    class Geometry

      # Points are defined by {#xy} coordinates.
      #
      # ===Cheat Sheet in Pseudo Code:
      #   point = AIXM.point(
      #     xy: AIXM.xy
      #   )
      #
      # @see https://github.com/openflightmaps/ofmx/wiki/Airspace#point
      class Point
        # @return [AIXM::XY] (starting) point
        attr_reader :xy

        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

        # @return [String] AIXM or OFMX markup
        def to_xml
          builder = Builder::XmlMarkup.new(indent: 2)
          builder.Avx do |avx|
            avx.codeType('GRC')
            avx.geoLat(xy.lat(AIXM.schema))
            avx.geoLong(xy.long(AIXM.schema))
            avx.codeDatum('WGE')
          end
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aixm-0.3.8 lib/aixm/component/geometry/point.rb
aixm-0.3.7 lib/aixm/component/geometry/point.rb
aixm-0.3.6 lib/aixm/component/geometry/point.rb
aixm-0.3.5 lib/aixm/component/geometry/point.rb