Class: DXF::Circle

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

#centerObject (readonly)



61
62
63
64
65
# File 'lib/dxf/entity.rb', line 61

def center
    a = [x, y, z]
    a.pop until a.last
    Geometry::Point[*a]
end

#radiusObject

Returns the value of attribute radius.



46
47
48
# File 'lib/dxf/entity.rb', line 46

def radius
  @radius
end

#xObject

Returns the value of attribute x.



45
46
47
# File 'lib/dxf/entity.rb', line 45

def x
  @x
end

#yObject

Returns the value of attribute y.



45
46
47
# File 'lib/dxf/entity.rb', line 45

def y
  @y
end

#zObject

Returns the value of attribute z.



45
46
47
# File 'lib/dxf/entity.rb', line 45

def z
  @z
end

Instance Method Details

#parse_pair(code, value) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/dxf/entity.rb', line 48

def parse_pair(code, value)
    case code
	when '10'   then self.x = value.to_f
	when '20'   then self.y = value.to_f
	when '30'   then self.z = value.to_f
	when '40'   then self.radius = value.to_f
	else
	    super   # Handle common and unrecognized codes
    end
end