| Class | CsysLine |
| In: |
csysline.rb
|
| Parent: | FXGLObject |
| color | [RW] | ref attributes color is X, Y or Z |
| info | [RW] | interaction attributes |
| selected | [RW] | interaction attributes |
| x0 | [RW] | ref attributes color is X, Y or Z |
| x1 | [RW] | ref attributes color is X, Y or Z |
| y0 | [RW] | ref attributes color is X, Y or Z |
| y1 | [RW] | ref attributes color is X, Y or Z |
| z0 | [RW] | ref attributes color is X, Y or Z |
| z1 | [RW] | ref attributes color is X, Y or Z |
# File csysline.rb, line 32 def initialize(*args) @red,@green,@blue = 0.0, 0.0, 0.0 @selected = false @color = "X" @text = "" super() if args.length == 9 @x0 = args[0] @y0 = args[1] @z0 = args[2] @x1 = args[3] @y1 = args[4] @z1 = args[5] @parent = args[6] @viewerobj = args[7] @color = args[8] @info = [@parent, @viewerobj, @text] @color == "X" ? @red = 1.0: @red= 0.0 @color == "Y" ? @green = 1.0: @green = 0.0 @color == "Z" ? @blue = 1.0: @blue = 0.0 else FXMessageBox.error(self,MBOX_OK,"Error", "Problem with creation of CsysLine.\nAbort current object creation") end end
Return the bounding box (an FXRangef instance) for this line.
# File csysline.rb, line 61 def bounds FXRangef.new([@x0, @x1].min, [@x0, @x1].max, [@y0, @y1].min, [@y0, @y1].max, [@z0, @z1].min, [@z0, @z1].max) end
# File csysline.rb, line 104 def deselect @color == "X" ? @red = 1.0: @red= 0.0 @color == "Y" ? @green = 1.0: @green = 0.0 @color == "Z" ? @blue = 1.0: @blue = 0.0 @selected = false end
Draw this line into viewer (an FXGLViewer instance).
# File csysline.rb, line 73 def draw(viewer) GL::Color(@red, @green, @blue) GL::PointSize(HANDLE_SIZE) GL::Begin(GL::LINES) GL::Vertex(@x0, @y0, @z0) GL::Vertex(@x1, @y1, @z1) GL::End() end
# File csysline.rb, line 98 def select @color == "X" ? @red = 1.0: @red= 0.5 @color == "Y" ? @green = 1.0: @green = 0.5 @color == "Z" ? @blue = 1.0: @blue = 0.5 @selected = true end