class EagleCAD::Geometry::Circle
Attributes
line_width[RW]
Public Class Methods
from_xml(element)
click to toggle source
Create a {Circle} from an {REXML::Element} @param [Element] element The {REXML::Element} to parse
# File lib/eaglecad/geometry.rb, line 14 def self.from_xml(element) self.new center:Geometry.point_from(element, 'x', 'y'), radius:element.attributes['radius'].to_f, line_width:element.attributes['width'].to_f end
new(options={})
click to toggle source
Calls superclass method
# File lib/eaglecad/geometry.rb, line 18 def initialize(options={}) @line_width = options.delete(:line_width) super options[:center], options[:radius] end
Public Instance Methods
to_xml()
click to toggle source
@return [REXML::Element]
# File lib/eaglecad/geometry.rb, line 24 def to_xml REXML::Element.new('circle').tap {|element| element.add_attributes({'x' => Geometry.format(center.x), 'y' => Geometry.format(center.y), 'radius' => Geometry.format(radius), 'width' => line_width}) } end