<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hello,<br>
      <br>
      thx for the answer. It helped me alot, but I still have the
      problem that I cannot access to class member variables in a
      callback function or the vtkInteractorStyleTrackballCamera Class.<br>
      <br>
      I have a structure like this:<font face="Times New Roman, Times,
        serif"><span class="kw4"><br>
          <br>
          ( with pastebin: <a class="moz-txt-link-freetext" href="http://pastebin.com/qm42n1xh">http://pastebin.com/qm42n1xh</a> )<br>
          <br>
          void</span> ClickCallbackFunction <span class="br0">(</span>
        vtkObject<span class="sy2">*</span> caller, <span class="kw4">long</span>
        <span class="kw4">unsigned</span> <span class="kw4">int</span>
        eventId, <span class="kw4">void</span><span class="sy2">*</span>
        clientData, <span class="kw4">void</span><span class="sy2">*</span>
        callData <span class="br0">)</span><span class="sy4">;</span>
      </font><br>
      ElectrodeDetectorPlugin::ElectrodeDetectorPlugin(QVTKWidget *p):
      QObject(){<br>
      &nbsp;&nbsp;&nbsp; m_InputData&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =&nbsp;&nbsp;&nbsp; vtkSmartPointer
      &lt;vtkPolyData&gt; :: New();<br>
      &nbsp;&nbsp;&nbsp; m_InputDataActor&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =&nbsp;&nbsp;&nbsp; vtkSmartPointer &lt;vtkActor&gt;
      :: New();<br>
      <br>
      &nbsp;&nbsp;&nbsp; m_MaximaData&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;&nbsp;&nbsp;
      vtkSmartPointer&lt;vtkPolyData&gt;::New();<br>
      &nbsp;&nbsp;&nbsp; m_InputMaximaActor&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =&nbsp;&nbsp;&nbsp;
      vtkSmartPointer&lt;vtkActor&gt;::New();<br>
      <br>
      &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;MouseInteractorStyle1&gt; style&nbsp; =&nbsp;&nbsp;
      vtkSmartPointer&lt;MouseInteractorStyle1&gt;::New(); // Style 1
      for manipulation Spin/Pan etc.<br>
      &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;MouseInteractorStyle2&gt; style&nbsp; =&nbsp;&nbsp;
      vtkSmartPointer&lt;MouseInteractorStyle2&gt;::New();<br>
      &nbsp;&nbsp;&nbsp; ... ....<br>
      &nbsp;&nbsp;&nbsp; renderWindow-&gt;GetInteractor()-&gt;SetInteractorStyle( style
      );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
      &nbsp;&nbsp; vtkSmartPointer<span class="sy1">&lt;</span>vtkCallbackCommand<span
        class="sy1">&gt;</span> clickCallback <span class="sy1">=</span>
      vtkSmartPointer<span class="sy1">&lt;</span>vtkCallbackCommand<span
        class="sy1">&gt;</span><span class="sy4">::</span><span
        class="me2">New</span><span class="br0">(</span><span
        class="br0">)</span><span class="sy4">;</span> clickCallback<span
        class="sy2">-</span><span class="sy1">&gt;</span>SetCallback <span
        class="br0">(</span> ClickCallbackFunction <span class="br0">)</span><span
        class="sy4">;</span>
      &nbsp; renderWindowInteractor<span class="sy2">-</span><span
        class="sy1">&gt;</span>AddObserver <span class="br0">(</span>
      vtkCommand<span class="sy4">::</span><span class="me2">LeftButtonPressEvent</span>,
      clickCallback <span class="br0">)</span><span class="sy4">;</span><br>
      <br>
      }<span class="kw4"><br>
        void</span> ClickCallbackFunction <span class="br0">(</span>
      vtkObject<span class="sy2">*</span> vtkNotUsed<span class="br0">(</span>caller<span
        class="br0">)</span>, <span class="kw4">long</span> <span
        class="kw4">unsigned</span> <span class="kw4">int</span>
      vtkNotUsed<span class="br0">(</span>eventId<span class="br0">)</span>,
      <span class="kw4">void</span><span class="sy2">*</span> vtkNotUsed<span
        class="br0">(</span>clientData<span class="br0">)</span>, <span
        class="kw4">void</span><span class="sy2">*</span> vtkNotUsed<span
        class="br0">(</span>callData<span class="br0">)</span> <span
        class="br0">)</span>
      <span class="br0">{</span> std<span class="sy4">::</span><span
        class="kw3">cout</span> <span class="sy1">&lt;&lt;</span> <span
        class="st0">"Click callback"</span> <span class="sy1">&lt;&lt;</span>
      std<span class="sy4">::</span><span class="me2">endl</span><span
        class="sy4">;</span><br>
      <pre class="de1">  /<span class="co1">/ Get the interactor like this:</span>
  <span class="co1">vtkRenderWindowInteractor *iren = </span>
  <span class="co1">static_cast&lt;vtkRenderWindowInteractor*&gt;(caller);</span>

  HERE I need to operations on m_InputData, m_MaximaData using PointPicker Methods
  I also want to draw objects etc.
&nbsp;&nbsp;
<span class="br0">}</span></pre>
      I tried a lot of stuff, but they all didn't work. Do you have any
      idea?<br>
      <br>
      Thank you for your help!<br>
      <br>
      best regards,<br>
      Flo<br>
      <br>
      Am 21.08.2013 04:04, schrieb Alex Malyushytskyy:<br>
    </div>
    <blockquote
cite="mid:CAHR9pJ3Sw8P3qCiGcsk1h7f5D1m3uWL073TJfo_6GMQuAQHEUw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>I just want to add thet currently set .
              vtkInteractorStyle is defining which events are handled
              and how.<br>
            </div>
            So subclassing and overriding appropriate functionality is
            way to go.<br>
          </div>
          Also you can create multiple vtkInteractorStyle and set them
          active according to your needs.<br>
          <br>
        </div>
        <div>Hope this helps.<br>
          <br>
        </div>
        Alex<br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Tue, Aug 20, 2013 at 4:08 PM, Alex
          Malyushytskyy <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:alexmalvtk@gmail.com" target="_blank">alexmalvtk@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>
                <div>
                  <div>Subclass vtkInteractorStyle (or derived class )
                    you are using.<br>
                    <br>
                  </div>
                  All the operations: rotation, calls as results on
                  Keypressevents are initiated there.<br>
                </div>
                Depending on the actual subclass of vtkInteractorStyle
                things what you need to do are different,<br>
              </div>
              For example to suppress Keypressevents for
              vtkInteractorStyleRubberBand subclass you can just
              override<br>
              <div>
                <div>
                  <div>
                    <div>void vtkInteractorStyleRubberBand::OnChar() to
                      do nothing.<br>
                      <br>
                    </div>
                    <div>Regards,<br>
                    </div>
                    <div>&nbsp;&nbsp;&nbsp;&nbsp; Alex<br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra"><br>
                  <br>
                  <div class="gmail_quote">On Tue, Aug 20, 2013 at 5:59
                    AM, Phys1k3r <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="mailto:florian.schiffers@physik.uni-erlangen.de"
                        target="_blank">florian.schiffers@physik.uni-erlangen.de</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
                      <br>
                      I have written a vtk-programm that allows me to
                      display a 3D data set (VTK<br>
                      and QT). Additonally you can interact with the 3D
                      Data with<br>
                      'RightButtonPressEvent' and
                      'MiddleButtonPressEvent'. Both interaction are<br>
                      point picker interactions.<br>
                      <br>
                      My problem is, that for example, when I press the
                      'RightButton' two things<br>
                      happen at once:<br>
                      <br>
                      1. Point on 3D Data get's picked<br>
                      2. Camera is zooming in/out (only when I move
                      mouse during picking, but this<br>
                      happens from time to time)<br>
                      <br>
                      The same happens with 'MiddleButtonPressEvent',
                      the objects just get moved<br>
                      instead.<br>
                      <br>
                      So basically I want a button on my GUI, where I
                      can choose:<br>
                      &nbsp;1. Either Zoom in/out<br>
                      &nbsp;2. or pick a point<br>
                      <br>
                      As an alternative I would be satisfied with
                      something like this:<br>
                      &nbsp;1. Just OnLeftButtonDown() -&gt; Just
                      Zoom/Pan/Spin<br>
                      &nbsp;2. OnLeftButtonDown() + KeePressEvent -&gt; Don't
                      zoom, pick point instead<br>
                      <br>
                      This is how I implemented the
                      'MiddleButtonPressEventHandling' by now:<br>
                      <br>
                      <br>
                      <br>
                      I know, this is not the best way, but it worked so
                      far. I propably will<br>
                      implement it this way in the near future:<br>
                      <a moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/MouseEventsObserver"
                        target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/MouseEventsObserver</a><br>
                      <br>
                      But even when I use the MouseEventsObserver I
                      still have no Idea how<br>
                      suppress the Zoom/Pan/Spin Events...<br>
                      <br>
                      Than I thought of this method instead:<br>
                      <a moz-do-not-send="true"
                        href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/MouseEvents"
                        target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/MouseEvents</a><br>
                      <br>
                      First of all, I don't need (and also don't want)
                      all the features of the<br>
                      vtkInteractorStyle class like Keypressevents for
                      p, r, s, u, v e (as you can<br>
                      find them here:<br>
                      <a moz-do-not-send="true"
                        href="http://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html"
                        target="_blank">http://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html</a>
                      at Detailed<br>
                      Description)<br>
                      <br>
                      I just need to overwrite 'OnLeftButtonDown',
                      'OnMiddleButtonDown',<br>
                      'OnRightButtonDown' etc.<br>
                      <br>
                      So basically I tried things like this, but they
                      don't work, of course:<br>
                      <br>
                      <br>
                      <br>
                      <br>
                      Honestly I have no idea how to solve my problem...
                      I also haven't found much<br>
                      documentary besides the examples.<br>
                      <br>
                      Thank you for your help, I really appreciate it<br>
                      Phys1k3r<br>
                      <br>
                      <br>
                      <br>
                      --<br>
                      View this message in context: <a
                        moz-do-not-send="true"
href="http://vtk.1045678.n5.nabble.com/VTK-Interactor-problem-tp5722887.html"
                        target="_blank">http://vtk.1045678.n5.nabble.com/VTK-Interactor-problem-tp5722887.html</a><br>
                      Sent from the VTK - Users mailing list archive at
                      Nabble.com.<br>
                      _______________________________________________<br>
                      Powered by <a moz-do-not-send="true"
                        href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
                      <br>
                      Visit other Kitware open-source projects at <a
                        moz-do-not-send="true"
                        href="http://www.kitware.com/opensource/opensource.html"
                        target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                      <br>
                      Please keep messages on-topic and check the VTK
                      FAQ at: <a moz-do-not-send="true"
                        href="http://www.vtk.org/Wiki/VTK_FAQ"
                        target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
                      <br>
                      Follow this link to subscribe/unsubscribe:<br>
                      <a moz-do-not-send="true"
                        href="http://www.vtk.org/mailman/listinfo/vtkusers"
                        target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>