<div>On Mon, Mar 15, 2010 at 8:57 AM, Sebastian Gatzka <span dir="ltr"><<a href="mailto:sebastian.gatzka@stud.tu-darmstadt.de">sebastian.gatzka@stud.tu-darmstadt.de</a>></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'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->Interactor;<br>
std::string key = rwi->GetKeySym();<br>
<br>
if (key.compare("p") == 0)<br>
{<br></div>
vtkImplicitPlaneRepresentation* rep = <font color="#ff0000"><b>planeWidget</b></font>->GetRepresentation();<br>
<br>
<br>
rep->SetNormal(1,0,0);<br>
planeWidget->SetRepresentation(rep);<div class="im"><br>
}<br>
<br>
//handle an arrow key<br>
if(key.compare("Up") == 0)<br>
{<br>
cout << "The up arrow was pressed." << 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: 'Courier New', 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->Interactor;<br> std::string key = rwi->GetKeySym();<br> <br> if (key.compare("p") == 0)<br>
{<br></div> vtkImplicitPlaneRepresentation* rep = <font color="#ff0000"><b>planeWidget</b></font>->GetRepresentation();<br><br><br> rep->SetNormal(1,0,0);<br> //planeWidget->SetRepresentation(rep); you don'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="'Courier New', Courier, monospace"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div>
<div><font class="Apple-style-span" face="'Courier New', 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: 'Courier New', Courier, monospace; border-collapse: collapse; color: rgb(80, 0, 80); ">vtkSmartPointer<KeyPressInteractorStyle> style = </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; border-collapse: collapse; color: rgb(80, 0, 80); ">vtkSmartPointer<KeyPressInteractorStyle>::New();</span></div>
<div> ...</div><div> vtkSmartPointer<vtkImplicitPlaneWidget2> planeWidget =</div><div> vtkSmartPointer<vtkImplicitPlaneWidget2>::New();</div><div> planeWidget->SetInteractor(renderWindowInteractor);</div>
<div><br></div><div>style.planeWidget = planeWidget;</div><div>...</div><div><br></div><div><br></div><div>You're definitely right that we need a tutorial on callback and widgets and interactor subclasses - I'll get to it soon.</div>
<div><br></div>Thanks,<br><br>David</div>