Re: Multiple plots on Object graphics [message #49007 is a reply to message #49006] |
Fri, 09 June 2006 12:38  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
hyperjiver@yahoo.com writes:
> I am trying to draw multiple ROIs using XROI and everytime an ROI is
> drawn, I need to generate a plot. I modified the XROI.pro program to
> add a Draw widget.
>
> Everytime I draw a ROI, I want to plot in the draw widget. The next
> plot should also be in the same window and rescale itself according to
> the new values and show both the plots. Anytime I delete an ROI I want
> the respective plot to be deleted as well.
>
> Can anybody please help??
This is a good project for an intermediate IDL programming
course. In fact, I'll see if I can get some of the participants
in my upcoming UK courses to write this for us. :-)
I would do this with direct graphics objects. Create
a "plot" object, which is simple enough. It just draws
the plot with a particular color, linestyle, and symbol
when its DRAW method is called. Then create a "window"
object which is just a draw widget subclassed from
an IDL_Container object. The DRAW method of the window
object would have some notion of a "grid" of plots.
This is nothing more than a way to set up the number of
columns and rows required for X number of plots.
When the DRAW method of the window is called, it counts
how many plot objects have been added to it, calculates
its grid (I'm sure I have done this multiple times in
the past!), and then sets !P.MULTI appropriately and
calls the DRAW methods of all it's children. Viola!
Plots on the page!
When a plot is removed from the window container, the
window simply calls its DRAW method again, and everything
happens automatically. Gosh, you have *got* to love objects!!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|