[vtkusers] Why is the text of vtkCaptionWidget displayed at the default position no matter what position value I set?
david.lonie at kitware.com
Tue Oct 25 10:16:12 EDT 2016
Are you also setting the attachment point? From the vtkCaptionActor2D docs:
* To use the caption actor, you normally specify the Position and Position2
* coordinates (these are inherited from the vtkActor2D superclass). (Note
* that Position2 can be set using vtkActor2D's SetWidth() and SetHeight()
* methods.) Position and Position2 define the size of the caption, and a
* third point, the AttachmentPoint, defines a point that the caption is
* associated with.
* The trickiest part about using this class is setting Position, Position2,
* and AttachmentPoint correctly. These instance variables are
* vtkCoordinates, and can be set up in various ways. In default usage, the
* AttachmentPoint is defined in the world coordinate system, Position is
* lower-left corner of the caption and relative to AttachmentPoint (defined
* in display coordaintes, i.e., pixels), and Position2 is relative to
* Position and is the upper-right corner (also in display
On Tue, Oct 25, 2016 at 10:02 AM, Liu_tj <tjlp at netease.com> wrote:
> Hi, David,
> I follow your tips. It doesn't work. The text is still displayed at the
> default position.
> Liu Peng
> 在2016-10-24，"David Lonie" <david.lonie at kitware.com> 写道：
> *收件人:*"Liu_tj" <tjlp at netease.com>
> *抄送:*"vtkusers" <vtkusers at vtk.org>
> *主题:*Re: [vtkusers] Why is the text of vtkCaptionWidget displayed at the
> default position no matter what position value I set?
> 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:
> 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, textPos1);
> rep.GetCaptionActor2D().SetPosition2(textPos2, textPos2);
> should get you what you want.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers