Class: DXF::Line
Constant Summary
Constants inherited from Entity
Instance Attribute Summary collapse
- #first ⇒ Object readonly
- #last ⇒ Object readonly
-
#x1 ⇒ Object
Returns the value of attribute x1.
-
#x2 ⇒ Object
Returns the value of attribute x2.
-
#y1 ⇒ Object
Returns the value of attribute y1.
-
#y2 ⇒ Object
Returns the value of attribute y2.
-
#z1 ⇒ Object
Returns the value of attribute z1.
-
#z2 ⇒ Object
Returns the value of attribute z2.
Attributes inherited from Entity
Instance Method Summary collapse
-
#initialize(*args) ⇒ Line
constructor
A new instance of Line.
- #parse_pair(code, value) ⇒ Object
Methods inherited from Entity
Methods included from ClusterFactory
Constructor Details
#initialize(*args) ⇒ Line
Returns a new instance of Line.
89 90 91 |
# File 'lib/dxf/entity.rb', line 89 def initialize(*args) @first, @last = *args end |
Instance Attribute Details
#first ⇒ Object (readonly)
95 96 97 |
# File 'lib/dxf/entity.rb', line 95 def first @first end |
#last ⇒ Object (readonly)
101 102 103 |
# File 'lib/dxf/entity.rb', line 101 def last @last end |
#x1 ⇒ Object
Returns the value of attribute x1.
73 74 75 |
# File 'lib/dxf/entity.rb', line 73 def x1 @x1 end |
#x2 ⇒ Object
Returns the value of attribute x2.
74 75 76 |
# File 'lib/dxf/entity.rb', line 74 def x2 @x2 end |
#y1 ⇒ Object
Returns the value of attribute y1.
73 74 75 |
# File 'lib/dxf/entity.rb', line 73 def y1 @y1 end |
#y2 ⇒ Object
Returns the value of attribute y2.
74 75 76 |
# File 'lib/dxf/entity.rb', line 74 def y2 @y2 end |
#z1 ⇒ Object
Returns the value of attribute z1.
73 74 75 |
# File 'lib/dxf/entity.rb', line 73 def z1 @z1 end |
#z2 ⇒ Object
Returns the value of attribute z2.
74 75 76 |
# File 'lib/dxf/entity.rb', line 74 def z2 @z2 end |
Instance Method Details
#parse_pair(code, value) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/dxf/entity.rb', line 76 def parse_pair(code, value) case code when '10' then self.x1 = value.to_f when '20' then self.y1 = value.to_f when '30' then self.z1 = value.to_f when '11' then self.x2 = value.to_f when '21' then self.y2 = value.to_f when '31' then self.z2 = value.to_f else super # Handle common and unrecognized codes end end |