[vtkusers] About witgets' pick event

huangz2350 huangz2350 at 163.com
Sun Dec 16 06:27:39 EST 2012


 Hi EveryBody
 
I have a trouble on the use of the witgets class.
When I use the vtkAngleWitget(vtkDistanceWitget...),I found they can't be picked.I used vtkCellPicker.
 
I read this Url(http://vtk.1045678.n5.nabble.com/Interactor-on-vtkWidget-td2848124.html#a2848445)
 
According to Dean Inglis' way
Wrote the following code:
    this->pvtkCellPicker->PickFromListOn();
    vtkDistanceWidget *pDistanceWidget = NULL;int i = 0;
    for(i = this->CArrWitGets_Distance.GetSize()-1; i >= 0; i--)
    {
        pDistanceWidget = CArrWitGets_Distance.GetAt(i);
        vtkSmartPointer<vtkPropCollection> collection = vtkSmartPointer<vtkPropCollection>::New();
        vtkDistanceRepresentation::SafeDownCast(pDistanceWidget->GetRepresentation())->GetActors(collection);
        collection->InitTraversal();
        int r = collection->GetNumberOfItems();
        for(vtkIdType i=0; i<collection->GetNumberOfItems(); i++)
        {
            vtkActor* pActor = vtkActor::SafeDownCast(collection->GetNextProp());
            this->pvtkCellPicker->AddPickList(pActor);
        }
        pDistanceWidget->Off();
        //this->pvtkCellPicker->AddPickList(vtkDistanceRepresentation2D::SafeDownCast(pDistanceWidget->GetRepresentation())->GetAxis());
    }

I found i can't find anything in pDistanceWidget(collection->GetNumberOfItems() is zero),Who can tell me where I was wrong?
Is The Dean Inglis' way right?
have any other ways?

PS:How to get the class-type of "actor->GetMapper()->GetInput()"?
[IsTypeOf] function?  if it can,can you give me some example's codes?

Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121216/3fc4a0ae/attachment.htm>


More information about the vtkusers mailing list