[vtkusers] HowTo pick vtkTextActor?
Veerapuram Varadhan
v.varadhan at gmail.com
Mon Jul 5 02:37:06 EDT 2004
Hi All,
Is there a way to pick vtkTextActor? I tried with vtkCellPicker and
vtkPropPicker, both are not picking the vtkTextActor. This is the piece
of code that i used to define the picker and to pick my text actor.
this->AnnoPicker = vtkPropPicker::New();
this->AnnoPicker->AddPickList (this->TxtActor);
this->AnnoPicker->PickFromListOn();
....
....
....
....
....
....
void vtkAnnotationWidget::OnMouseMove()
{
int found = 0;
// We're only here is we are enabled
int X = this->Interactor->GetEventPosition()[0];
int Y = this->Interactor->GetEventPosition()[1];
// Okay, we can process this. If anything is picked, then we
// can select the annotation.
vtkAssemblyPath *path;
this->Interactor->FindPokedRenderer(X,Y);
this->AnnoPicker->Pick(X,Y,0.0,this->CurrentRenderer);
path = this->AnnoPicker->GetPath();
if (path != NULL)
{
// Deal with the possibility that we may be using a shared picker
path->InitTraversal();
vtkAssemblyNode *node;
for (int i = 0; i < path->GetNumberOfItems() && !found ; i++ )
{
node = path->GetNextNode();
if ( node->GetProp() ==
vtkProp::SafeDownCast(this->TxtActor) ) {
found = 1;
}
}
}
The "found" variable is always 0, even if I move the mouse over the actor.
Am I missing anything in the above code?
TIA,
V. Varadhan.
More information about the vtkusers
mailing list