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

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

#firstObject (readonly)



95
96
97
# File 'lib/dxf/entity.rb', line 95

def first
  @first
end

#lastObject (readonly)



101
102
103
# File 'lib/dxf/entity.rb', line 101

def last
  @last
end

#x1Object

Returns the value of attribute x1.



73
74
75
# File 'lib/dxf/entity.rb', line 73

def x1
  @x1
end

#x2Object

Returns the value of attribute x2.



74
75
76
# File 'lib/dxf/entity.rb', line 74

def x2
  @x2
end

#y1Object

Returns the value of attribute y1.



73
74
75
# File 'lib/dxf/entity.rb', line 73

def y1
  @y1
end

#y2Object

Returns the value of attribute y2.



74
75
76
# File 'lib/dxf/entity.rb', line 74

def y2
  @y2
end

#z1Object

Returns the value of attribute z1.



73
74
75
# File 'lib/dxf/entity.rb', line 73

def z1
  @z1
end

#z2Object

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