PDA

View Full Version : update the actor in the qvtkWidget



cerina
28th November 2012, 05:37
Hi there,
I'm using the QvtkWidget in a QTcreator interface. I use the MouseInteractorStyle class in order to update my reader in the QvtkWidget. My mesh is composed from 4 actors.I want that when i pick on an actor, this actor will be updated by delecting its input and loading an other ply file in its place. This works fine with my conole application, bu when i use it in the QvtkWidget, it deletes the actor's input but didn't load the new ply file.
this is the code for updating the actor:

std::string fils4="cluster4.ply";


vtkSmartPointer<vtkPLYReader> region4 =
vtkSmartPointer<vtkPLYReader>::New();
region4->SetFileName(fils4.c_str());
region4->Update();
poly4=region4->GetOutput();
vtkSmartPointer<vtkPolyDataMapper> mapper4 =
vtkSmartPointer<vtkPolyDataMapper>::New();
mapper4->SetInputConnection(region4->GetOutputPort());
actorr4->GetMapper()->RemoveAllInputs();
actorr4->SetMapper(mapper4);
actorr4->GetMapper()->Modified();
actorr4->GetMapper()->Update();
renderer->ResetCamera();
my actor is named actorr4.
Thanks