Class: EagleCAD::Geometry::Pin

Inherits:
Struct
  • Object
show all
Defined in:
lib/eaglecad/geometry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#directionObject

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



81
82
83
# File 'lib/eaglecad/geometry.rb', line 81

def direction
  @direction
end

#functionObject

Returns the value of attribute function

Returns:

  • (Object)

    the current value of function



81
82
83
# File 'lib/eaglecad/geometry.rb', line 81

def function
  @function
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



81
82
83
# File 'lib/eaglecad/geometry.rb', line 81

def length
  @length
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



81
82
83
# File 'lib/eaglecad/geometry.rb', line 81

def name
  @name
end

#originObject

Returns the value of attribute origin

Returns:

  • (Object)

    the current value of origin



81
82
83
# File 'lib/eaglecad/geometry.rb', line 81

def origin
  @origin
end

#rotationObject

Returns the value of attribute rotation

Returns:

  • (Object)

    the current value of rotation



81
82
83
# File 'lib/eaglecad/geometry.rb', line 81

def rotation
  @rotation
end

#swaplevelObject

Returns the value of attribute swaplevel

Returns:

  • (Object)

    the current value of swaplevel



81
82
83
# File 'lib/eaglecad/geometry.rb', line 81

def swaplevel
  @swaplevel
end

#visibleObject

Returns the value of attribute visible

Returns:

  • (Object)

    the current value of visible



81
82
83
# File 'lib/eaglecad/geometry.rb', line 81

def visible
  @visible
end

Class Method Details

.from_xml(element) ⇒ Object



82
83
84
85
# File 'lib/eaglecad/geometry.rb', line 82

def self.from_xml(element)
		origin = Geometry.point_from(element, 'x', 'y')
		Geometry::Pin.new(element.attributes['direction'], element.attributes['function'], element.attributes['length'], element.attributes['name'], origin, element.attributes['swaplevel'], element.attributes['rot'], element.attributes['visible'])
end

Instance Method Details

#to_xmlREXML::Element

Returns:

  • (REXML::Element)


88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/eaglecad/geometry.rb', line 88

def to_xml
		REXML::Element.new('pin').tap do |element|
 element.add_attributes({'name' => name,
    'x' => Geometry.format(origin.x),
    'y' => Geometry.format(origin.y),
    'direction' => direction,
    'function' => function,
    'length' => length,
    'swaplevel' => swaplevel,
    'rot' => rotation,
    'visible' => visible})
		end
end