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


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


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

def name
  @name
end

Instance Method Details

#inspectString


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

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

#to_uid(as: :GbrUid) ⇒ String


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

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

#to_xmlString


45
46
47
48
49
50
51
52
53
54
# File 'lib/aixm/component/geometry/border.rb', line 45

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