[vtkusers] Picking a text (label) using mouse.
Jeff Baumes
jeff.baumes at kitware.com
Tue Jan 11 10:27:41 EST 2011
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/20110111/079b0582/attachment.htm>
More information about the vtkusers
mailing list