Class: AIXM::Component::Geometry::Point

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/aixm/component/geometry/point.rb

Overview

Points are defined by #xy coordinates.

Cheat Sheet in Pseudo Code:

point = AIXM.point(
  xy: AIXM.xy
)

Direct Known Subclasses

Arc, Border

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xy:) ⇒ Point


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

def initialize(xy:)
  self.xy = xy
end

Instance Attribute Details

#xyAIXM::XY


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

def xy
  @xy
end

Instance Method Details

#inspectString


28
29
30
# File 'lib/aixm/component/geometry/point.rb', line 28

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

#to_xmlString


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

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