Class: Line
- Inherits:
-
Object
- Object
- Line
- Defined in:
- lib/r2d/line.rb
Overview
line.rb
Instance Attribute Summary collapse
-
#c1 ⇒ Object
readonly
Returns the value of attribute c1.
-
#c2 ⇒ Object
readonly
Returns the value of attribute c2.
-
#c3 ⇒ Object
readonly
Returns the value of attribute c3.
-
#c4 ⇒ Object
readonly
Returns the value of attribute c4.
-
#color ⇒ Object
Returns the value of attribute color.
-
#qx1 ⇒ Object
readonly
Returns the value of attribute qx1.
-
#qx2 ⇒ Object
readonly
Returns the value of attribute qx2.
-
#qx3 ⇒ Object
readonly
Returns the value of attribute qx3.
-
#qx4 ⇒ Object
readonly
Returns the value of attribute qx4.
-
#qy1 ⇒ Object
readonly
Returns the value of attribute qy1.
-
#qy2 ⇒ Object
readonly
Returns the value of attribute qy2.
-
#qy3 ⇒ Object
readonly
Returns the value of attribute qy3.
-
#qy4 ⇒ Object
readonly
Returns the value of attribute qy4.
-
#w ⇒ Object
Returns the value of attribute w.
-
#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.
Instance Method Summary collapse
- #add ⇒ Object
- #hide ⇒ Object
-
#initialize(x1, y1, x2, y2, w, c = "white", visible = true) ⇒ Line
constructor
A new instance of Line.
- #remove ⇒ Object
- #show ⇒ Object
Constructor Details
#initialize(x1, y1, x2, y2, w, c = "white", visible = true) ⇒ Line
Returns a new instance of Line.
9 10 11 12 13 14 |
# File 'lib/r2d/line.rb', line 9 def initialize(x1, y1, x2, y2, w, c="white", visible=true) @x1, @y1, @x2, @y2, @w, @color = x1, y1, x2, y2, w, c update_coords(x1, y1, x2, y2, w) update_color(c) if visible then add end end |
Instance Attribute Details
#c1 ⇒ Object (readonly)
Returns the value of attribute c1.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def c1 @c1 end |
#c2 ⇒ Object (readonly)
Returns the value of attribute c2.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def c2 @c2 end |
#c3 ⇒ Object (readonly)
Returns the value of attribute c3.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def c3 @c3 end |
#c4 ⇒ Object (readonly)
Returns the value of attribute c4.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def c4 @c4 end |
#color ⇒ Object
Returns the value of attribute color.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def color @color end |
#qx1 ⇒ Object (readonly)
Returns the value of attribute qx1.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def qx1 @qx1 end |
#qx2 ⇒ Object (readonly)
Returns the value of attribute qx2.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def qx2 @qx2 end |
#qx3 ⇒ Object (readonly)
Returns the value of attribute qx3.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def qx3 @qx3 end |
#qx4 ⇒ Object (readonly)
Returns the value of attribute qx4.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def qx4 @qx4 end |
#qy1 ⇒ Object (readonly)
Returns the value of attribute qy1.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def qy1 @qy1 end |
#qy2 ⇒ Object (readonly)
Returns the value of attribute qy2.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def qy2 @qy2 end |
#qy3 ⇒ Object (readonly)
Returns the value of attribute qy3.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def qy3 @qy3 end |
#qy4 ⇒ Object (readonly)
Returns the value of attribute qy4.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def qy4 @qy4 end |
#w ⇒ Object
Returns the value of attribute w.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def w @w end |
#x1 ⇒ Object
Returns the value of attribute x1.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def x1 @x1 end |
#x2 ⇒ Object
Returns the value of attribute x2.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def x2 @x2 end |
#y1 ⇒ Object
Returns the value of attribute y1.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def y1 @y1 end |
#y2 ⇒ Object
Returns the value of attribute y2.
5 6 7 |
# File 'lib/r2d/line.rb', line 5 def y2 @y2 end |
Instance Method Details
#hide ⇒ Object
55 |
# File 'lib/r2d/line.rb', line 55 def hide; remove end |
#show ⇒ Object
54 |
# File 'lib/r2d/line.rb', line 54 def show; add end |