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

Home » Public Forums » archive » Re: string animations etc.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: string animations etc. [message #40979 is a reply to message #40975] Sun, 19 September 2004 16:52 Go to previous messageGo to previous message
Richard French is currently offline  Richard French
Messages: 173
Registered: December 2000
Senior Member
Neat! But 'defined()' does not seem to be a built-in IDL function (I cobbled
one together to get this to run), and I think the line should read

If not defined(name0) then name0=''

Thanks for posting this!
Dick

> ;+
> ; -----------------------------
> ; 2/27/96
> ; IDL procedure: textmeter.pro
> ;
> ; This procedure draws a "meter" on the screen to display what
> ; fraction of a job has been completed. Calling textmeter with
> ; x=0 initializes the meter.
> ; -----------------------------
> ;-
>
> pro textmeter, x, s0, remain=remain
> common block_textmeter, time0, base, n0, n1, backup, name0
> if not defined(s0) then s0=''
> if not defined(name) then name0=''
> if ((x LE 0.01) or (not defined(base))) then begin ; set-up
> time0 = systime(1)
> name0 = s0
> n0 = strlen(s0+':')
> s1 = '----+'
> base='' & for i=1,10 do base=base+s1
> n1 = strlen(base) ; should be 50
> nb = n0+n1+8
> backup='' & for i=0,nb do backup = backup + string(8b)
> endif
> done = (x GE 1.)
> x = 0. > x < 0.9999
> nx = floor(x*float(n1))
> st=':' & for i=1,nx do st=st+'*'
> dt = systime(1)-time0
> if keyword_set(remain) $
> then if (x EQ 0.) $
> then time="??????????" $
> else time = string(format="(f8.2,' s')", dt*(1.-x)/x) $
> else time = string(format="(f8.2,' s')",dt)
> out = s0 + st + strmid(base,nx+1,n1-nx-1) + time + backup
> print, format="(a,$)", out
> if done then begin
> print, ''
> print, ''
> endif
> return
> end
>
>
> Here's a command-line program to see how it works
>
> IDL> textmeter,0.,'hi' & for i=0,100 do begin & textmeter, i/100.,
> 'hi' & wait, 0.05 & end
>
> Basically, you "initialize" it by sending a 0.0 argument.
> The second argument is an optional string which you can use to tell
> the user what function is being processed, for example. When it's
> running, sent it values between 0.0 and 1.0 which represent the
> fraction of the job that has been completed. The text-meter will
> report the elapsed time. When it reaches 1.0 or greater, it stops.
>
> If you want the meter to predict how much time is remaining, set the
> /remain keyword, and it will do its best to estimate, assuming the
> progress information you send it is linear in time.
>
> Note that this function relies on string(8b) being able to back-up the
> cursor when printing. This works in xterm. Perhaps in some other
> implementations this might need to be tweaked to make it work. If you
> write any other text to the screen while this is running, it will
> disrupt the output, but in a non-fatal way. It just won't look nice
> anymore. The backing-up essentially erases the line it's just printed
> and allows the terminal to overwrite what it just wrote. You could get
> the hang of it and make any kind of animation you want.
>
> Best,
> M. Katz
>
>
> ee7klt@sfsu.edu (KL) wrote in message
> news:<20fda9c1.0409171417.1319289@posting.google.com>...
>> Hi,
>> I was trying to do a simple string animation whereby there is a
>> running number printed i.e. a number eg. of the form xxxx.xx that gets
>> updated continuously next to some plot in the display window (as
>> opposed to jumping discretely) while the program is crunching away in
>> a 'for loop'. Does any one have ideas on how I may do this?
>>
>> Also, this program calculates the path of some object thru' space. I'd
>> like to be able to have this line drawn in real-time in the display
>> window, corresponding to the running number.
>>
>> Thanks,
>> KL
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Irregularly Lat Lon Grid: Displaying Land Types
Next Topic: xinteranimate and string

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

Current Time: Fri Oct 10 20:29:50 PDT 2025

Total time taken to generate the page: 1.83879 seconds