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

Vladan Bato vbato at ieee.org
Thu Jul 15 13:22:47 EDT 2004


Andrea Gavana wrote:
> If I would like to put a border around my text, should I use vtkCaptionActor2D 
> instead of vtkTextActor? Will it have the same behavior (follow the camera, 
> scale problems and so on)? 

vtkCaptionActor2D is basically a wrapper around vtkTextActor that can 
draw a border around it and a leader connecting it to an attachment 
point in world coordinates. It will move to follow the attachment point 
by default, although this can be changed by clever manipulation of the 
coordinates.

The text is always scaled in order to fit the specified rectangle. By 
default it's size is specified in pixels, so it won't change when you 
resize the window. Alternatively you can set it using normalized 
coordinates to make it scale with the window size (you can do this by 
manipulating its Position and Position2 coordinates).

> By googling around, I found a bug in the VTK 
> phpBugTracker - Bug List, and precisely here:
> 
> http://www.vtk.org/Bug/bug.php?op=show&bugid=558&pos=27
> 
> I'm not so familiar with VTK, but what I understood is that if I have a 
> viewport on my window, I can not use this useful VTK functionality because the 
> border will be shifted wrt the text. Is it correct? If it is correct, is there 
> any other way to accomplish my task?

If your viewport doesn't cover the whole window (or more precisely, if 
it's lower-left corner is not in the lower-left corner of the window), 
you won't be able to use the box around the text.

I have just posted a comment in the bug tracker on how to fix this bug. 
I didn't post a patch as I don't have time to recompile VTK and test the 
fix, so someone else will have to do it.

This of course won't help you, unless you know C++, can fix the code and 
recompile VTK (if you can recompile VTK, and you really need the border, 
I could try to make a patch this weekend and send it to you)...

-- 
Vladan Bato
vbato at ieee.org



More information about the vtkusers mailing list