Class: EagleCAD::Geometry::Pin
- Inherits:
-
Struct
- Object
- Struct
- EagleCAD::Geometry::Pin
- Defined in:
- lib/eaglecad/geometry.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#function ⇒ Object
Returns the value of attribute function.
-
#length ⇒ Object
Returns the value of attribute length.
-
#name ⇒ Object
Returns the value of attribute name.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#swaplevel ⇒ Object
Returns the value of attribute swaplevel.
-
#visible ⇒ Object
Returns the value of attribute visible.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#direction ⇒ Object
Returns the value of attribute direction
81 82 83 |
# File 'lib/eaglecad/geometry.rb', line 81 def direction @direction end |
#function ⇒ Object
Returns the value of attribute function
81 82 83 |
# File 'lib/eaglecad/geometry.rb', line 81 def function @function end |
#length ⇒ Object
Returns the value of attribute length
81 82 83 |
# File 'lib/eaglecad/geometry.rb', line 81 def length @length end |
#name ⇒ Object
Returns the value of attribute name
81 82 83 |
# File 'lib/eaglecad/geometry.rb', line 81 def name @name end |
#origin ⇒ Object
Returns the value of attribute origin
81 82 83 |
# File 'lib/eaglecad/geometry.rb', line 81 def origin @origin end |
#rotation ⇒ Object
Returns the value of attribute rotation
81 82 83 |
# File 'lib/eaglecad/geometry.rb', line 81 def rotation @rotation end |
#swaplevel ⇒ Object
Returns the value of attribute swaplevel
81 82 83 |
# File 'lib/eaglecad/geometry.rb', line 81 def swaplevel @swaplevel end |
#visible ⇒ Object
Returns the value of attribute 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_xml ⇒ 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 |