<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks Clinton;<br>
How should i set the interactor and render window of vtkImageViewer2
and QVTKWidget? What is the correct order and implementation? And which
interactor's interactor style shoud be set at the runtime,
vtkImageViewer2 or QVTKWidget? When i set the interactor style of
vtkImageViewer2's interactor, it throws an unhandled exception and
program exits...But if i set the interactorstyle's interactor
(cis->SetInteractor(interactor);) it doesn't throw an exception but
the program behaves like there are two different interactors...<br>
<br>
<br>
<br>
<br>
05.03.2010 17:33, Clinton Stimpson yazmış:
<blockquote cite="mid:FA01914A-1A64-4E8B-8C88-C8A7215F9534@elemtech.com"
type="cite"><br>
<div>
<div>On Mar 5, 2010, at 7:53 AM, sercani wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div bgcolor="#ffffff" text="#000000">Hi David;<br>
This is the declaration of cis:<br>
<i>CustomInteractorStyle *cis=CustomInteractorStyle::New();</i><br>
<br>
and this is the definiton of CustomInteractorStyle class:<br>
<i><br>
class CustomInteractorStyle : public QObject, public
vtkInteractorStyleImage<br>
{<br>
};</i><br>
this class contains virtual mouse functions of vtkInteractorStyleImage
and handles these events according to my software's tools...When
another tool selected, it'is own custom style is set to interactor's
style and handles events too...When i set the interactor style in
runtime like this:<br>
<br>
<i>vtkImageViewer2 viewer;<br>
viewer->GetRenderWindow()->GetInteractor()->SetInteractorStyle(cis);</i><br>
it throws an <br>
"<i>Unhandled exception at 0x60772abb (vtkRendering.dll) in VTKTry.exe:
0xC0000005: Access violation reading location 0x00000050.<br>
The program '[2568] VTKTry.exe: Native' has exited with code
-1073741819 (0xc0000005)</i>."<br>
<br>
If i don't set the interactor's interactorstyle,but set the
interactorstyle's interactor like this:<br>
<i>cis->SetInteractor(viewer->GetRenderWindow()->GetInteractor());</i>
QVTKWidget
and my vtkImageViewer2 handles the mousewheel event
seperately and this cause wrong behaviour in my program...<br>
I am setting the viewer's and QVTKWidget's interactor like this:<br>
<i><br>
vtkImageViewer2 viewer=vtkImageViewer2::New();<br>
qvtk->SetRenderWindow(viewer->GetRenderWindow()); <br>
vtkRenderWindowInteractor
*interactor=vtkRenderWindowInteractor::New();<br>
viewer->GetRenderWindow()->SetInteractor(interactor);<br>
qvtk->GetRenderWindow()->SetInteractor(viewer->GetRenderWindow()->GetInteractor());</i><br>
<br>
How can i solve these problems?<br>
</div>
</blockquote>
<div><br>
</div>
<div><br>
</div>
<div>vtkRenderWindowInteractor::New() gives you one that is
incompatible with QVTKWidget.</div>
<div>Use a QVTKInteractor instead.</div>
<div><br>
</div>
<div>Clint</div>
<br>
<blockquote type="cite">
<div bgcolor="#ffffff" text="#000000"><br>
<br>
<br>
<br>
<br>
<br>
<br>
05.03.2010 16:18, David Doria yazmış:
<blockquote
cite="mid:c19fcadc1003050618v3765b107gf7721c20f68eddc9@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Fri, Mar 5, 2010 at 9:04 AM, sercani <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:sercanimailgroups@gmail.com">sercanimailgroups@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi
everyone,<br>
I've written subclass of vtkInteractorStyleImage and set it to an
interactor, but i need to set another custom interactorstyle in
runtime. When i want to delete the current custom interactor style like
this:<br>
if(cis->GetEnabled())<br>
{<br>
cis->EnabledOff();<br>
cis->SetInteractor(0);<br>
cis->Delete();<br>
}<br>
<br>
it throws :<br>
<br>
"ERROR: In ..\..\VTK_Source\VTK\Common\vtkObject.cxx, line 160<br>
vtkObject (0155E128): Trying to delete object with non-zero reference
count."<br>
<br>
How can i delete this custom interactorstyle and set another custom
interactorstyle as current interactor's new interactorstyle?<br>
<br>
</blockquote>
<div><br>
</div>
<div>Is cis a smart pointer? If so then you should let it delete
itself instead of deleting it manually - or if you want to delete it
manually then don't use a smart pointer. Can you send us some more code
for context?</div>
<br clear="all">
Thanks,<br>
<br>
<div>David</div>
</div>
</blockquote>
<br>
<br>
</div>
_______________________________________________<br>
Powered by <a moz-do-not-send="true" href="http://www.kitware.com">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">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">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">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote>
</div>
<br>
</blockquote>
<br>
</body>
</html>