[vtkusers] 答复: Programmatically move actors and reset all actors

Wang Q wangq1979 at outlook.com
Thu May 3 09:42:39 EDT 2018


Sorry for the inconvenience, but somehow the incomplete email was sent out accidentally.

The interactor of the vtkWidget window is disabled so the default interaction by mouse is not allowed.

Any help will be appreciated!

Cheers,

Chiang

________________________________
发件人: vtkusers <vtkusers-bounces at vtk.org> 代表 Wang Q <wangq1979 at outlook.com>
发送时间: 2018年5月3日 14:36
收件人: vtkusers at vtk.org
主题: [vtkusers] Programmatically move actors and reset all actors

Hello vtkers,

I use Qt5.9 with VTK8.0 to develop a GUI based system. I create multiple actors and want to allow users to interact with the actors by clicking relating buttons, e.g. changing colours, moving in one direction and rotating along one axis. The basic strategy is that all actors store in a vector and update the colours or transforms in a separate function when a button is clicked.  In the function, the code is like:

double tmpColor[4];

    tmpColor[0] = pipeColor[0];

    tmpColor[1] = pipeColor[1];

    tmpColor[2] = pipeColor[2];

    tmpColor[3] = pipeColor[3];

    pipeActor->GetProperty()->SetColor(tmpColor);

    pipeActor->GetProperty()->SetOpacity(tmpColor[3]);

    pipeTransform->Translate(0.0, 0.0, currentMove);

    pipeTransform->RotateY(static_cast<double>(currentRotate));

    pipeTransform->Update();

    pipeActor->SetUserTransform(pipeTransform);


    this->bmRenderer->ResetCamera();

    this->bmRenderer->GetActiveCamera()->Zoom(scaleFactor);



    ui->bmWidget->GetRenderWindow()->Render();

The actor's colour is updated but the movement is not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180503/15c9d1e1/attachment.html>


More information about the vtkusers mailing list