[vtkusers] vtkTextActor with border --> vtkCaptionActor2D ??

Vladan Bato vbato at ieee.org
Fri Jul 16 09:02:31 EDT 2004


Andrea Gavana wrote:
> 1) When I zoom in/out in my VTK window (using vtkRenderWindowInteractor), the 
> text in vtkCaptionActor2D change a lot, but not in the direction I would 
> expect. For example, if I zoom out (so that the 3D grid becomes "smaller", 
> because the camera goes away) the text I put becomes bigger (???!!!), while if 
> I zoom in the text becomes smaller. I would expect that, the more I approach 
> the grid (zoom in), the more the text becomes bigger. But, anyway, it would be 
> nice to keep the text size always the same, indipendently on the zoom factor. I 
> still don't know how to do this.

I cannot reproduce this behaviour, the text is always the same size (in 
pixels) when zooming. Have you seen the example (actually test) 
TestCaptionActor.tcl ?
<http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Hybrid/Testing/Tcl/TestCaptionActor.tcl?root=VTK>

What are you doing differently? Could you post some sample code?

> 
> 2) It is very useful to have the border around the text, but unfortunately the 
> background of the text box is always transparent. In my vtk/python application, 
> I have this 3D grid with a lot of oil wells (vtk polydata), and this 
> transparency leave the user a little bit confused, because you see the well 
> name (vtkCaptionActor2D) and the 3D grid below it. It would be nice to havethe 
> possibility to set the background color of the text box (in black, for 
> example), in order to mask the section of 3D grid below the text...

Unfortunately this is impossible with vtkCaptionActor2D. It draws only 
the border. To draw a filled rectangle too, would require modifications 
to the class. It's not too difficult to implement, as vtkLegendBoxActor 
already does it (although there's a bug in it that makes it draw the 
border *below* the rectangle, see 
<http://www.vtk.org/Bug/bug.php?op=show&bugid=432&pos=0>).

If I have some time I'll make the modifications (for both the viewport 
bug and this feature) and submit them in the hope that they will be 
integrated in VTK. If you are willing to recompile VTK, I can send you 
the patch...

-- 
Vladan Bato
vbato at ieee.org



More information about the vtkusers mailing list