[vtkusers] Positioning text
bruce_clay at qualia-computing.com
Mon Oct 7 13:52:49 EDT 2002
I am working on a program the allows the user to reconfigure multiple screens (views) using splitter windows. In one configuration a VTK window is used to draw 2D text. When the text is displayed, it is drawn as expected at the lower left corner of the screen. I have tried various methods to set the origin to the top left for user convinience. The only method I can find that works is SetPosition. To make this effective I need to get the height of the text then use the window height to calculate the offset. GetHeight returns 0.0 so that doesn't work.
The rest of the text in embedded in the code below.
text_ = vtkActor2D::New();
vtk_renderer_->AddActor( text_ );
text_mapper_ = vtkTextMapper::New();
If I use any of the next four lines the text does not show up at all
the line belows always returns 0.0
float height = text_mapper_->GetHeight(this);
The line below works but is not flexible enough to handle different string lengths
There is another GetHeight that from the description might work but it requires the address of a vtkViewport. How do I get one of these??
Is there a more flexible way to get the text origin to be the top keft corner of the window??
Did I use the set justification methods incorrectly?
Thanks for your help in advance
More information about the vtkusers