<div>On Mon, Mar 15, 2010 at 8:57 AM, Sebastian Gatzka <span dir="ltr">&lt;<a href="mailto:sebastian.gatzka@stud.tu-darmstadt.de">sebastian.gatzka@stud.tu-darmstadt.de</a>&gt;</span> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">



  

<div bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Helvetica, Arial, sans-serif">Somthing like
this? I&#39;m not getting it ...<br>
<br>
<font face="Courier New, Courier, monospace"><div class="im">class
KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera<br>
{<br>
  public:<br>
    static KeyPressInteractorStyle* New();<br>
 <br></div>
    <font color="#ff0000">vtkImplicitPlaneWidget2 *planeWidget;</font><div class="im"><br>
<br>
    virtual void OnKeyPress() <br>
    {<br>
      //get the keypress<br>
      vtkRenderWindowInteractor *rwi = this-&gt;Interactor;<br>
      std::string key = rwi-&gt;GetKeySym();<br>
 <br>
      if (key.compare(&quot;p&quot;) == 0)<br>
      {<br></div>
          vtkImplicitPlaneRepresentation* rep = <font color="#ff0000"><b>planeWidget</b></font>-&gt;GetRepresentation();<br>
<br>
<br>
          rep-&gt;SetNormal(1,0,0);<br>
          planeWidget-&gt;SetRepresentation(rep);<div class="im"><br>
      }<br>
<br>
      //handle an arrow key<br>
      if(key.compare(&quot;Up&quot;) == 0)<br>
        {<br>
        cout &lt;&lt; &quot;The up arrow was pressed.&quot; &lt;&lt; endl;<br>
        }<br>
 <br>
      // forward events<br>
      vtkInteractorStyleTrackballCamera::OnKeyPress();<br>
    }<br>
<br>
    <br></div>
};<br>
<br>
<font color="#ff0000"><b><font face="Helvetica, Arial, sans-serif">This
leads to problems: The planeWidget inside the {}-brackets is unknown.</font></b></font><br>
</font></font></font></div><div bgcolor="#ffffff" text="#000000"><font size="-1"><font face="Helvetica, Arial, sans-serif"><font face="Courier New, Courier, monospace"><font color="#ff0000"><b><font face="Helvetica, Arial, sans-serif"><br>
</font></b></font></font></font></font></div></blockquote><div><br></div><div><br></div><div><span class="Apple-style-span" style="font-family: &#39;Courier New&#39;, Courier, monospace; border-collapse: collapse; "><div class="im" style="color: rgb(80, 0, 80); ">
class KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera<br>{<br>  ...<br></div>    <font color="#ff0000">vtkImplicitPlaneWidget2 *planeWidget;</font><div class="im" style="color: rgb(80, 0, 80); "><br><br>
    virtual void OnKeyPress() <br>    {<br>      //get the keypress<br>      vtkRenderWindowInteractor *rwi = this-&gt;Interactor;<br>      std::string key = rwi-&gt;GetKeySym();<br> <br>      if (key.compare(&quot;p&quot;) == 0)<br>
      {<br></div>          vtkImplicitPlaneRepresentation* rep = <font color="#ff0000"><b>planeWidget</b></font>-&gt;GetRepresentation();<br><br><br>          rep-&gt;SetNormal(1,0,0);<br>          //planeWidget-&gt;SetRepresentation(rep); you don&#39;t need this, it is already set (since you just Got it)<div class="im" style="color: rgb(80, 0, 80); ">
<br>      }<br>...<br><br>    <br></div>};</span></div><div><font class="Apple-style-span" face="&#39;Courier New&#39;, Courier, monospace"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div>
<div><font class="Apple-style-span" face="&#39;Courier New&#39;, Courier, monospace"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font>int main(int argc, char *argv[])</div><div>{</div><div>
<span class="Apple-style-span" style="font-family: &#39;Courier New&#39;, Courier, monospace; border-collapse: collapse; color: rgb(80, 0, 80); ">vtkSmartPointer&lt;KeyPressInteractorStyle&gt; style = </span></div><div><span class="Apple-style-span" style="font-family: &#39;Courier New&#39;, Courier, monospace; border-collapse: collapse; color: rgb(80, 0, 80); ">vtkSmartPointer&lt;KeyPressInteractorStyle&gt;::New();</span></div>
<div> ...</div><div>  vtkSmartPointer&lt;vtkImplicitPlaneWidget2&gt; planeWidget =</div><div>      vtkSmartPointer&lt;vtkImplicitPlaneWidget2&gt;::New();</div><div>  planeWidget-&gt;SetInteractor(renderWindowInteractor);</div>
<div><br></div><div>style.planeWidget = planeWidget;</div><div>...</div><div><br></div><div><br></div><div>You&#39;re definitely right that we need a tutorial on callback and widgets and interactor subclasses - I&#39;ll get to it soon.</div>
<div><br></div>Thanks,<br><br>David</div>