comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Widgets and Animation Loops in IDL 5.0
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Widgets and Animation Loops in IDL 5.0 [message #16387] Fri, 23 July 1999 00:00 Go to next message
drphys is currently offline  drphys
Messages: 4
Registered: July 1999
Junior Member
Hi,
I am using IDL 5.0 on a DEC Alpha. I am animating a 3D plot of a
particle trajectory by incrementing the "az" variable and then
replotting in a loop. I decided to add widgets to control the speed of
rotation and the angle about the x axis "ax". I have found this to be
unworkable so far because once the code enters the loop the widgets do
not issue events, so my event handlers do not get called. This was
easily fixed by using widget_control commands inside the loop and using
sliders to control the speed and x angle, however, I can not find a
method to exit the loop, except for possibly adding a slider that could
turn it off. The solution seemed to be a toggle button that could be
examined using widget_control during the loop, but I have found no way
to examine the state of the toggle button. Also while I am at it, I am
new to 3D plotting using "plots" to do a trajectory plot. There seems
to be no way to get axis on the screen. I have tried the axis command
and can only get either one axis, or a white blotch (this seems random
as I have not touched that line of code for a while). So help on any of
the above will be greatly appreciated.

Thank you,
Shawn


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Re: Widgets and Animation Loops in IDL 5.0 [message #16464 is a reply to message #16387] Mon, 26 July 1999 00:00 Go to previous message
drphys is currently offline  drphys
Messages: 4
Registered: July 1999
Junior Member
thank you!
I believe that this is what I need.
Shawn


In article <7ng6aq$s6q$1@clam.niwa.cri.nz>,
"Mark Hadfield" <m.hadfield@niwa.cri.nz> wrote:
> <drphys@my-deja.com> wrote in message
news:7na6kq$q9b$1@nnrp1.deja.com...
>> Hi,
>> I am using IDL 5.0 on a DEC Alpha. I am animating a 3D plot of a
>> particle trajectory by incrementing the "az" variable and then
>> replotting in a loop. I decided to add widgets to control the speed
of
>> rotation and the angle about the x axis "ax". I have found this to
be
>> unworkable so far because once the code enters the loop the widgets
do
>> not issue events, so my event handlers do not get called. This was
>> easily fixed by using widget_control commands inside the loop and
using
>> sliders to control the speed and x angle, however, I can not find a
>> method to exit the loop, except for possibly adding a slider that
could
>> turn it off.
>
> Do not use a for or while loop for an animation. Instead, set up your
code
> so that
> each time a frame is drawn, a widget timer event is set with
>
> WIDGET_CONTROL, TIMER=delay
>
> (where delay can be zero). Then the widget event handler catches the
timer
> event,
> draws the next frame, and resets the timer, etc. The loop can be
terminated
> by instructing
> the event handler to ignore timer events. This is how CW_ANIMATE does
it.
> Information about the current state of the animation (current frame,
which
> direction
> we're going in, where the end is & what to do when we get there) can
be
> stored in a
> structure stored attached to one of the widget's UVALUE fields or,
better,
> in an object.
>
> I have found object graphics particularly good for animations, and I
have
> written a
> set of animator classes, which illustrate the above technique.
>
> See my Web page:
http://katipo.niwa.cri.nz/~hadfield/gust/software/idl/.
> In particular the MGHgrAnimation and MGHgrAnimator classes and the
> MGH_EXAMPLE_ANIMATOR routine. But you'll need version 5.2 to run them.
>
> ---
> Mark Hadfield m.hadfield@niwa.cri.nz
> National Institute for Water and Atmospheric Research
> PO Box 14-901, Wellington, New Zealand
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Re: Widgets and Animation Loops in IDL 5.0 [message #16465 is a reply to message #16387] Mon, 26 July 1999 00:00 Go to previous message
drphys is currently offline  drphys
Messages: 4
Registered: July 1999
Junior Member
thank you!
This all looks very goood. I will try implementing it later today.
Shawn


In article <MPG.120253cba46679d7989844@news.frii.com>,
davidf@dfanning.com (David Fanning) wrote:
> Shawn (drphys@my-deja.com) writes:
>
>> I am using IDL 5.0 on a DEC Alpha. I am animating a 3D plot of a
>> particle trajectory by incrementing the "az" variable and then
>> replotting in a loop. I decided to add widgets to control the speed
of
>> rotation and the angle about the x axis "ax". I have found this to
be
>> unworkable so far because once the code enters the loop the widgets
do
>> not issue events, so my event handlers do not get called. This was
>> easily fixed by using widget_control commands inside the loop and
using
>> sliders to control the speed and x angle, however, I can not find a
>> method to exit the loop, except for possibly adding a slider that
could
>> turn it off. The solution seemed to be a toggle button that could
be
>> examined using widget_control during the loop, but I have found no
way
>> to examine the state of the toggle button.
>
> You can look at my XMOVIE program for the proper way to
> do an animation in a widget program. It demonstrates how
> to write the program so that other events can be processed,
> so you can stop the animation, etc.
>
> http://www.dfanning.com/programs/xmovie.pro
>
>> Also while I am at it, I am
>> new to 3D plotting using "plots" to do a trajectory plot. There
seems
>> to be no way to get axis on the screen. I have tried the axis
command
>> and can only get either one axis, or a white blotch (this seems
random
>> as I have not touched that line of code for a while). So help on
any of
>> the above will be greatly appreciated.
>
> Here is an article that shows you exactly how
> to do a particle trajectory with axes:
>
> http://www.dfanning.com/tips/particle_3d.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: davidf@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Re: Widgets and Animation Loops in IDL 5.0 [message #16467 is a reply to message #16387] Mon, 26 July 1999 00:00 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
<drphys@my-deja.com> wrote in message news:7na6kq$q9b$1@nnrp1.deja.com...
> Hi,
> I am using IDL 5.0 on a DEC Alpha. I am animating a 3D plot of a
> particle trajectory by incrementing the "az" variable and then
> replotting in a loop. I decided to add widgets to control the speed of
> rotation and the angle about the x axis "ax". I have found this to be
> unworkable so far because once the code enters the loop the widgets do
> not issue events, so my event handlers do not get called. This was
> easily fixed by using widget_control commands inside the loop and using
> sliders to control the speed and x angle, however, I can not find a
> method to exit the loop, except for possibly adding a slider that could
> turn it off.

Do not use a for or while loop for an animation. Instead, set up your code
so that
each time a frame is drawn, a widget timer event is set with

WIDGET_CONTROL, TIMER=delay

(where delay can be zero). Then the widget event handler catches the timer
event,
draws the next frame, and resets the timer, etc. The loop can be terminated
by instructing
the event handler to ignore timer events. This is how CW_ANIMATE does it.
Information about the current state of the animation (current frame, which
direction
we're going in, where the end is & what to do when we get there) can be
stored in a
structure stored attached to one of the widget's UVALUE fields or, better,
in an object.

I have found object graphics particularly good for animations, and I have
written a
set of animator classes, which illustrate the above technique.

See my Web page: http://katipo.niwa.cri.nz/~hadfield/gust/software/idl/.
In particular the MGHgrAnimation and MGHgrAnimator classes and the
MGH_EXAMPLE_ANIMATOR routine. But you'll need version 5.2 to run them.

---
Mark Hadfield m.hadfield@niwa.cri.nz
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Mac top level widget
Next Topic: IDL 5.2 idlhelp not working under Red Hat 6.0

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 12:53:14 PDT 2025

Total time taken to generate the page: 0.62951 seconds