module EagleCAD::Geometry

Constants

Hole
Pad
Pin
Point

Public Class Methods

format(value) click to toggle source
# File lib/eaglecad/geometry.rb, line 255
def self.format(value)
    "%g" % value
end
from_xml(element) click to toggle source
# File lib/eaglecad/geometry.rb, line 224
def self.from_xml(element)
    case element.name
        when 'circle'
            Geometry::Circle.from_xml(element)
        when 'hole'
            Geometry::Hole.from_xml(element)
        when 'pad'
            Geometry::Pad.from_xml(element)
        when 'pin'
            Geometry::Pin.from_xml(element)
        when 'polygon'
            Geometry::Polygon.from_xml(element)
        when 'rectangle'
            Geometry::Rectangle.from_xml(element)
        when 'smd'
            Geometry::SMD.from_xml(element)
        when 'text'
            Geometry::Text.from_xml(element)
        when 'wire'
            Geometry::Line.from_xml(element)
    end
end
point_from(element, x_name='x', y_name='y') click to toggle source

Create a {Point} from the given {REXML::Element} using the passed attribute names @param [REXML::Element] element The {REXML::Element} to parse @param [String] x_name The name of the attribute containing the X coordinate @param [String] y_name The name of the attribute containing the Y coordinate

# File lib/eaglecad/geometry.rb, line 251
def self.point_from(element, x_name='x', y_name='y')
    Point[element.attributes[x_name].to_f, element.attributes[y_name].to_f]
end