[vtkusers] vtkTextActor with border --> vtkCaptionActor2D ??
Andrea Gavana
andrea.gavana at polymtl.ca
Thu Jul 15 15:50:06 EDT 2004
Hello NG,
first of all, thanks to Vladan that helped me to solve this problem. I'm
not having troubles with my viewport, and vtkCaptionActor2D works very well. I
have just 2 little questions about it:
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.
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...
Anyway, thank a lot to you all for you kind suggestions. You're helping me a
lot, and it is a pleasure to learn vtk/python (I am just a beginner) with all
the guru of this NG.
Andrea.
Selon Vladan Bato <vbato at ieee.org>:
> 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
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list