Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Hi all, Here's a simplified explanation of what I'm doing with my widget application and Function Graphics, and what I'm having trouble with. I make a draw widget and use the Plot() function to make a plot, which the user can interact with: wDraw = Widget_Window(...) ; after /Realizing widgets Widget_Control, wDraw, GET_VALUE=oWindow oWindow.Select oPlot = Plot(...) oLegend = Legend(…) And I also have a Widget_Table with other details. Once the user is happy with what is shown in the plot and the table, I'd like to provide a Print feature to make a PDF that shows both of those on one page. I know the table won't come automatically (I'll have to lay that out with TEXT() objects, which is fine), but is there a way I can use oPlot and oLegend (or simply, oWindow) as *part* of what I want on a PDF page and add other things to that page? I know that oWindow.Save, 'myfile.pdf' creates a lovely PDF page of the current state of the window (which contains the plot), but I want to add other things to the page. If I could make a new oPDFWindow object and add oPlot and oLabel to it, then add my table text objects, I could then do oPDFWindow.Save and I'm set. oWindow is a GraphicsWin object, which Help, /OBJECTS tells me has: Known Procedure Methods: IDLITWINDOW::ADD … so I tried: oPDFWindow = GraphicsWin() oPDFWindow.Add, oPlot and I got: % IDLGRMODEL::ADD: Invalid object reference: <ObjHeapVar434720>. … as that Add method seems to be looking for regular "object graphics" objects. The Plot() function calls the procedure "Graphic" which goes down a pretty deep rabbit hole… Has anyone else been down there? Yes, I could make a routine to create the plots/legend, and call it once when I send it to screen and again when I send it to PDF, but I'd like to print to PDF the current state of the plots/legend, which the user may have customized on-screen. Other ideas? Thanks for reading. Cheers, -Dick Dick Jackson Software Consulting Inc. Victoria, BC, Canada --- http://www.d-jackson.com
Re: Adding more to a Window.Save PDF page
On Friday, June 23, 2017 at 2:26:06 AM UTC+2, Dick Jackson wrote: > Hi all, > > Here's a simplified explanation of what I'm doing with my widget application and Function Graphics, and what I'm having trouble with. I make a draw widget and use the Plot() function to make a plot, which the user can interact with: > > wDraw = Widget_Window(...) > > ; after /Realizing widgets > > Widget_Control, wDraw, GET_VALUE=oWindow > > oWindow.Select > > oPlot = Plot(...) > oLegend = Legend(…) > > And I also have a Widget_Table with other details. > > Once the user is happy with what is shown in the plot and the table, I'd like to provide a Print feature to make a PDF that shows both of those on one page. > > I know the table won't come automatically (I'll have to lay that out with TEXT() objects, which is fine), but is there a way I can use oPlot and oLegend (or simply, oWindow) as *part* of what I want on a PDF page and add other things to that page? I know that oWindow.Save, 'myfile.pdf' creates a lovely PDF page of the current state of the window (which contains the plot), but I want to add other things to the page. > > If I could make a new oPDFWindow object and add oPlot and oLabel to it, then add my table text objects, I could then do oPDFWindow.Save and I'm set. > > oWindow is a GraphicsWin object, which Help, /OBJECTS tells me has: > > Known Procedure Methods: > IDLITWINDOW::ADD > > … so I tried: > > oPDFWindow = GraphicsWin() > oPDFWindow.Add, oPlot > > and I got: > > % IDLGRMODEL::ADD: Invalid object reference: <ObjHeapVar434720>. > > … as that Add method seems to be looking for regular "object graphics" objects. > > The Plot() function calls the procedure "Graphic" which goes down a pretty deep rabbit hole… Has anyone else been down there? > > Yes, I could make a routine to create the plots/legend, and call it once when I send it to screen and again when I send it to PDF, but I'd like to print to PDF the current state of the plots/legend, which the user may have customized on-screen. > > Other ideas? Thanks for reading. > > Cheers, > -Dick > > Dick Jackson Software Consulting Inc. > Victoria, BC, Canada --- http://www.d-jackson.com Hi Dick, I'm not sure if this would solve your problem, but I just faced a similar problem and I will try solving it this way. How about using the copyWindow() method? I'm using function graphics and I have two widget_window(s) with image and plot. I would like to export a movie of image+plot. Combining both in the same widget_window is not an option because I cannot then export a single one of them. Therefore, I think that the only option is : ww = window(dimensions=[2*nx,ny], /buffer) o1 = image(sourceObj1.copyWindow(), margin=0, layout=[2,1,1], current=ww) o2 = image(sourceObj2.copyWindow(), margin=0, layout=[2,1,2], current=ww) ww.save, myFileName You can of course play with window dimensions and margin to get the right fit. I hope it helps. Cheers, Helder
On Thursday, 29 June 2017 00:14:23 UTC-7, Helder wrote: > On Friday, June 23, 2017 at 2:26:06 AM UTC+2, Dick Jackson wrote: >> Hi all, >> >> Here's a simplified explanation of what I'm doing with my widget application and Function Graphics, and what I'm having trouble with. I make a draw widget and use the Plot() function to make a plot, which the user can interact with: >> >> wDraw = Widget_Window(...) >> >> ; after /Realizing widgets >> >> Widget_Control, wDraw, GET_VALUE=oWindow >> >> oWindow.Select >> >> oPlot = Plot(...) >> oLegend = Legend(…) >> >> And I also have a Widget_Table with other details. >> >> Once the user is happy with what is shown in the plot and the table, I'd like to provide a Print feature to make a PDF that shows both of those on one page. >> >> I know the table won't come automatically (I'll have to lay that out with TEXT() objects, which is fine), but is there a way I can use oPlot and oLegend (or simply, oWindow) as *part* of what I want on a PDF page and add other things to that page? I know that oWindow.Save, 'myfile.pdf' creates a lovely PDF page of the current state of the window (which contains the plot), but I want to add other things to the page. >> >> If I could make a new oPDFWindow object and add oPlot and oLabel to it, then add my table text objects, I could then do oPDFWindow.Save and I'm set. >> >> oWindow is a GraphicsWin object, which Help, /OBJECTS tells me has: >> >> Known Procedure Methods: >> IDLITWINDOW::ADD >> >> … so I tried: >> >> oPDFWindow = GraphicsWin() >> oPDFWindow.Add, oPlot >> >> and I got: >> >> % IDLGRMODEL::ADD: Invalid object reference: <ObjHeapVar434720>. >> >> … as that Add method seems to be looking for regular "object graphics" objects. >> >> The Plot() function calls the procedure "Graphic" which goes down a pretty deep rabbit hole… Has anyone else been down there? >> >> Yes, I could make a routine to create the plots/legend, and call it once when I send it to screen and again when I send it to PDF, but I'd like to print to PDF the current state of the plots/legend, which the user may have customized on-screen. >> >> Other ideas? Thanks for reading. >> >> Cheers, >> -Dick >> >> Dick Jackson Software Consulting Inc. >> Victoria, BC, Canada --- http://www.d-jackson.com > > Hi Dick, > I'm not sure if this would solve your problem, but I just faced a similar problem and I will try solving it this way. How about using the copyWindow() method? > I'm using function graphics and I have two widget_window(s) with image and plot. I would like to export a movie of image+plot. Combining both in the same widget_window is not an option because I cannot then export a single one of them. Therefore, I think that the only option is : > > ww = window(dimensions=[2*nx,ny], /buffer) > o1 = image(sourceObj1.copyWindow(), margin=0, layout=[2,1,1], current=ww) > o2 = image(sourceObj2.copyWindow(), margin=0, layout=[2,1,2], current=ww) > ww.save, myFileName > > You can of course play with window dimensions and margin to get the right fit. > I hope it helps. > > Cheers, > Helder Thanks for the idea, Helder. (sorry for the delayed reply… when you posted, I was just getting ready to go away on holiday) This might be handy, with the difference being that it would take a screen-resolution (and window size-dependent) snapshot, rather than a high-quality PDF. But that might be good enough. Thanks again, Helder. Cheers, -Dick Dick Jackson Software Consulting Inc. Victoria, BC, Canada --- http://www.d-jackson.com