Class: Circle

Inherits:
Shape show all
Defined in:
app/models/circle.rb

Overview

A Circle has a center point and a radius, These attributes are available as cx, cy, r in addition to the PointSets in the path_operations collection.

Instance Method Summary (collapse)

Methods inherited from GraphicObject

#get_all_descendants, #get_display_attributes_svg, #get_display_attributes_xml

Instance Method Details

- (Object) to_legacy_xml(_options = {})



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/circle.rb', line 5

def to_legacy_xml(_options = {})
  dimensions = path.split(',') rescue nil
  cx = dimensions[0] rescue ''
  cy = dimensions[1] rescue ''
  r = dimensions[2] rescue ''

  xml = "<Circle id='#{id}' structure_id='#{structure_id}' parent_id='#{parent_id}' mag='#{mag}' "
  xml << "order='#{order}' cx='#{cx}' cy='#{cy}' r='#{r}' "
  xml << get_display_attributes_xml
  xml << "/>"
  return(xml)
end

- (Object) to_svg



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/circle.rb', line 18

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

  svg = "<circle id=\"#{id}\" structure_id=\"#{structure_id}\" parent_id=\"#{parent_id}\" mag='#{mag}' "
  svg << "order=\"#{order}\" cx=\"#{cx}\" cy=\"#{cy}\" r=\"#{r}\" "
  svg << get_display_attributes_svg
  svg << "/>"

  svg
end