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

Home » Public Forums » archive » Re: cgArrow Solid keyword with a cgWindow
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
Re: cgArrow Solid keyword with a cgWindow [message #83910] Fri, 19 April 2013 12:54
seanelvidge is currently offline  seanelvidge
Messages: 11
Registered: January 2013
Junior Member
On Friday, 19 April 2013 13:22:19 UTC+1, David Fanning wrote:
>
> Oh, duh! Maybe adding ADDCMD=1 to the cgWindow command in the program
> code would help. :-(


Everything works perfectly now! Many thanks David.


Sean.
Re: cgArrow Solid keyword with a cgWindow [message #83912 is a reply to message #83910] Fri, 19 April 2013 05:22 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sean Elvidge writes:

> I tried to use the /WINDOW keyword, (as the documentation
> specifies ;)) first, but I found that the plotted arrow appears in a
> new cgWindow rather than the current one. That is (using Revision 1200
> of the SVN repo, before your latest update):
>
> cgWindow,'cgPlot',INDGEN(10),/NoData
> cgArrow, 2, 2, 5, 5, /Data, /WINDOW
>
> Which isn't what I was after, but since you say this works correctly
> perhaps I am doing something wrong.
>
> David Fanning wrote:
>> David Fanning writes:
>> By the way, I do recommend people read the documentation. It's often
>> enlightening. ;-)
>
> It's always enlightening :)
>
> I just tried the new cgArrow (Revision 1201), but now I can't get any
> of the arrow to plot in the cgWindow, using /AddCmd or /WINDOW.
> Perhaps it is what I am doing, since I couldn't get it to work in
> either revision? Here is an example:
>
> cgWindow, 'cgPlot', INDGEN(10), /NoData
> cgArrow, 2, 2, 5, 5, /Data, /AddCmd
> cgArrow, 2, 2, 5, 5, /Data, /Window
>
> Both those cgArrow commands plot an arrow in a new Window rather than
> in the existing cgWindow.
>
> Any suggestions?

Oh, duh! Maybe adding ADDCMD=1 to the cgWindow command in the program
code would help. :-(

http://www.idlcoyote.com/programs/cgarrow.pro

Cheers,

David

P.S. I've fired Coyote. Again!

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgArrow Solid keyword with a cgWindow [message #83913 is a reply to message #83912] Fri, 19 April 2013 03:01 Go to previous message
seanelvidge is currently offline  seanelvidge
Messages: 11
Registered: January 2013
Junior Member
On Thursday, 18 April 2013 14:54:46 UTC+1, David Fanning wrote:
> I do notice that this works correctly, if you use the WINDOW keyword, as
> the documentation specifies, rather than the ADDCMD keyword, which is
> not defined for this routine. :-)
>

I tried to use the /WINDOW keyword, (as the documentation
specifies ;)) first, but I found that the plotted arrow appears in a
new cgWindow rather than the current one. That is (using Revision 1200
of the SVN repo, before your latest update):

cgWindow,'cgPlot',INDGEN(10),/NoData
cgArrow, 2, 2, 5, 5, /Data, /WINDOW

Which isn't what I was after, but since you say this works correctly
perhaps I am doing something wrong.

David Fanning wrote:
> David Fanning writes:
> By the way, I do recommend people read the documentation. It's often
> enlightening. ;-)

It's always enlightening :)

I just tried the new cgArrow (Revision 1201), but now I can't get any
of the arrow to plot in the cgWindow, using /AddCmd or /WINDOW.
Perhaps it is what I am doing, since I couldn't get it to work in
either revision? Here is an example:

cgWindow, 'cgPlot', INDGEN(10), /NoData
cgArrow, 2, 2, 5, 5, /Data, /AddCmd
cgArrow, 2, 2, 5, 5, /Data, /Window

Both those cgArrow commands plot an arrow in a new Window rather than
in the existing cgWindow.

Any suggestions?


Thanks,

Sean.
Re: cgArrow Solid keyword with a cgWindow [message #83921 is a reply to message #83913] Thu, 18 April 2013 08:47 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> So, I'm just saying it's complicated. I do my best. ;-)

By the way, I do recommend people read the documentation. It's often
enlightening. ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgArrow Solid keyword with a cgWindow [message #83922 is a reply to message #83921] Thu, 18 April 2013 08:34 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Fabien writes:

> By the way, what are the rules for this? Do all routines have an /ADDCMD
> but not all routines have a /WINDOW? Could one of the two be suppressed?

The rational for having two keywords that do the same thing is that when
you get so excited about a great new idea, you sometimes start coding
before you really understand what the hell it is you are doing. This is
the unfortunate, messy result.

Originally, I thought a single WINDOW keyword would work great. You set
the WINDOW keyword, the command gets added to the resizeable graphics
window. What could be simpler?

But, then I realized I wanted the graphics commands to act like
"normal" graphics commands. If I do a line plot, I see a line plot. If I
then do a contour plot, the contour plot shows up in the same window as
the previous line plot, and so on. So, I changed the meaning of WINDOW
to mean "get rid of all the other commands in this window and add this
command to the window". That required the ADDCMD keyword for things I
wanted to "add" to commands that were already in the window.

Then, of course, you could replace commands, etc. I saw the keyword list
rapidly getting completely out of control. So I decided only two
keywords, WINDOW and ADDCMD. "WINDOW" more or less means "start over
with this command as the first command in the window". ADDCMD more or
less means "add this command to the list of commands that already exist
in the window". But, life is complicated, and it is not always so easy
to sort out the details.

Consider something like cgArrow. Has anyone anywhere ever drawn an arrow
in a graphics window without anything else around? Probably not. So, in
this case WINDOW probably should mean ADDCMD 99% of the time. But, as
soon as I make a decision like that, somebody sends me an e-mail
complaining that they just want a damn arrow in a graphics window! Sigh.

So, I'm just saying it's complicated. I do my best. ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgArrow Solid keyword with a cgWindow [message #83924 is a reply to message #83922] Thu, 18 April 2013 08:24 Go to previous message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
I remember being confused by these keywords as well. After working with them for a bit, I found:

1) the CG routines that (could) set up a plot space (e.g., cgplot, cgcontour, etc) uses /ADDCMD.

2) the ones that needed a plot space (cgplotS, cgColorFill) used /WINDOW.

Was that serendipitous?
Re: cgArrow Solid keyword with a cgWindow [message #83928 is a reply to message #83924] Thu, 18 April 2013 08:08 Go to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 04/18/2013 04:50 PM, David Fanning wrote:
> The simplest solution seemed to be to just define an ADDCMD keyword to
> this routine to make the interface more consistent with the rest of the
> Coyote Graphics library.

By the way, what are the rules for this? Do all routines have an /ADDCMD
but not all routines have a /WINDOW? Could one of the two be suppressed?

Thanks!

Fab
Re: cgArrow Solid keyword with a cgWindow [message #83929 is a reply to message #83928] Thu, 18 April 2013 07:50 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>> I've found that calling cgArrow with the /SOLID and /AddCmd keyword
doesn't work in adding a (solid) arrow to a resizable window. I think
this is because the call to cgColorFill in cgArrow (lines 233 and 234)
does not allow the parameter to be passed. I tried to fix it by adding
'_Extra=extra' to the cgColorFill call, but that also doesn't work
because /AddCmd is not allowed in the call to cgColorFill.
>
> Well, something is screwy, for sure. The solid arrowhead is being drawn,
> but not in the right window.
>
> I do notice that this works correctly, if you use the WINDOW keyword, as
> the documentation specifies, rather than the ADDCMD keyword, which is
> not defined for this routine. :-)
>
> I presume this has something to do with the ADDCMD keyword being passed
> along with _EXTRA. It looks to me like Coyote wrote this routine. I'll
> see if I can get it sorted out.

The simplest solution seemed to be to just define an ADDCMD keyword to
this routine to make the interface more consistent with the rest of the
Coyote Graphics library. You can find the updated routine here:

http://www.idlcoyote.com/programs/cgarrow.pro

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgArrow Solid keyword with a cgWindow [message #83932 is a reply to message #83929] Thu, 18 April 2013 06:54 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sean Elvidge writes:

> I've found that calling cgArrow with the /SOLID and /AddCmd keyword doesn't work in adding a (solid) arrow to a resizable window. I think this is because the call to cgColorFill in cgArrow (lines 233 and 234) does not allow the parameter to be passed. I tried to fix it by adding '_Extra=extra' to the cgColorFill call, but that also doesn't work because /AddCmd is not allowed in the call to cgColorFill.

Well, something is screwy, for sure. The solid arrowhead is being drawn,
but not in the right window.

I do notice that this works correctly, if you use the WINDOW keyword, as
the documentation specifies, rather than the ADDCMD keyword, which is
not defined for this routine. :-)

I presume this has something to do with the ADDCMD keyword being passed
along with _EXTRA. It looks to me like Coyote wrote this routine. I'll
see if I can get it sorted out.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to Zip cross-platform from IDL?
Next Topic: Re: issue with CMSAVE

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

Current Time: Wed Oct 08 15:39:30 PDT 2025

Total time taken to generate the page: 0.00474 seconds