| Class | InfoPoint |
| In: |
infopoint.rb
|
| Parent: | FXGLObject |
InfoPoint class
| changed | [RW] | ref attributes none interaction attributes |
| csys | [RW] | attribute attributes, often from dialog |
| defaultprefix | [RW] | for the write2table method |
| info | [RW] | table attributes |
| name | [RW] | table attributes |
| pos | [RW] | |
| ref | [RW] | attribute attributes, often from dialog |
| refcol | [RW] | |
| reflist | [RW] | for the write2table method |
| reforder | [RW] | for the write2table method |
| row | [RW] | |
| selected | [RW] | ref attributes none interaction attributes |
| visible | [RW] | |
| xpos | [RW] | attribute attributes, often from dialog |
| ypos | [RW] | attribute attributes, often from dialog |
| zpos | [RW] | attribute attributes, often from dialog |
Point position, in model coordinates (a 3-element array) Returns an initialized InfoPoint instance.
aPoint = InfoPoint.new(Csys, 3.0, 3.0, 0.0)
a new point at position (3.0, 3.0, 0.0), @info = [@parent, self, "p#{@@count}"]
where @parent = self
aPoint = InfoPoint.new(Csys, 3.0, 3.0, 0.0, [info0, info1, info2])
aPoint = InfoPoint.new(Csys, 3.0, 3.0, 0.0, @parent, @text) Should InfoPoint have the same initialization as Lines? def initialize(@parent, @ref, *args) only possible reference is csys?
# File infopoint.rb, line 65 def initialize(*args) super() @firstinit = true @changed = false @firsthitinit = true @defaultprefix = "point" @parent=self @red, @green, @blue = 0.0, 0.0, 1.0 @selected = false @row = nil @refcol = nil @csys = $csysdefault @ref = @csys @pos = Array.new @visible = false @csys = args[0] @ref = @csys @xpos, @ypos, @zpos = args[1], args[2], args[3] @pos[@csys.count] = [args[1], args[2], args[3]] if @csys.count == 0 @pos[0] = [@xpos, @ypos, @zpos] else @pos[0] = positionInCsys(@csys, @pos[@csys.count]) end # # InfoPoint.new(csys, xpos, ypos, zpos) # if args.length == 4 # puts "InfoPoint 4 args" # initialize with xpos, ypos and zpos @info = [self, self, "p#{@@count}"] # # InfoPoint.new(csys, xpos, ypos, zpos, info) # @@count += 1 elsif args.length == 5 @info = args[4] # # InfoPoint.new(csys, xpos, ypos, zpos, parent, text) # @@count += 1 elsif args.length == 6 @parent=args[4] @text = args[5] @info = [@parent, self, @text] # no count of this one since its used with parent # # was InfoPoint.new(csys, pos] # else # puts "InfoPoint else args" # nothing else right now #@pos[0] = args[1] #@pos[@csys.count] = @pos[0] puts "not a good InfoPoint initialization" end @reforder = ["xpos", "ypos", "zpos"] @reflist = { "xpos" => @xpos, "ypos" => @ypos, "zpos" => @zpos } @pos[@csys.count] = [@xpos, @ypos, @zpos] if @csys.count != 0 # xpos, :ypos, :zpos, :xrot, :yrot, :zrot, :csystype, :size, :ref @oldcsyspos = @csys.getpos end end
# File infopoint.rb, line 152 def bounds FXRangef.new(@pos[0][0], @pos[0][0], @pos[0][1], @pos[0][1], @pos[0][2], @pos[0][2]) end
# File infopoint.rb, line 209 def deselect @red, @green, @blue = 0.0, 0.0, 1.0 #@currentlist = @point1 @selected = false end
Draw this point into viewer (an FXGLViewer instance).
# File infopoint.rb, line 165 def draw(viewer) drawpoint(@red, @green, @blue) ?? end
# File infopoint.rb, line 155 def drawpoint(red, green, blue) GL::Color(red, green, blue) GL::PointSize(HANDLE_SIZE) GL::Begin(GL::POINTS) GL::Vertex(@pos[0]) GL::End() end
# File infopoint.rb, line 204 def select #@currentlist = @point2 @red, @green, @blue = 1.0, 1.0, 0.0 @selected = true end
# File infopoint.rb, line 214 def show @visible = true if $pointvisibility $globalscene.append(self) else $globalscene.remove(self) end end
Return the bounding box (an FXRangef instance) for this point.
# File infopoint.rb, line 133 def update @oldreflist = @reflist @reflist = { "xpos" => @xpos, "ypos" => @ypos, "zpos" => @zpos } # determine if it needs to be updated unless @oldreflist == @reflist && ( @csys.count == 0 || @oldcsyspos == @csys.getpos || !@csys.changed ) if @csys.count == 0 @pos[0] = [@xpos, @ypos, @zpos] else @pos[0] = positionInCsys(@csys, [@xpos, @ypos, @zpos]) @pos[@csys.count] = [@xpos, @ypos, @zpos] end @oldreflist = @reflist if @csys.count != 0 # xpos, :ypos, :zpos, :xrot, :yrot, :zrot, :csystype, :size, :ref @oldcsyspos = @csys.getpos end @changed = true end end