Class CsysLine
In: csysline.rb
Parent: FXGLObject

Methods

bounds   deselect   draw   hide   hit   new   select   show  

Attributes

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

Public Class methods

[Source]

# 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

Public Instance methods

Return the bounding box (an FXRangef instance) for this line.

[Source]

# 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

[Source]

# 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).

[Source]

# 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

[Source]

# File csysline.rb, line 95
   def hide(scene)
      scene.remove(self)
   end

Perform hit-test for this line in viewer (an FXGLViewer instance).

[Source]

# File csysline.rb, line 85
   def hit(viewer)
      GL::Begin(GL::LINES)
      GL::Vertex([@x0, @y0, @z0])
      GL::Vertex([@x1, @y1, @z1])
      GL::End()
   end

[Source]

# 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

[Source]

# File csysline.rb, line 91
   def show(scene)
      scene.remove(self)
      scene.append(self)
   end

[Validate]