<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Sorry for the inconvenience, but somehow the incomplete email was sent out accidentally.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
The interactor of the vtkWidget window is disabled so the default interaction by mouse is not allowed. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Any help will be appreciated!</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Cheers,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Chiang</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>发件人:</b> vtkusers <vtkusers-bounces@vtk.org> 代表 Wang Q <wangq1979@outlook.com><br>
<b>发送时间:</b> 2018年5月3日 14:36<br>
<b>收件人:</b> vtkusers@vtk.org<br>
<b>主题:</b> [vtkusers] Programmatically move actors and reset all actors</font>
<div> </div>
</div>
<meta content="text/html; charset=gb2312">
<style type="text/css" style="display:none"> <!-- p {margin-top:0; margin-bottom:0} --> </style>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
Hello vtkers, </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
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:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#808000">double</span><span style="color:#c0c0c0"> </span><span style="color:#092e64">tmpColor</span>[<span style="color:#000080">4</span>];</pre>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#092e64"> tmpColor</span>[<span style="color:#000080">0</span>]<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span><span style="color:#800000">pipeColor</span>[<span style="color:#000080">0</span>];</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#092e64">tmpColor</span>[<span style="color:#000080">1</span>]<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span><span style="color:#800000">pipeColor</span>[<span style="color:#000080">1</span>];</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#092e64">tmpColor</span>[<span style="color:#000080">2</span>]<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span><span style="color:#800000">pipeColor</span>[<span style="color:#000080">2</span>];</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#092e64">tmpColor</span>[<span style="color:#000080">3</span>]<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span><span style="color:#800000">pipeColor</span>[<span style="color:#000080">3</span>];</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800000">pipeActor</span>-><span style="color:#00677c">GetProperty</span>()-><span style="font-style:italic; color:#00677c">SetColor</span>(<span style="color:#092e64">tmpColor</span>);</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800000">pipeActor</span>-><span style="color:#00677c">GetProperty</span>()-><span style="font-style:italic; color:#00677c">SetOpacity</span>(<span style="color:#092e64">tmpColor</span>[<span style="color:#000080">3</span>]);</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800000">pipeTransform</span>-><span style="color:#00677c">Translate</span>(<span style="color:#000080">0.0</span>,<span style="color:#c0c0c0"> </span><span style="color:#000080">0.0</span>,<span style="color:#c0c0c0"> </span><span style="color:#800000">currentMove</span>);</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800000">pipeTransform</span>-><span style="color:#00677c">RotateY</span>(<span style="color:#808000">static_cast</span><<span style="color:#808000">double</span>>(<span style="color:#800000">currentRotate</span>));</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800000">pipeTransform</span>-><span style="color:#00677c">Update</span>();</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800000">pipeActor</span>-><span style="color:#00677c">SetUserTransform</span>(<span style="color:#800000">pipeTransform</span>);</pre>
<pre style="margin-top:0px; margin-bottom:0px"><br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">this</span>-><span style="color:#800000">bmRenderer</span>-><span style="font-style:italic; color:#00677c">ResetCamera</span>();</pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">this</span>-><span style="color:#800000">bmRenderer</span>-><span style="color:#00677c">GetActiveCamera</span>()-><span style="color:#00677c">Zoom</span>(<span style="color:#800000">scaleFactor</span>);</pre>
<pre style="margin-top:0px; margin-bottom:0px"><br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800000">ui</span>-><span style="color:#800000">bmWidget</span>-><span style="font-style:italic; color:#00677c">GetRenderWindow</span>()-><span style="font-style:italic; color:#00677c">Render</span>();</pre>
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255)">
The actor's colour is updated but the movement is not. </div>
</div>
</body>
</html>