Class: Text

Inherits:
GraphicObject show all
Defined in:
app/models/text.rb

Instance Method Summary (collapse)

Methods inherited from GraphicObject

#get_all_descendants, #get_display_attributes_svg, #get_display_attributes_xml

Instance Method Details

- (Object) to_svg



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/text.rb', line 3

def to_svg
  dimensions = path.split(',') rescue nil
  cx = dimensions[0] rescue ''
  cy = dimensions[1] rescue ''

  svg = "<text id=\"#{id}\" structure_id=\"#{structure_id}\" parent_id=\"#{parent_id}\" "
  svg << "order=\"#{order}\" cx=\"#{cx}\" cy=\"#{cy}\" "
  svg << get_display_attributes_svg
  svg << ">"

  get_all_descendants.each do |d|
    svg << d.to_svg
  end
  svg << "</text>"

  svg
end