[vtkusers] problem in having two Widgets with the same interactor
David Doria
daviddoria+vtk at gmail.com
Wed Mar 10 10:50:04 EST 2010
On Mon, Mar 8, 2010 at 2:14 AM, satyanarayana reddy <satyajanga at gmail.com>wrote:
>
> Hi David,
> Thanks for the reply. It is working fine for me. But this time I
> am facing a new problem. If I add any actor to the to the renderer then 1st
> widget is moving only at the first time after that I am not able to move it.
> 2nd widget is moving without any problem.
> Plz see the pipeline I have followed.
>
> // Input is a polydata file like brainImageSmooth.vtk in VTKData/Data
>
> vtkPolyDataReader *reader = vtkPolyDataReader::New();
>
> reader->SetFileName(argv[1]);
>
> reader->Update();
>
> vtkPolyData *polyData = reader->GetOutput();
>
> vtkPolyDataMapper* surfaceMapper = vtkPolyDataMapper::New();
>
> surfaceMapper->SetInput(polyData);
>
> vtkActor* surfaceActor = vtkActor::New();
>
> surfaceActor->SetMapper(surfaceMapper);
>
> // a renderer and render window
>
> vtkRenderer *renderer =
>
> vtkRenderer::New();
>
> vtkRenderWindow *renderWindow =
>
> vtkRenderWindow::New();
>
> renderWindow->AddRenderer(renderer);
>
> renderer->AddActor(surfaceActor);
>
> // an interactor
>
> vtkRenderWindowInteractor *renderWindowInteractor =
>
> vtkRenderWindowInteractor::New();
>
> renderWindowInteractor->SetRenderWindow(renderWindow);
>
> vtkSphereWidget *sphereWidget1 =
>
> vtkSphereWidget::New();
>
> sphereWidget1->SetInteractor(renderWindowInteractor);
>
> sphereWidget1->SetRepresentationToSurface();
>
> sphereWidget1->SetCenter(-10.0, 0.0, 0.0);
>
> sphereWidget1->SetRadius(4);
>
> sphereWidget1->On();
>
> vtkSphereWidget *sphereWidget2 =
>
> vtkSphereWidget::New();
>
> sphereWidget2->SetInteractor(renderWindowInteractor);
>
> sphereWidget2->SetRepresentationToSurface();
>
> sphereWidget2->SetCenter(10.0, 0.0, 0.0);
>
> sphereWidget2->SetRadius(4);
>
> sphereWidget2->On();
>
> renderWindow->Render();
>
> renderWindowInteractor->Initialize();
>
> renderWindowInteractor->Start();
>
>
>
Can you post the smallest fully compilable demonstration of the problem?
Please use sources instead of reading data files as that is much easier for
others to reproduce.
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100310/8a098ba9/attachment.htm>
More information about the vtkusers
mailing list