[vtkusers] updating a vtkMapper
Steffen Oeltze
Steffen.Oeltze at Student.Uni-Magdeburg.DE
Fri Oct 25 07:35:00 EDT 2002
Dear VTK-users,
I have implemented a slice viewer together with a keyboard event-handler.
When the user presses 'd' I want the slice to make a 90°-turn. This works fine
but only once. When I press 'd' the second time I have to change the slice to
see the result. I probably forget some ->update() or ->modified() calls.
I there anybody who would have a look at my code and help me ?
void my2DvtkInteractorStyle::OnChar(int ctrl, int shift,
char keycode, int vtkNotUsed(repeatcount))
{
this->CtrlKey = ctrl;
this->ShiftKey = shift;
vtkRenderWindowInteractor *rwi = this->Interactor;
switch (keycode)
{
case 'd' :
case 'D' :
ResultMatrix->Multiply4x4(ResultMatrix, RotMatrix, ResultMatrix);
sliceViewer->get_imgReslice()->SetResliceAxes(ResultMatrix);
sliceViewer->get_imgReslice()->Update();
sliceViewer->get_imgMapper()->RemoveAllInputs();
sliceViewer->get_imgMapper()->SetInput(sliceViewer->get_imgReslice()-
>GetOutput());
sliceViewer->get_imgMapper()->Modified();
sliceViewer->get_imgActor()->Modified();
sliceViewer->get_imgRenderer()->Modified();
sliceViewer->get_imgRenderer()->Render();
sliceViewer->get_imgWindow()->Render();
sliceViewer->get_imgMapper()->SetZSlice(sliceViewer->get_imgMapper()-
>GetZSlice()+1);
rwi->Render();
break;
More information about the vtkusers
mailing list