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

Inherits:
Point show all
Includes:
Memoize
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

Methods included from Memoize

cache, included, method

Methods inherited from Point

#geometry

Methods included from Association

included

Constructor Details

#initialize(xy:, name:) ⇒ Border


23
24
25
26
# File 'lib/aixm/component/geometry/border.rb', line 23

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

Instance Attribute Details

#nameString


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

def name
  @name
end

Instance Method Details

#inspectString


29
30
31
# File 'lib/aixm/component/geometry/border.rb', line 29

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

#to_uid(as: :GbrUid) ⇒ String


39
40
41
42
43
44
# File 'lib/aixm/component/geometry/border.rb', line 39

def to_uid(as: :GbrUid)
  builder = Builder::XmlMarkup.new(indent: 2)
  builder.tag!(as) do |tag|
    tag.txtName(name.to_s)
  end
end

#to_xmlString


48
49
50
51
52
53
54
55
56
57
# File 'lib/aixm/component/geometry/border.rb', line 48

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