[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving & replaying direct graphics commands (was Re: Top 10 IDL Requests)



"David Fanning" <davidf@dfanning.com> wrote in message
MPG.13efb1c941a32b12989b8e@news.frii.com">news:MPG.13efb1c941a32b12989b8e@news.frii.com...
> Mark Hadfield (m.hadfield@niwa.cri.nz) writes:
>
> > owin = obj_new('xzwindow')
> > owin->plot, 'plot', findgen(11)
> > owin->plot, 'oplot', 0.1*findgen(11)^2, LINESTYLE=1
> > owin->plot, 'oplot', sqrt(10.*findgen(11)), LINESTYLE=2, COLOR=3
>
> I've written exactly this kind of thing (on more than
> one occasion, I think). But I always get half finished
> and then I'm distracted by something seemingly more
> important. But I use my LinkedList object to store
> the commands. I even had a "command editor" working,
> where you could add or delete commands, move them
> around, etc.

My main obstacles to finishing this have been: 1) I don't use direct
graphics much, 2) I'm not sure of usefulness. But a command editor would be
a really cool thing!

I strongly favour storing the commands as objects defined specifically for
the purpose. Then you can give them as much intelligence as you want and you
can store them in an IDL_Container. I'm not 100% sure whether it's better to
execute a command by calling an Execute (or whatever) method or by having
the caller pulling out the data and then using
call_procedure/call_function/execute . The former seems cleaner to me but
the latter has the advantage(?) that all the commands are executed in the
same scope. It depends whether you want to be able to handle things like

owin->plot, 'openr, lun, filename, /GET_LUN', /EXECUTE
owin->plot, 'readu, lun, x', /EXECUTE
owin->plot, 'free_lun, lun, /GET_LUN', /EXECUTE
owin->plot, 'plot, x', /EXECUTE

...probably not.

And then when you think about it, there already is a command editor in IDL,
it's the one you use to write functions, procedures & scripts, so why not
wrap up all your plotting commands in a single procedure a la XWINDOW.

Open-mindedly yours...
---
Mark Hadfield
m.hadfield@niwa.cri.nz  http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand