<div dir="ltr">Hi,<div><br></div><div>I'm thought there was a macro for my new class... but it was the superclass.</div><div><br></div><div>You're right, it was that and linking in Cmake.</div><div><br></div><div>Now it compiles.</div><div><br></div><div>It doesn't work, but it compiles.</div><div><br></div><div>I commented all inside OnLeftButton(), the method overriden.</div><div><br></div><div>And asigned my interactor to my widget:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><font face="monospace, monospace" size="1"><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">DcmInteractorStyle</span><span style="color:rgb(0,0,0)">> </span></font><span style="color:rgb(128,0,0)">interactorStyle</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">DcmInteractorStyle</span><span style="color:rgb(0,0,0)">>::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">widget</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetRenderWindow</span><span style="color:rgb(0,0,0)">()-></span><span style="font-style:italic;color:rgb(0,0,0)">GetInteractor</span><span style="color:rgb(0,0,0)">()-></span><span style="font-style:italic;color:rgb(0,0,0)">SetInteractorStyle</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">interactorStyle</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">imageViewer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetRenderWindow</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">widget</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetRenderWindow</span><span style="color:rgb(0,0,0)">());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">imageViewer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetupInteractor</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">widget</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetRenderWindow</span><span style="color:rgb(0,0,0)">()-></span><span style="font-style:italic;color:rgb(0,0,0)">GetInteractor</span><span style="color:rgb(0,0,0)">());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">widget</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">update</span><span style="color:rgb(0,0,0)">();</span></pre></div><div><br></div><div>My widget shouldn't do anything when I press left button but... it does the same as always (vtkinteractorstyleimage, which is the default style because of the vtkimageviewer2).</div><div><br></div><div>Thank you, Cory. At least now I can try different things to find out how to make it work.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-02 19:25 GMT+02:00 Cory Quammen <span dir="ltr"><<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Marcos,</div><div><br></div>You should change the line from<br><br>vtkStandardNewMacro(vtkInteractorStyleImage);<br><br>to<br><br>vtkStandardNewMacro(DcmInteractorStyle);<div><br></div><div>HTH,</div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Sep 2, 2015 at 1:15 PM, Marcos <span dir="ltr"><<a href="mailto:fotosentido@gmail.com" target="_blank">fotosentido@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi,<div><br></div><div>I created an vtkinteractor subclass. This is the header:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"vtkInteractionStyleModule.h"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">For</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">export</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">macro</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"vtkInteractorStyleImage.h"</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">class</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">DcmInteractorStyle</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">public</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkInteractorStyleImage</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">public</span><span style="color:rgb(0,0,0)">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">static</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">DcmInteractorStyle</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">vtkTypeRevisionMacro</span><span style="color:rgb(0,0,0)">(</span>DcmInteractorStyle<span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span>vtkInteractorStyleImage<span style="color:rgb(0,0,0)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">virtual</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">OnLeftButtonDown</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">};</span></pre></div><div><br></div><div>I just want to override mouse events.</div><div>I'm following the example:</div><div><a href="http://www.vtk.org/Wiki/VTK/Tutorials/InteractorStyleSubclass" target="_blank">http://www.vtk.org/Wiki/VTK/Tutorials/InteractorStyleSubclass</a><br></div><div><br></div><div>It doesn't show .cpp contents, so I went inside mine with:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">vtkStandardNewMacro</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">vtkInteractorStyleImage</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">DcmInteractorStyle</span><span style="color:rgb(0,0,0)">::</span><span style="font-style:italic;color:rgb(0,0,0)">OnLeftButtonDown</span><span style="color:rgb(0,0,0)">()</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><font color="#808000">// here my code</font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre></div><div><br></div><div><br></div><div>But the compiler (with CMakeLists.txt) says:</div><div>ui_qt.lib(viewerwidget.cpp.obj):-1: error: LNK2019: unresolved external symbol "public: static class DcmInteractorStyle * __cdecl DcmInteractorStyle::New(void)" (?New@DcmInteractorStyle@@SAPAV1@XZ) referenced in function "public: static class vtkSmartPointer<class DcmInteractorStyle> __cdecl vtkSmartPointer<class DcmInteractorStyle>::New(void)" (?New@?$vtkSmartPointer@VDcmInteractorStyle@@@@SA?AV1@XZ)<br></div><div><br></div><div>At CMake mail list someone told me it was because I don't have the New() method defined (what about the macro then?).</div><div><br></div><div>My constructor won't do anything different, just the same as the superclass.</div><div>I tried:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">DcmInteractorStyle</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">DcmInteractorStyle</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkInteractorStyleImage</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">()</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">}</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">It gives me:</span></pre><pre style="margin-top:0px;margin-bottom:0px"><font color="#000000">error: C2550: 'DcmInteractorStyle::New' : constructor initializer lists are only allowed on constructor definitions<br></font></pre><pre style="margin-top:0px;margin-bottom:0px"><font color="#000000"><br></font></pre><pre style="margin-top:0px;margin-bottom:0px"><font color="#000000">Any help, please?</font></pre></div></div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</font></span></div>
</blockquote></div><br></div>