Class: DXF::Line

Inherits:
Entity show all
Defined in:
lib/dxf/entity.rb

Constant Summary

Constants inherited from Entity

Entity::TypeError

Instance Attribute Summary collapse

Attributes inherited from Entity

#handle, #layer

Instance Method Summary collapse

Methods inherited from Entity

new

Methods included from ClusterFactory

included

Instance Attribute Details

#firstObject (readonly)



87
88
89
# File 'lib/dxf/entity.rb', line 87

def first
    point_from_values x1, y1, z1
end

#lastObject (readonly)



93
94
95
# File 'lib/dxf/entity.rb', line 93

def last
    point_from_values x2, y2, z2
end

#x1Object

Returns the value of attribute x1.



69
70
71
# File 'lib/dxf/entity.rb', line 69

def x1
  @x1
end

#x2Object

Returns the value of attribute x2.



70
71
72
# File 'lib/dxf/entity.rb', line 70

def x2
  @x2
end

#y1Object

Returns the value of attribute y1.



69
70
71
# File 'lib/dxf/entity.rb', line 69

def y1
  @y1
end

#y2Object

Returns the value of attribute y2.



70
71
72
# File 'lib/dxf/entity.rb', line 70

def y2
  @y2
end

#z1Object

Returns the value of attribute z1.



69
70
71
# File 'lib/dxf/entity.rb', line 69

def z1
  @z1
end

#z2Object

Returns the value of attribute z2.



70
71
72
# File 'lib/dxf/entity.rb', line 70

def z2
  @z2
end

Instance Method Details

#parse_pair(code, value) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/dxf/entity.rb', line 72

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