Class: Line

Inherits:
Object
  • Object
show all
Defined in:
lib/r2d/line.rb

Overview

line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#c1Object (readonly)

Returns the value of attribute c1.



5
6
7
# File 'lib/r2d/line.rb', line 5

def c1
  @c1
end

#c2Object (readonly)

Returns the value of attribute c2.



5
6
7
# File 'lib/r2d/line.rb', line 5

def c2
  @c2
end

#c3Object (readonly)

Returns the value of attribute c3.



5
6
7
# File 'lib/r2d/line.rb', line 5

def c3
  @c3
end

#c4Object (readonly)

Returns the value of attribute c4.



5
6
7
# File 'lib/r2d/line.rb', line 5

def c4
  @c4
end

#colorObject

Returns the value of attribute color.



5
6
7
# File 'lib/r2d/line.rb', line 5

def color
  @color
end

#qx1Object (readonly)

Returns the value of attribute qx1.



5
6
7
# File 'lib/r2d/line.rb', line 5

def qx1
  @qx1
end

#qx2Object (readonly)

Returns the value of attribute qx2.



5
6
7
# File 'lib/r2d/line.rb', line 5

def qx2
  @qx2
end

#qx3Object (readonly)

Returns the value of attribute qx3.



5
6
7
# File 'lib/r2d/line.rb', line 5

def qx3
  @qx3
end

#qx4Object (readonly)

Returns the value of attribute qx4.



5
6
7
# File 'lib/r2d/line.rb', line 5

def qx4
  @qx4
end

#qy1Object (readonly)

Returns the value of attribute qy1.



5
6
7
# File 'lib/r2d/line.rb', line 5

def qy1
  @qy1
end

#qy2Object (readonly)

Returns the value of attribute qy2.



5
6
7
# File 'lib/r2d/line.rb', line 5

def qy2
  @qy2
end

#qy3Object (readonly)

Returns the value of attribute qy3.



5
6
7
# File 'lib/r2d/line.rb', line 5

def qy3
  @qy3
end

#qy4Object (readonly)

Returns the value of attribute qy4.



5
6
7
# File 'lib/r2d/line.rb', line 5

def qy4
  @qy4
end

#wObject

Returns the value of attribute w.



5
6
7
# File 'lib/r2d/line.rb', line 5

def w
  @w
end

#x1Object

Returns the value of attribute x1.



5
6
7
# File 'lib/r2d/line.rb', line 5

def x1
  @x1
end

#x2Object

Returns the value of attribute x2.



5
6
7
# File 'lib/r2d/line.rb', line 5

def x2
  @x2
end

#y1Object

Returns the value of attribute y1.



5
6
7
# File 'lib/r2d/line.rb', line 5

def y1
  @y1
end

#y2Object

Returns the value of attribute y2.



5
6
7
# File 'lib/r2d/line.rb', line 5

def y2
  @y2
end

Instance Method Details

#addObject



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

def add
  R2D::Window.add(self)
end

#hideObject



55
# File 'lib/r2d/line.rb', line 55

def hide; remove end

#removeObject



50
51
52
# File 'lib/r2d/line.rb', line 50

def remove
  R2D::Window.remove(self)
end

#showObject



54
# File 'lib/r2d/line.rb', line 54

def show; add end