[vtkusers] Picking a text (label) using mouse.

rakesh patil prakeshofficial at gmail.com
Wed Jan 12 00:21:30 EST 2011


What i want to implement is similar to the text widget.. vtkTextWidget.. I
can pick and move the text here..
But in vtkTextWidget, the text remains bounded to the screen coordinates..
i.e. when i zoom in or out, the text is unaffected... The text should be
scaled, and zoomed automatically as it happens with
vtkLabelPlacementMapper.. i.e. the text must be bound to the world
coordinates..

Can this be done..?? Or can anyone help me to implement this.??

On Tue, Jan 11, 2011 at 8:57 PM, Jeff Baumes <jeff.baumes at kitware.com>wrote:

> On Tue, Jan 11, 2011 at 3:12 AM, rakesh patil <prakeshofficial at gmail.com>wrote:
>
>> Hello,
>>
>> I display a list of texts using vtkPointSetToLabelHierarchy, and passing
>> this through vtkLabelPlacementMapper. I am able to display the text
>> successfully. Now, I need to select the text (pick) and move it and place it
>> wherever I want, using mouse. How can this be done?
>>
>> Any ideas are welcome.
>>
>> Thanks
>>
>>
> There is no built-in capability for this. Labels are currently always
> anchored to the points they refer to. If you need the labels to be decoupled
> from the original points (and you want to keep the original points), you
> would need a duplicate set of points where you modify the points based on
> mouse events. I don't know if there is a facility that would perform hit
> detection on the 2D labels, but a simple algorithm might be to search
> through the points and return the closest one to the mouse. You could do
> this in a custom mouse callback (e.g. by subclassing a the
> vtkInteractorStyle you are currently using), and modify the location of the
> corresponding point to make the label move.
>
> Jeff
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110112/67ab4d8a/attachment.htm>


More information about the vtkusers mailing list