<div dir="ltr"><div><div><div>I am am glad my comment helped somehow.<br><div>I guess you MouseInteractorStyle1 and MouseInteractorStyle2 are subclasses of vtkInteractorStyle which you want set depending on your needs <br>
</div><div>In this case why would you even need a callback?<br></div><div>Do everything  there.<br><br></div><div>Also I do not think your code is valid.<br></div><div>I doubt below code will even compile:<br></div><br><div>
 vtkSmartPointer&lt;MouseInteractorStyle1&gt; style  =  
      vtkSmartPointer&lt;MouseInteractorStyle1&gt;::New(); // Style 1
      for manipulation Spin/Pan etc.<br><div> vtkSmartPointer&lt;MouseInteractorStyle2&gt; style  =  
      vtkSmartPointer&lt;MouseInteractorStyle2&gt;::New();</div><br><br></div><div>You said you want different behavior for for example left mouse release depending on some conditions.<br></div><div>This means you have a few choices:<br>
<br></div><div>a) subclass interactor style and do all you need within that single class.<br></div><div>b) switch between different interactor styles. For example check vtkInteractorStyleSwitch.<br></div><div>c) use callbacks. <br>
<br></div><div>I used a) and b) myself. Even though I have not used last approach I guess you would still at least to either subclass interactor style so it does nothing if actions of your interest happens or find an existent class which satisfies above conditions. Otherwise default interactor style will interfere with your code (For example rotation will happen  when you want zoom or both )<br>
<br></div><div><br></div><div>Hope this helps,<br></div><div>  Alex<br></div><br></div><span></span></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 22, 2013 at 3:26 AM, Florian Schiffers <span dir="ltr">&lt;<a 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">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>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><br>
          <br>
          ( with pastebin: <a href="http://pastebin.com/qm42n1xh" target="_blank">http://pastebin.com/qm42n1xh</a> )<br>
          <br>
          void</span> ClickCallbackFunction <span>(</span>
        vtkObject<span>*</span> caller, <span>long</span>
        <span>unsigned</span> <span>int</span>
        eventId, <span>void</span><span>*</span>
        clientData, <span>void</span><span>*</span>
        callData <span>)</span><span>;</span>
      </font><br>
      ElectrodeDetectorPlugin::ElectrodeDetectorPlugin(QVTKWidget *p):
      QObject(){<br>
          m_InputData                =    vtkSmartPointer
      &lt;vtkPolyData&gt; :: New();<br>
          m_InputDataActor        =    vtkSmartPointer &lt;vtkActor&gt;
      :: New();<br>
      <br>
          m_MaximaData           =   
      vtkSmartPointer&lt;vtkPolyData&gt;::New();<br>
          m_InputMaximaActor            =   
      vtkSmartPointer&lt;vtkActor&gt;::New();<br>
      <br>
          vtkSmartPointer&lt;MouseInteractorStyle1&gt; style  =  
      vtkSmartPointer&lt;MouseInteractorStyle1&gt;::New(); // Style 1
      for manipulation Spin/Pan etc.<br>
          vtkSmartPointer&lt;MouseInteractorStyle2&gt; style  =  
      vtkSmartPointer&lt;MouseInteractorStyle2&gt;::New();<br>
          ... ....<br>
          renderWindow-&gt;GetInteractor()-&gt;SetInteractorStyle( style
      );       <br>
         vtkSmartPointer<span>&lt;</span>vtkCallbackCommand<span>&gt;</span> clickCallback <span>=</span>
      vtkSmartPointer<span>&lt;</span>vtkCallbackCommand<span>&gt;</span><span>::</span><span>New</span><span>(</span><span>)</span><span>;</span> clickCallback<span>-</span><span>&gt;</span>SetCallback <span>(</span> ClickCallbackFunction <span>)</span><span>;</span>
        renderWindowInteractor<span>-</span><span>&gt;</span>AddObserver <span>(</span>
      vtkCommand<span>::</span><span>LeftButtonPressEvent</span>,
      clickCallback <span>)</span><span>;</span><br>
      <br>
      }<span><br>
        void</span> ClickCallbackFunction <span>(</span>
      vtkObject<span>*</span> vtkNotUsed<span>(</span>caller<span>)</span>, <span>long</span> <span>unsigned</span> <span>int</span>
      vtkNotUsed<span>(</span>eventId<span>)</span>,
      <span>void</span><span>*</span> vtkNotUsed<span>(</span>clientData<span>)</span>, <span>void</span><span>*</span> vtkNotUsed<span>(</span>callData<span>)</span> <span>)</span>
      <span>{</span> std<span>::</span><span>cout</span> <span>&lt;&lt;</span> <span>&quot;Click callback&quot;</span> <span>&lt;&lt;</span>
      std<span>::</span><span>endl</span><span>;</span><br>
      <pre>  /<span>/ Get the interactor like this:</span>
  <span>vtkRenderWindowInteractor *iren = </span>
  <span>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.
  
<span>}</span></pre>
      I tried a lot of stuff, but they all didn&#39;t work. Do you have any
      idea?<br>
      <br>
      Thank you for your help!<br>
      <br>
      best regards,<br>
      Flo<br>
      <br>
      Am <a href="tel:21.08.2013%2004" value="+12108201304" target="_blank">21.08.2013 04</a>:04, schrieb Alex Malyushytskyy:<br>
    </div><div><div class="h5">
    <blockquote 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 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>     Alex<br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div>
              <div>
                <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 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>
                      &#39;RightButtonPressEvent&#39; and
                      &#39;MiddleButtonPressEvent&#39;. Both interaction are<br>
                      point picker interactions.<br>
                      <br>
                      My problem is, that for example, when I press the
                      &#39;RightButton&#39; two things<br>
                      happen at once:<br>
                      <br>
                      1. Point on 3D Data get&#39;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 &#39;MiddleButtonPressEvent&#39;,
                      the objects just get moved<br>
                      instead.<br>
                      <br>
                      So basically I want a button on my GUI, where I
                      can choose:<br>
                       1. Either Zoom in/out<br>
                       2. or pick a point<br>
                      <br>
                      As an alternative I would be satisfied with
                      something like this:<br>
                       1. Just OnLeftButtonDown() -&gt; Just
                      Zoom/Pan/Spin<br>
                       2. OnLeftButtonDown() + KeePressEvent -&gt; Don&#39;t
                      zoom, pick point instead<br>
                      <br>
                      This is how I implemented the
                      &#39;MiddleButtonPressEventHandling&#39; 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 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 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&#39;t need (and also don&#39;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 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 &#39;OnLeftButtonDown&#39;,
                      &#39;OnMiddleButtonDown&#39;,<br>
                      &#39;OnRightButtonDown&#39; etc.<br>
                      <br>
                      So basically I tried things like this, but they
                      don&#39;t work, of course:<br>
                      <br>
                      <br>
                      <br>
                      <br>
                      Honestly I have no idea how to solve my problem...
                      I also haven&#39;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 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 href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
                      <br>
                      Visit other Kitware open-source projects at <a 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 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 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>
  </div></div></div>

</blockquote></div><br></div>