[vtkusers] interrupt the vtkRenderWindowInteractor?
Jeff Lee
jeff at cdnorthamerica.com
Fri Feb 14 10:24:46 EST 2003
Steven.Aston at tessella.com wrote:
>Jeff,
>
>Thanks for the response. Would I be right in thinking that a vtkPanel
>would simplify matters? If I didn't want to use a vtkPanel for the time
>being, do you have any suggestions for the original problem?
>
the vtkPanel approach is more appropriate for what you are trying to
do. That being said, you can interrupt the event loop by setting
SetBreakLoopFlag to 1 in the vtkX(Win32)RenderWindowInteractor. This
kicks the interactor out of the loop, and your code continues after the
iren.Start() call. One way to make it work would be to add an observer
to iren for vtkCommand::UserEvent. This means when the user hits u, the
interactor will execute the function you provided in iren.AddObserver().
You can simulate the "u" keypress in java and force this method to
execute. This might look something like:
...
setupPipeline();
...
iren.AddObserver("UserEvent", this, "myBreakLoop");
iren.Start(); // goes into loop
doStuffAfterRestart(); // go here when kick out
}
public void doStuffAfterRestart() {
doSomeStuffToChangePipeline();
iren.Start();
doStuffAfterRestart();
}
public void myBreakLoop() {
iren.SetBreakLoopFlag(1);
}
to get it started, simulate a keypress(with a Robot) somewhere in your
other thread which will put you into your own loop
doStuffAfterRestart(). Not nearly as elegant a solution as vtkPanel,
but it works.
-Jeff
>
>Steve
>
>
>
>
> Jeff Lee
> <jeff at cdnorthamerica.co To: Steven.Aston at tessella.com
> m> cc:
> Subject: Re: [vtkusers] interrupt the vtkRenderWindowInteractor?
> 14/02/2003 07:39 EST
>
>
>
>
>
>It has been packaged properly in the cvs version of vtk, and in the
>soon-to-be release version 4.2.
>-Jeff
>
>Steven.Aston at tessella.com wrote:
>
>
>
>>I'm not currently using a vtkPanel, just a straight vtkRenderWindow. I
>>believe there is a problem with compiling vtkPanels under Java 1.4.1 in
>>anything other than the unnamed namespace.
>>
>>Steve
>>
>>
>>
>>
>>
>>
>>
>
>
>
>> Jeff Lee
>>
>>
>
>
>
>> <jeff at cdnorthamerica.co To:
>>
>>
>Steven.Aston at tessella.com
>
>
>> m> cc:
>>
>>
>vtkusers at public.kitware.com
>
>
>> Subject: Re: [vtkusers]
>>
>>
>interrupt the vtkRenderWindowInteractor?
>
>
>> 14/02/2003 07:08 EST
>>
>>
>
>
>
>
>
>
>
>
>
>>
>>
>>
>>Steven.Aston at tessella.com wrote:
>>
>>
>>
>>
>>
>>>Hello,
>>>
>>>I am new to VTK, so please be patient with this question.
>>>
>>>I have written a small application in Java (1.4.1) which has a swing GUI
>>>which runs in the main thread and a vtkRenderWindow (using vtk 4.0) which
>>>runs in a separate thread. These windows are displayed simultaneously.
>>>
>>>
>I
>
>
>>>would like the user to be able to interact directly with the image in the
>>>render window via a vtkRenderWindowInteractor (which works) but also
>>>
>>>
>allow
>
>
>>>the image to be manipulated from elsewhere, such as being automatically
>>>rotated on a button press from the GUI (which doesn't work, unless a
>>>window resize is also invoked).
>>>
>>>I understand that the interactor has its own event loop, so simply
>>>
>>>
>>>
>>>
>>updating
>>
>>
>>
>>
>>>the active camera angle of the renderer and calling render doesn't work
>>>because this is outside the interactors event loop. How should I go
>>>
>>>
>about
>
>
>>>interrupting or adding to the interactor, is this a question of adding an
>>>observer? I would very much appreciate any suggestions.
>>>
>>>
>>>
>>>
>>>
>>Are you using vtkPanel?
>>-Jeff
>>
>>
>>
>>
>>
>>>Thanks in advance.
>>>
>>>Steve
>>>
>>>
>>>This message is confidential and may be privileged. It is intended for
>>>
>>>
>the
>
>
>>>addressee(s) only. Access to this message by anyone else is unauthorized
>>>and strictly prohibited. If you have received this message in error,
>>>
>>>
>>>
>>>
>>please
>>
>>
>>
>>
>>>inform the sender immediately.
>>>
>>>TESSELLA Steven.Aston at tessella.com
>>>__/__/__/ Tessella Support Services plc
>>>__/__/__/ 3 Vineyard Chambers, ABINGDON, OX14 3PX, England
>>>__/__/__/ Tel: (44)(0)1235-555511 Fax: (44)(0)1235-553301
>>> www.tessella.com
>>> Registered in England No. 1466429
>>>
>>>
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the FAQ at: <
>>>
>>>
>>>
>>>
>>http://public.kitware.com/cgi-bin/vtkfaq>
>>
>>
>>
>>
>>>Follow this link to subscribe/unsubscribe:
>>>http://public.kitware.com/mailman/listinfo/vtkusers
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>This message is confidential and may be privileged. It is intended for the
>>addressee(s) only. Access to this message by anyone else is unauthorized
>>and strictly prohibited. If you have received this message in error,
>>
>>
>please
>
>
>>inform the sender immediately.
>>
>>TESSELLA Steven.Aston at tessella.com
>>__/__/__/ Tessella Support Services plc
>>__/__/__/ 3 Vineyard Chambers, ABINGDON, OX14 3PX, England
>>__/__/__/ Tel: (44)(0)1235-555511 Fax: (44)(0)1235-553301
>> www.tessella.com
>> Registered in England No. 1466429
>>
>>
>>
>>
>>
>>
>>
>>
>
>--
>Jeff Lee <jeff at cdnorthamerica.com>
>Software Engineer
>CD North America
>21 Lafayette Street, Suite 230
>Lebanon, NH 03766
>Tel: (603) 643-9993 ext. 109
>Fax: (603) 643-9994
>
>
>
>
>
>
>
>This message is confidential and may be privileged. It is intended for the
>addressee(s) only. Access to this message by anyone else is unauthorized
>and strictly prohibited. If you have received this message in error, please
>inform the sender immediately.
>
>TESSELLA Steven.Aston at tessella.com
>__/__/__/ Tessella Support Services plc
>__/__/__/ 3 Vineyard Chambers, ABINGDON, OX14 3PX, England
>__/__/__/ Tel: (44)(0)1235-555511 Fax: (44)(0)1235-553301
> www.tessella.com
> Registered in England No. 1466429
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
More information about the vtkusers
mailing list