[vtkusers] How to intercept Start/End/PickEvent?

Parag Chandra pchandra at radonc.unc.edu
Fri Jun 13 10:55:31 EDT 2003


Hi,

 

I would like to display a text annotation describing a picked object, so I
created a simple vtkCommand callback to intercept StartPickEvent,
EndPickEvent, and PickEvent. The Execute method looks like this:

 

        switch (event) {

            case vtkCommand::EndPickEvent:

                m_Interactor->m_LeafLabelActor->SetInput("");

                m_Interactor->RemoveAnnotation();

                break;

            case vtkCommand::StartPickEvent:

            case vtkCommand::PickEvent:

                m_Interactor->DisplayAnnotation();

                break;

                                           

 

And I register the command via:

 

    InteractorStyle->AddObserver(vtkCommand::StartPickEvent, callback);

    InteractorStyle->AddObserver(vtkCommand::PickEvent, callback);

    InteractorStyle->AddObserver(vtkCommand::EndPickEvent, callback);

 

However, when I pick an object interactively (I'm using
vtkInteractorStyleImage), only the standard pick action occurs, which is to
highlight the selected object. My callback is never triggered. How can I get
both the highlighting and my custom action to occur? If I change the above
code to listen on Start/End/WindowLevel events, then my callback is
triggered when I click and drag with the left mouse button, but of course,
no highlighting occurs because the Pick event is triggered by the 'P' key.

 

A second question: how can I change the color of the highlighting (seems to
be a hot pink color right now)?

 

Thanks.

 

Best regards,

-Parag Chandra

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030613/f5f0323a/attachment.htm>


More information about the vtkusers mailing list