Class: AIXM::Component::Geometry::Border

Inherits:
Point
  • Object
show all
Defined in:
lib/aixm/component/geometry/border.rb

Overview

Borders are following natural or artifical border lines referenced by #name and starting at Point#xy.

Cheat Sheet in Pseudo Code:

border = AIXM.border(
  xy: AIXM.xy
  name: String
)

Instance Attribute Summary collapse

Attributes inherited from Point

#xy

Instance Method Summary collapse

Constructor Details

#initialize(xy:, name:) ⇒ Border

Returns a new instance of Border


21
22
23
24
# File 'lib/aixm/component/geometry/border.rb', line 21

def initialize(xy:, name:)
  super(xy: xy)
  self.name = name
end

Instance Attribute Details

#nameString

Returns name of the border

Returns:

  • (String)

    name of the border


19
20
21
# File 'lib/aixm/component/geometry/border.rb', line 19

def name
  @name
end

Instance Method Details

#inspectString

Returns:

  • (String)

27
28
29
# File 'lib/aixm/component/geometry/border.rb', line 27

def inspect
  %Q(#<#{self.class} xy="#{xy.to_s}">)
end

#to_xmlString

Returns AIXM or OFMX markup

Returns:

  • (String)

    AIXM or OFMX markup


37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/aixm/component/geometry/border.rb', line 37

def to_xml
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.Avx do |avx|
    avx.GbrUid do |gbr_uid|
      gbr_uid.txtName(name.to_s)
    end
    avx.codeType('FNT')
    avx.geoLat(xy.lat(AIXM.schema))
    avx.geoLong(xy.long(AIXM.schema))
    avx.codeDatum('WGE')
  end
end