Class: RXaal::Coordinate

Inherits:
XaalElement show all
Defined in:
lib/coordinate.rb

Direct Known Subclasses

Center

Instance Attribute Summary collapse

Attributes inherited from XaalElement

#doc, #id, #refs

Instance Method Summary collapse

Methods inherited from XaalElement

#add_attribute, #add_ref, get_new_default_id, modify_ref, #rm_ref, #superclass_serialize

Constructor Details

#initialize(doc, xpos, ypos, id = nil, elem_ns = nil) ⇒ Coordinate

Returns a new instance of Coordinate.



4
5
6
7
8
# File 'lib/coordinate.rb', line 4

def initialize(doc, xpos, ypos, id= nil, elem_ns=nil)
  super(doc, id, elem_ns)
  @xpos= xpos
  @ypos= ypos
end

Instance Attribute Details

#xposObject

Returns the value of attribute xpos.



3
4
5
# File 'lib/coordinate.rb', line 3

def xpos
  @xpos
end

#yposObject

Returns the value of attribute ypos.



3
4
5
# File 'lib/coordinate.rb', line 3

def ypos
  @ypos
end

Instance Method Details

#xaal_serialize(parent) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/coordinate.rb', line 10

def xaal_serialize(parent)
  elem = Element.new "coordinate"
  elem.attributes["x"] = @xpos.to_s
  elem.attributes["y"] = @ypos.to_s
  elem.attributes["id"] = self.id
  parent.elements << elem
  
  superclass_serialize(elem)
end