Interesting "Feature" Discovered! [message #79433] |
Tue, 28 February 2012 09:49 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
From time to time I have seen an interesting "feature"
in IDL that I am always in too much of a hurry to
investigate. It has to do with putting images on
maps.
I work almost exclusively now with graphics windows
that have white backgrounds. I create these windows
with cgDisplay, rather than the Window command. But,
occasionally, when I am working with images and map
projections I find that the image will go into the
window and create a black background. This is so
EVEN if have set the image background to "white":
IDL> cgImage, image, Background='white'
Today, I am in my usual hurry, but this annoyed
me so much I decided to look into it! :-)
cgImage normally "erases" the window in the same
way all IDL commands (except the TV command!) do.
The only time it doesn't do that is if I am doing
multiple plots, etc. The way I check to see if
I am doing multiple plots is to check the first
element of !P.Multi to see how many plots remain
to be plotted on the page. This element normally
has values from 0 to one less then the number of
plots you want to draw.
When I looked into the black background problem
I found that the "erasing" part of the cgImage code
was being skipped. Say what!? I'm not doing multiple
plots! Why should it skip?
It turns out that in certain circumstances !P.Multi[0]
can be a number LESS THAN 0!!! In fact, all you have
to do to make it a number less than 0 is to issue
a MAP_SET command!
IDL> Map_Set
IDL> Print, !P.Multi
-1 0 0 0 0
I've fixed cgImage this morning to be aware of this
"feature" of Map_Set. :-)
http://www.idlcoyote.com/programs/cgimage.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 thui. ("Perhaps thou speakest truth.")
|
|
|