[vtkusers] Why is the text of vtkCaptionWidget displayed at the default position no matter what position value I set?

David Lonie david.lonie at kitware.com
Mon Oct 24 10:19:53 EDT 2016


On Sun, Oct 23, 2016 at 11:13 AM, Liu_tj <tjlp at netease.com> wrote:

> Hi, VTK guys,
>
> When I display a vtkCaptionWidget, I want to set the position of the text.
> So I call the vtkActor2D:;SetPostion() and SetPosition2(), but when the
> widget is displayed, the text is alway at the left bottom corner, why?
> Below is my C# code:
> [snip]
> rep.GetCaptionActor2D().GetTextActor().SetPosition(textPos1[0],
> textPos1[1]);
> rep.GetCaptionActor2D().GetTextActor().SetPosition2(textPos2[0],
> textPos2[1]);
>

Try just setting the position of the caption actor itself. When the caption
actor renders, it sets the text actor's position. So,

rep.GetCaptionActor2D().SetPosition(textPos1[0], textPos1[1]);
rep.GetCaptionActor2D().SetPosition2(textPos2[0], textPos2[1]);

should get you what you want.

HTH,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161024/397bde96/attachment.html>


More information about the vtkusers mailing list