Sha256: 09e16fd688acfa635278cfe946a2804b73d52d3ad5bf0b4c490d9fa268e0269d

Contents?: true

Size: 1.58 KB

Versions: 13

Compression:

Stored size: 1.58 KB

Contents

using AIXM::Refinements

module AIXM
  class Component
    class Geometry

      # Borders are following natural or artifical border lines referenced by
      # {#name} and starting at {#xy}.
      #
      # ===Cheat Sheet in Pseudo Code:
      #   border = AIXM.border(
      #     xy: AIXM.xy
      #     name: String
      #   )
      #
      # @see https://gitlab.com/openflightmaps/ofmx/wikis/Airspace#frontier
      class Border < Point

        # Name of the border
        #
        # @overload name
        #   @return [String]
        # @overload name=(value)
        #   @param value [String]
        attr_reader :name

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

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

        def name=(value)
          fail(ArgumentError, "invalid name") unless value.is_a? String
          @name = value
        end

        # @!visibility private
        def add_uid_to(builder, as: :GbrUid)
          builder.send(as) do |tag|
            tag.txtName(name.to_s)
          end
        end

        # @!visibility private
        def add_to(builder)
          builder.Avx do |avx|
            add_uid_to(avx)
            avx.codeType('FNT')
            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/border.rb
aixm-1.5.2 lib/aixm/component/geometry/border.rb
aixm-1.5.1 lib/aixm/component/geometry/border.rb
aixm-1.5.0 lib/aixm/component/geometry/border.rb
aixm-1.4.3 lib/aixm/component/geometry/border.rb
aixm-1.4.2 lib/aixm/component/geometry/border.rb
aixm-1.4.1 lib/aixm/component/geometry/border.rb
aixm-1.4.0 lib/aixm/component/geometry/border.rb
aixm-1.3.4 lib/aixm/component/geometry/border.rb
aixm-1.3.3 lib/aixm/component/geometry/border.rb
aixm-1.3.2 lib/aixm/component/geometry/border.rb
aixm-1.3.1 lib/aixm/component/geometry/border.rb
aixm-1.3.0 lib/aixm/component/geometry/border.rb