Extended IDL Help

This page was created by a MODIFICATION of the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Wed Oct 6 17:29:59 1999.


List of Routines


Routine Descriptions

ASPECT

[Next Routine] [List of Routines]
 NAME:
	ASPECT

 PURPOSE:
	This function calculates and returns the normalized position
	coordinates necessary to put a plot with a specified aspect ratio
	into the currently active graphics window. It works on the display
	output window as well as in a PostScript output window.

 CATEGORY:
	Graphics

 CALLING SEQUENCE:

	position = ASPECT(aspectRatio)

 INPUTS:
	aspectRatio: A floating point value that is the desired aspect
	ratio (ratio of heigth to width) of the plot in the current 
	graphics output window. If this parameter is missing, an aspect
	ratio of 1.0 (a square plot) is assumed.

 KEYWORD PARAMETERS:
	MARGIN:	The margin around the edges of the plot. The value must be
	a floating point value between 0.0 and 0.5. It is expressed in
	normalized coordinate units. The default margin is 0.15.

 OUTPUTS:
	position: A four-element floating array of normalized coordinates.
	The order of the elements is [x0, y0, x1, y1], similar to the
	!P.POSITION system variable or the POSITION keyword on any IDL
	graphic command.

 EXAMPLE:
	To create a plot with an aspect ratio of 1:2 and a margin of
	0.10 around the edge of the output window, do this:

	   plotPosition = ASPECT(0.5, Margin=0.10)
	   PLOT, Findgen(11), POSITION=plotPosition
	
	Notice this can be done in a single IDL command, like this:
	
	   PLOT, Findgen(11), POSITION=ASPECT(0.5, Margin=0.10)

 MODIFICATION HISTORY:
 	Written by:	David Fanning, November 1996.
       Added better error checking, 18 Feb 97, DWF.

(See /nstxusr1/util/idl_cvs/coyote/aspect.pro)


CENTERTLB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CENTERTLB

 PURPOSE:

       This is a utility routine to center a widget program
       on the display.

 AUTHOR:

       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:

       Utilities

 CALLING SEQUENCE:
       CenterTLB, tlb

 INPUTS:
       tlb: The top-level base identifier of the widget program.

 PROCEDURE:
       The program should be called after all the widgets have
       been created, but just before the widget hierarchy is realized.
       It uses the top-level base geometry along with the display size
       to calculate offsets for the top-level base that will center the
       top-level base on the display.

 MODIFICATION HISTORY:
       Written by:  Dick Jackson, 12 Dec 98.

(See /nstxusr1/util/idl_cvs/coyote/centertlb.pro)


CHGCOLOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CHGCOLOR

 PURPOSE:
       The purpose of this routine is to allow the user to change
       the color at a particular color index. The user is able to
       mix their own color by manipulating red, green, and blue
       sliders. This routine is ideal for changing axes or background
       colors of a plot, for example. The routine works on 8-bit,
       16-bit, and 24-bit displays.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets, Colors.

 CALLING SEQUENCE:
       CHGCOLOR, index

 REQUIRED INPUTS:
       INDEX: The color index to be changed. It must be a value
       between 0 and 255.

 KEYWORD PARAMETERS:

       LABEL: Text that goes next to the color window. The default is
       "Resulting Color".

       GROUP_LEADER: The group leader for this program. When the group leader
       is destroyed, this program will be destroyed.

       NOTIFYID: A a 2 column by n row array that contains the IDs of widgets
       that should be notified when CHGCOLOR changes a color. The first
       column of the array contains widgets that should be notified. The
       second column contains IDs of widgets that are at the top of the
       hierarch in which the corresponding widgets in the first column
       are located. (The purpose of the top widget IDs is to make it
       possible for the widget in the first column to get the "info"
       structure of the widget program.) An CHGCOLOR_LOAD event will be
       sent to the widget identified in the first column. The event
       structure is defined like this:

       event = {CHGCOLOR_LOAD, ID:0L, TOP:0L, HANDLER:0L, $
          r:(!D.N_COLORS < 256), g:(!D.N_COLORS < 256), b:(!D.N_COLORS < 256)}

       The ID field will be filled out with NOTIFYID(0, n) and the TOP
       field will be filled out with NOTIFYID(1, n).

       TITLE: This is the window title. It is "Modify Drawing Color" by
       default. The program is registered with the name "chgcolor " plus
       the TITLE string. The register name is checked before the widgets
       are defined. This gives you the opportunity to have multiple copies
       of CHGCOLOR operating simultaneously. (For example, one will change
       the background color and one will change the plotting color.)

       XOFFSET: This is the X offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       YOFFSET: This is the Y offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       Color at the specified index is changed. Events are sent to widgets
       if the NOTIFYID keyword is used.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To change the background color of a plot, type:

       CHGCOLOR, !P.Background

       To see a more complete example, look at the program SLICE
       in the Coyote Software Library:

          ftp://ftp.frii.com/pub/dfanning/outgoing/idl_examples

 MODIFICATION HISTORY:
       Written by David Fanning, 23 April 97.
       12 May 97, Fixed a bug in the way colors were loaded when
          a tracking event occurred. DWF
       13 May 97, Added a JUST_REGISTER keyword and set it up for
          running in IDL 5.0 as a non-blocking widget.
       27 Sept 98. Fixed problems caused by IDL 5.1 color changes.
       27 Sept 98. Removed JUST_REGISTER keyword. Made widget non-blocking.
       03 Nov 98. Modified layout and added slider ganging. DWF.

(See /nstxusr1/util/idl_cvs/coyote/chgcolor.pro)


CINDEX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CIndex

 PURPOSE:
       This is a program for viewing the current colors in the
       colortable with their index numbers overlayed on each color.
       On 24-bit systems you must click the cursor in the graphics window
       to see the colors in the current color table.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY: Graphics

 CALLING SEQUENCE:  CIndex

 INPUTS:   None.

 Optional Inputs:   None

 OUTPUTS:  None

 OPTIONAL OUTPUTS:  None

 KEYWORD Parameters:   None

 COMMON BLOCKS:  None

 SIDE EFFECTS:   None

 RESTRICTIONS:   Reqires XCOLORS from the Coyote Library:

                     http://www.dfanning.com/programs/xcolors.pro

 PROCEDURE:

  Draws a 31x25 set of small rectangles in 256 different colors.
  Writes the color index number on top of each rectangle.

 MODIFICATION HISTORY:  David Fanning, RSI, May 1995

  Widgetized and made it work in 24-bit color. Colors are
     updated by clicking in window. 22 Oct 98. DWF

  Replace POLYFILL with TV command to avoid underflow error in
     Z-buffer. 8 March 99. DWF

(See /nstxusr1/util/idl_cvs/coyote/cindex.pro)


COLOR24

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       COLOR24

 PURPOSE:
       The purpose of this function is to convert a RGB color triple
       into the equivalent 24-big long integer. 

 CATEGORY:
       Graphics, Color Specification.

 CALLING SEQUENCE:
       color = COLOR24(rgb_triple)

 INPUTS:
       RGB_TRIPLE: A three-element column or row array representing 
       a color triple. The values of the elements must be between 
       0 and 255.

 KEYWORD PARAMETERS:
       None. 

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To convert the color triple for the color YELLOW, 
       (255, 255, 0), to the hexadecimal value '00FFFF'x 
       or the decimal number 65535, type:

       color = COLOR24([255, 255, 0])
       
       This routine was written to be used with routines like 
       COLORS or GETCOLOR

 MODIFICATION HISTORY:
       Written by:	David Fanning, 3 February 96.

(See /nstxusr1/util/idl_cvs/coyote/color24.pro)


COLORBAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   COLORBAR

 PURPOSE:
       The purpose of this routine is to add a color bar to the current
       graphics window.

 CATEGORY:
       Graphics, Widgets.

 CALLING SEQUENCE:
       COLORBAR

 INPUTS:
       None.

 KEYWORD PARAMETERS:

       BOTTOM:   The lowest color index of the colors to be loaded in
                 the bar.

       CHARSIZE: The character size of the color bar annotations. Default is 1.0.

       COLOR:    The color index of the bar outline and characters. Default
                 is !P.Color..

       DIVISIONS: The number of divisions to divide the bar into. There will
                 be (divisions + 1) annotations. The default is 6.

       FONT:     Sets the font of the annotation. Hershey: -1, Hardware:0, True-Type: 1.

       FORMAT:   The format of the bar annotations. Default is '(I5)'.

       MAXRANGE: The maximum data value for the bar annotation. Default is
                 NCOLORS.

       MINRANGE: The minimum data value for the bar annotation. Default is 0.

       MINOR:    The number of minor tick divisions. Default is 2.

       NCOLORS:  This is the number of colors in the color bar.

       POSITION: A four-element array of normalized coordinates in the same
                 form as the POSITION keyword on a plot. Default is
                 [0.88, 0.15, 0.95, 0.95] for a vertical bar and
                 [0.15, 0.88, 0.95, 0.95] for a horizontal bar.
;
       RANGE:    A two-element vector of the form [min, max]. Provides an
                 alternative way of setting the MINRANGE and MAXRANGE keywords.

       RIGHT:    This puts the labels on the right-hand side of a vertical
                 color bar. It applies only to vertical color bars.

       TITLE:    This is title for the color bar. The default is to have
                 no title.

       TOP:      This puts the labels on top of the bar rather than under it.
                 The keyword only applies if a horizontal color bar is rendered.

       VERTICAL: Setting this keyword give a vertical color bar. The default
                 is a horizontal color bar.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       Color bar is drawn in the current graphics window.

 RESTRICTIONS:
       The number of colors available on the display device (not the
       PostScript device) is used unless the NCOLORS keyword is used.

 EXAMPLE:
       To display a horizontal color bar above a contour plot, type:

       LOADCT, 5, NCOLORS=100
       CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $
          C_COLORS=INDGEN(25)*4, NLEVELS=25
       COLORBAR, NCOLORS=100, POSITION=[0.15, 0.85, 0.95, 0.90]

 MODIFICATION HISTORY:
       Written by: David Fanning, 10 JUNE 96.
       10/27/96: Added the ability to send output to PostScript. DWF
       11/4/96: Substantially rewritten to go to screen or PostScript
           file without having to know much about the PostScript device
           or even what the current graphics device is. DWF
       1/27/97: Added the RIGHT and TOP keywords. Also modified the
            way the TITLE keyword works. DWF
       7/15/97: Fixed a problem some machines have with plots that have
            no valid data range in them. DWF
       12/5/98: Fixed a problem in how the colorbar image is created that
            seemed to tickle a bug in some versions of IDL. DWF.
       1/12/99: Fixed a problem caused by RSI fixing a bug in IDL 5.2. Sigh... DWF.
       3/30/99: Modified a few of the defaults. DWF.
       3/30/99: Used NORMAL rather than DEVICE coords for positioning bar. DWF.
       3/30/99: Added the RANGE keyword. DWF.
       3/30/99: Added FONT keyword. DWF
       5/6/99: Many modifications to defaults. DWF.
       5/6/99: Removed PSCOLOR keyword. DWF.
       5/6/99: Improved error handling on position coordinates. DWF.
       5/6/99. Added MINOR keyword. DWF.
       5/6/99: Set Device, Decomposed=0 if necessary. DWF.
       2/9/99: Fixed a problem caused by setting BOTTOM keyword, but not NCOLORS. DWF.
       8/17/99. Fixed a problem with ambiguous MIN and MINOR keywords. DWF
       8/25/99. I think I *finally* got the BOTTOM/NCOLORS thing sorted out. :-( DWF.

(See /nstxusr1/util/idl_cvs/coyote/colorbar.pro)


COLORBAR__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       COLORBAR__DEFINE

 PURPOSE:
       The purpose of this routine is to implement a COLORBAR object
       class. The ColorBar is rendered in the direct graphics system.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Graphics.

 CALLING SEQUENCE:
       colorbar = Obj_New("COLORBAR")

 INPUTS:
       All inputs to the program are via keyword parameters.

 KEYWORD PARAMETERS:

   Background: Background color. This is the color with which the colorbar is
               erased. The default color is !P.Background.
   Bottom: Bottom color index of colors allocated to colorbar.
   Charsize: Character size of annotation. Default is 1.0.
   Color: Color of annotation and outline. Default is !P.Color.
   Font: Font to use for annotation. Default is -1, Hershey fonts.
   Format: Format of annotation. Default is "(F8.2)".
   Major: The number of major tick intervals. Default is 5.
   Minor: The number of minor tick intervals. Default is 2.
   MinusOne: Set this keyword to choose MinusOne keyword on the Congrid command
               that resizes the colorbar into the window.
   NColors: The number of colors allocated to colorbar. Default is (256 < !D.N_Colors).
   Neighbor: Set to indicate Nearest Neighbor sampling for Congrid. Default is 0 (Bilinear).
   Position: The position of colorbar in normalized coordinates. Default for a horizontal
               colorbar is [0.15, 0.88, 0.85, 0.95]. Default for a vertical colorbar is
               [0.88, 0.15, 0.95, 0.85]. These defaults are designed for a 400 by 400 window.
   Range: The data range on colorbar. Default is [0, 255].
   TickLen: The length of tick marks. Default is 0.2.
   Title: The title of the color bar. Default is a null string.
   Vertical: Set this keyword if you want a vertical colorbar. Default is horizontal.
   XEraseBox: A five-element vector of X points (normalized) for erasing the colorbar plot.
               Normally this keyword will not have to be used. The program uses the plot
               REGION for erasing. But larger character sizes can result in annotation going
               outside the region enclosed by the plot. If that is the case, then use this
               keyword along with YEraseBox to specify a larger-than-normal erasure area.
               The points are sent to the POLYFILL command for erasing.

                 POLYFILL, xEraseBox, yEraseBox, /Normal, Color=background

   YEraseBox: A five-element vector of Y points (normalized) for erasing the colorbar plot.

 OBJECT METHODS:

   Draw: This procedure method draws the colorbar in the display window. The ERASE keyword
               to this method will erase the current colorbar (by calling the ERASE method)
               before drawing the colorbar in the display window.

               colorbar->Draw

   Erase: This procedure method erases the colorbar object in the window. It accomplishes
               this by performing a POLYFILL in the background color. This method is
               primarily useful for interactive graphics display devices.

               colorbar->Erase

   GetProperty: This procedure method allows one to obtain the current state of the
               object via the keyword parameters listed above.

               colorbar->GetProperty, Range=currentRange, Title=currentTitle
               Print, currentRange, currentTitle

   SetProperty: This procedure method allows one to set the properties of the colorbar
               object via the keywords described above. In addition, a DRAW and ERASE
               keyword are provided so that the colorbar can be immediately drawn when
               the new property is set.

               colorbar->SetProperty, Range=[500, 15000], /Erase, /Draw

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       The display window is not erased first.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To create a colorbar, use it, then destroy it, type:

       colorbar = Obj_New("COLORBAR", Title='Colorbar Values', Range=[0,1000], Format='(I4)')
       Window
       LoadCT, 5
       colorbar->Draw
       colorbar->SetProperty, Range=[0,500], /Erase, /Draw
       Obj_Destroy, colorbar

 MODIFICATION HISTORY:
       Written by: David Fanning, Fanning Software Consulting, 26 November 1998.
       Added Horizontal keyword to SetProperty method and fixed problem in going
          from Vertical to Horizontal color bars. 29 Nov 1998. DWF.
       Added LoadCT method and current color table index to object. 6 December 1998.
       Fixed a bug dealing with nearest neighbor resampling. 30 Mar 1999. DWF.
       Fixed a bug with how NCOLORS and BOTTOM keywords interacted. 29 Aug 1999. DWF.

(See /nstxusr1/util/idl_cvs/coyote/colorbar__define.pro)


COYOTELIST__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   COYOTELIST__DEFINE

 PURPOSE:
   The purpose of this program is to implement a list that
   is linked in both the forward and backward directions. There
   is no restriction as to what can be stored in a linked list
   node. The linked list is implemented as an object.

(See /nstxusr1/util/idl_cvs/coyote/coyotelist__define.pro)


ERROR_MESSAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    ERROR_MESSAGE

 PURPOSE:
    The purpose of this function  is to have a device-independent
    error messaging function. The error message is reported
    to the user by using DIALOG_MESSAGE if widgets are
    supported and MESSAGE otherwise.

 CATEGORY:
    Utility.

 CALLING SEQUENCE:
    ok = Error_Message(the_Error_Message)

 INPUTS:
    the_Error_Message: This is a string argument containing the error
       message you want reported. If undefined, this variable is set
       to the string in the !Error_State.Msg system variable.

 KEYWORDS:
    TRACEBACK: Setting this keyword results in an error traceback
       being printed to standard output with the PRINT command.

 OUTPUTS:
    Currently the only output from the function is the string "OK".

 RESTRICTIONS:
    The "Warning" Dialog_Message dialog is used.

 EXAMPLE:
    To handle an undefined variable error:

    IF N_Elements(variable) EQ 0 THEN $
       ok = Error_Message('Variable is undefined', /Traceback)

 MODIFICATION HISTORY:
    Written by: David Fanning, 27 April 1999.

(See /nstxusr1/util/idl_cvs/coyote/error_message.pro)


GETCOLOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GETCOLOR

 PURPOSE:
       The original purpose of this function was to enable the
       user to specify one of the 16 colors supported by the
       McIDAS color map by name. Over time, however, the function
       has become a general purpose function for handling and
       supporting drawing colors in a device-independent way.
       In particular, I have been looking for ways to write color
       handling code that will work transparently on both 8-bit and
       24-bit machines. On 24-bit machines, the code should work the
       same where color decomposition is turned on or off.

       (The 16 supported colors in GETCOLOR come from the McIDAS color
       table offered on the IDL newsgroup by Liam Gumley.)

 CATEGORY:
       Graphics, Color Specification.

 CALLING SEQUENCE:
       result = GETCOLOR(color)

 OPTIONAL INPUT PARAMETERS:
       COLOR: A string with the "name" of the color. Valid names are:
           black
           magenta
           cyan
           yellow
           green
           red
           blue
           navy
           gold
           pink
           aqua
           orchid
           gray
           sky
           beige
           white

           The color YELLOW is returned if the color name can't be resolved.
           Case is unimportant.

           If the function is called with just this single input parameter,
           the return value is either a 1-by-3 array containing the RGB values of
           that particular color, or a 24-bit integer that can be "decomposed" into
           that particular color, depending upon the state of the TRUE keyword and
           upon whether color decomposition is turned on or off. The state of color
           decomposition can ONLY be determined if the program is being run in
           IDL 5.2 or higher.

       INDEX: The color table index where the specified color should be loaded.
           If this parameter is passed, then the return value of the function is the
           index number and not the color triple. (If color decomposition is turned
           on AND the user specifies an index parameter, the color is loaded in the
           color table at the proper index, but a 24-bit value is returned to the
           user in IDL 5.2 and higher.)

       If no positional parameter is present, then the return value is either a 16-by-3
       byte array containing the RGB values of all 16 colors or it is a 16-element
       long integer array containing color values that can be decomposed into colors.
       The 16-by-3 array is appropriate for loading color tables with the TVLCT command:

           Device, Decomposed=0
           colors = GetColor()
           TVLCT, colors, 100


 INPUT KEYWORD PARAMETERS:

       NAMES: If this keyword is set, the return value of the function is
              a 16-element string array containing the names of the colors.
              These names would be appropriate, for example, in building
              a list widget with the names of the colors. If the NAMES
              keyword is set, the COLOR and INDEX parameters are ignored.

                 listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16)

       LOAD:  If this keyword is set, all 16 colors are automatically loaded
              starting at the color index specified by the START keyword.
              Note that setting this keyword means that the return value of the
              function will be a structure, with each field of the structure
              corresponding to a color name. The value of each field will be
              an index number (set by the START keyword) corresponding to the
              associated color, or a 24-bit long integer value that creates the
              color on a true-color device. What you have as the field values is
              determined by the TRUE keyword or whether color decomposition is on
              or off in the absense of the TRUE keyword. It will either be a 1-by-3
              byte array or a long integer value.

       START: The starting color index number if the LOAD keyword is set. This keyword
              value is ignored unless the LOAD keyword is also set. The keyword is also
              ignored if the TRUE keyword is set or if color decomposition in on in
              IDL 5.2 and higher. The default value for the START keyword is
              !D.TABLE_SIZE - 17.

       TRUE:  If this keyword is set, the specified color triple is returned
              as a 24-bit integer equivalent. The lowest 8 bits correspond to
              the red value; the middle 8 bits to the green value; and the
              highest 8 bits correspond to the blue value. In IDL 5.2 and higher,
              if color decomposition is turned on, it is as though this keyword
              were set.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       The TRUE keyword causes the START keyword to be ignored.
       The NAMES keyword causes the COLOR, INDEX, START, and TRUE parameters to be ignored.
       The COLOR parameter is ignored if the LOAD keyword is used.
       On systems where it is possible to tell the state of color decomposition
       (i.e., IDL 5.2 and higher), a 24-bit value (or values) is automatically
       returned if color decomposition is ON.

 EXAMPLE:
       To load a yellow color in color index 100 and plot in yellow, type:

          yellow = GETCOLOR('yellow', 100)
          PLOT, data, COLOR=yellow

       or,

          PLOT, data, COLOR=GETCOLOR('yellow', 100)

       To do the same thing on a 24-bit color system with decomposed color on, type:

          PLOT, data, COLOR=GETCOLOR('yellow', /TRUE)

       or in IDL 5.2 and higher,

          DEVICE, Decomposed=1
          PLOT, data, COLOR=GETCOLOR('yellow')

       To load all 16 colors into the current color table, starting at
       color index 200, type:

          TVLCT, GETCOLOR(), 200

       To add the color names to a list widget:

           listID = Widget_List(baseID, Value=GetColor(/Names), YSize=16)

       To load all 16 colors and have the color indices returned in a structure:

           DEVICE, Decomposed=0
           colors = GetColor(/Load, Start=1)
           HELP, colors, /Structure
           PLOT, data, COLOR=colors.yellow

       To get the direct color values as 24-bit integers in color structure fields:

           DEVICE, Decomposed=1
           colors = GetColor(/Load)
           PLOT, data, COLOR=colors.yellow

       Note that the START keyword value is ignored if on a 24-bit device,
       so it is possible to write completely device-independent code by
       writing code like this:

           colors = GetColor(/Load)
           PLOT, data, Color=colors.yellow

 MODIFICATION HISTORY:
       Written by: David Fanning, 10 February 96.
       Fixed a bug in which N_ELEMENTS was spelled wrong. 7 Dec 96. DWF
       Added the McIDAS colors to the program. 24 Feb 99. DWF
       Added the INDEX parameter to the program 8 Mar 99. DWF
       Added the NAMES keyword at insistence of Martin Schultz. 10 Mar 99. DWF
       Reorderd the colors so black is first and white is last. 7 June 99. DWF
       Added automatic recognition of DECOMPOSED=1 state. 7 June 99. DWF
       Added LOAD AND START keywords. 7 June 99. DWF.

(See /nstxusr1/util/idl_cvs/coyote/getcolor.pro)


GETIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GETIMAGE

 PURPOSE:
       The purpose of this function is to allow the user to open either
       regular or XDR binary image files of two or three dimensions.

 CATEGORY:
       Widgets, File I/O.

 CALLING SEQUENCE:
       image = GETIMAGE(filename)

 OPTIONAL INPUTS:
       filename: The name of the file to open for reading.

 OPTIONAL KEYWORD PARAMETERS:

       CANCEL: An output variable that can be set to a named variable.
       The value of the return variable will be 1 if the user clicked
       the "Cancel" button or if there was a problem reading the file.

       DIRECTORY: The name of the directory the file is located in. By
       default the program looks in the "coyote" directory under the
       main IDL directory, if one exists. Otherwise, it defaults to the
       current directory.

       FRAMES: The 3rd dimension of a 3D data set. Defaults to 0.

       HEADER: The size of any header information in the file in BYTES.
       Default is 0.

       PARENT: The group leader for this widget program. The PARENT is
       required if GETIMAGE is called from another widget program in order
       to make this program a MODAL widget program.

       XDR: Set this keyword if the binary file is of XDR type.

       XOFFSET: This is the X offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       XSIZE: The size of the 1st dimension of the data.

       YOFFSET: This is the Y offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       YSIZE: The size of the 2nd dimension of the data.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       A "CANCEL" operation is indicated by a 0 return value.
       Any error in reading the file results in a 0 return value.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To load the image "galaxy.dat" in the $IDL/examples/data
       directory, type:

       image = GETIMAGE('galaxy.dat', DIRECTORY=!DIR + '/examples/data', $
          XSIZE=256, YSIZE=256, Cancel=cancelled, Parent=event.top)
       IF NOT cancelled THEN TV, image

 MODIFICATION HISTORY:
       Written by: David Fanning, 3 February 96.
       Fixed bug that prevented reading INTEGER data. 19 Dec 96.
       Modifed program for IDL 5 MODAL operation. 19 Oct 97.
       Added CANCEL keyword. 27 Oct 97. DWF.
       Fixed CANCLE keyword spelling. Sigh... 29 JUN 98. DWF.

(See /nstxusr1/util/idl_cvs/coyote/getimage.pro)


HCOLORBAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       HCOLORBAR

 FILENAME:
       hcolorbar__define.pro
;
 PURPOSE:
       The purpose of this program is to create a horizontal
       colorbar object to be used in conjunction with other
       IDL 5 graphics objects.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com/

 CATEGORY:
       IDL 5 Object Graphics.

 CALLING SEQUENCE:
       thisColorBar = Obj_New('HColorBar')

 REQUIRED INPUTS:
       None.

 INIT METHOD KEYWORD PARAMETERS:

       COLOR: A three-element array representing the RGB values of a color
          for the colorbar axes and annotation. The default value is
          white: [255,255,255].

       NAME: The name associated with this object.

       NCOLORS: The number of colors associated with the colorbar. The
          default is 256.

       MAJOR: The number of major tick divisions on the colorbar axes.
          The default is 5.

       MINOR: The number of minor tick marks on the colorbar axes.
          The default is 4.

       PALETTE: A palette object for the colorbar. The default palette
           is a gray-scale palette object.

       POSITION: A four-element array specifying the position of the
           colorbar in normalized coordinate space. The default position
           is [0.10, 0.90, 0.90, 0.95].

       RANGE: The range associated with the colorbar axis. The default
           is [0, NCOLORS].

       TEXT: A text object. Colorbar axis annotation will use this text
           object to set its properties. The default is a text object
           using a 8 point Helvetica font in the axis color.

       TITLE: A string containing a title for the colorbar axis
           annotation. The default is a null string.

 OTHER METHODS:

       GetProperty (Procedure): Returns colorbar properties in keyword
          parameters as defined for the INIT method. Keywords allowed are:

               COLOR
               NAME
               MAJOR
               MINOR
               PALETTE
               POSITION
               RANGE
               TEXT
               TITLE

       SetProperty (Procedure): Sets colorbar properties in keyword
          parameters as defined for the INIT method. Keywords allowed are:

               COLOR
               NAME
               MAJOR
               MINOR
               PALETTE
               POSITION
               RANGE
               TEXT
               TITLE

 SIDE EFFECTS:
       A HColorBar structure is created. The colorbar INHERITS IDLgrMODEL.
       Thus, all IDLgrMODEL methods and keywords can also be used. It is
       the model that is selected in a selection event, since the SELECT_TARGET
       keyword is set for the model.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To create a colorbar object and add it to a plot view object, type:

       thisColorBarObject = Obj_New('HColorBar')
       plotView->Add, thisColorBarObject
       plotWindow->Draw, plotView

 MODIFICATION HISTORY:
       Written by David Fanning, from VColorBar code, 20 Sept 98. DWF.
       Changed a reference to _Ref_Extra to _Extra. 27 Sept 98. DWF.
       Fixed bug when adding a text object via the TEXT keyword. 9 May 99. DWF.

(See /nstxusr1/util/idl_cvs/coyote/hcolorbar__define.pro)


ICON_EX

[Previous Routine] [Next Routine] [List of Routines]
 FUNCTION NAME:

   ICON_BUTTON

 PURPOSE:

   This is a compound widget to put up a small button with an image on it.
   It is implemented as a draw widget, but acts like a button. The event
   structure that is returned is a WIDGET_BUTTON event structure for a
   SELECT event.

 MAJOR TOPICS:

   Widget Programming

 FUNCTION:

   Used almost identically to WIDGET_BUTTON.

 CALLING SEQUENCE:

    buttonID = ICON_BUTTON(parent, Value='icon_button', Image=image)

 POSITIONAL PARAMETERS:

    parent -- The identifier of the parent widget.

 KEYWORD PARAMETERS:

    BOTTOM -- The starting color index of the image colors.

    COLORINDEX -- A four-element array that gives the color indicies for the button
       colors. COLORINDEX(0) is the button outline color. COLORINDEX(1) is the dark
       edge color. COLORINDEX(2) is the light edge color.
       COLORINDEX(3) is the button highlight color.

    EVENT_FUNC -- The name of an event handler function for this button.

    EVENT_PRO -- The name of an event handler procedure for this button.

    IMAGE -- The 2D array to use as the icon display.

    NCOLORS -- The number of colors to use for the image display.

    VALUE -- The value of the icon. (Used to make it look like a button.)

    UVALUE -- A user value. Used in the normal way.

    XOFFSET -- The X offset of the icon on the display.

    YOFFSET -- The Y offset of the icon on the display.

    XSIZE -- This is the XSIZE of the icon.

    YSIZE -- This is the YSIZE of the icon.

 EXAMPLE:

  To make an icon button out of the CTSCAN.DAT image, do this:

    Load colors for the icon button's boundaries.

       TVLCT, [255, 70, 150, 255], [255, 70, 150, 255], $
          [255, 70, 150, 255], 200

    Read image data.

       ctscan = GetImage()

    Build widgets.

       base = Widget_Base()
       icon = Icon_Button(base, ColorIndex=Indgen(4)+200, $
           Value='icon_button', Image=ctscan, NColors=200, Bottom=0)
       Widget_Control, base, /Realize

 MAJOR FUNCTIONS and PROCEDURES:

   None.

 EVENT STRUCTURE:

   event = {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:1}

 MODIFICATION HISTORY:

   Written by: David Fanning, August 1996.
   Given to attendees of IDL training courses.

(See /nstxusr1/util/idl_cvs/coyote/icon_ex.pro)


IMAGE_BLEND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       IMAGE_BLEND

 PURPOSE:
       The purpose of this program is to demonstrate how to
       use the alpha channel to blend one image into another.
       The specific purpose is to see a color image on top of
       a gray-scale image, with the gray-scale image showing
       through behind the color image.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets, Object Graphics.

 CALLING SEQUENCE:
       Image_Blend

 REQUIRED INPUTS:
       None. The images "worldelv.dat" and "ctscan.dat" from the
       examples/data directory are used.

 OPTIONAL INPUTS:

       backgroundImage::  A 2D image variable that will be used for the background image.
       foregroundImage: A 2D image variable that will be used for the foreground image.

 OPTIONAL KEYWORD PARAMETERS:

       COLORTABLE: The number of a color table to use for the foreground image.
       Color table 3 (red temperature) is used as a default.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       None. The program XCOLORS is required from the Coyote library.

 EXAMPLE:
       Image_Blend, Colortable=5

 MODIFICATION HISTORY:
       Written by David Fanning, 30 March 99.
       Fixed bug where I redefined the image parameter. Duh... 1 April 99. DWF.

(See /nstxusr1/util/idl_cvs/coyote/image_blend.pro)


LINKEDLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   LINKEDLIST

 FILENAME:
   linkedlist__define.pro

 PURPOSE:
   The purpose of this program is to implement a list that
   is linked in both the forward and backward directions. There
   is no restriction as to what can be stored in a linked list
   node. The linked list is implemented as an object.

 AUTHOR:
   FANNING SOFTWARE CONSULTING
   David Fanning, Ph.D.
   2642 Bradbury Court
   Fort Collins, CO 80521 USA
   Phone: 970-221-0438
   E-mail: davidf@dfanning.com
   Coyote's Guide to IDL Programming: http://www.dfanning.com/

 CATEGORY:
   General programming.

 CALLING SEQUENCE:
   mylist = Obj_New('LINKEDLIST', item)

 OPTIONAL INPUTS:
   item: The first item added to the list. Items can be any
     valid IDL variable type.

 COMMON BLOCKS:
   Are you kidding?!

 RESTRICTIONS:
   Be sure to destroy the LINKEDLIST object when you are finished
   with it: Obj_Destroy, mylist

   Node index numbers start at 0 and go to n-1, where n is the
   number of items in the list.

 PUBLIC METHODS:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 PRO LINKEDLIST::ADD, item, index, AFTER=after, BEFORE=before

   The ADD method adds a data item to the list.

   Parameters:

   item: The data item to be added to the list. Required.

   index: The location in the list where the data item is
     to be added. If neither the AFTER or BEFORE keyword is
     set, the item is added AFTER the item at the index location.
     If index is missing, the index points to the last item in
     the list. Optional.

   Keywords:

   AFTER: If this keyword is set, the item is added after the
     item at the current index.

   BEFORE: If this keyword is set, the item is added before the
     item at the current index.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 PRO LINKEDLIST::DELETE, index, ALL=all

   The DELETE method deletes an item from the list.

   Parameters:

   index: The location in the list where the data item is
     to be delete. If index is missing, the index points to
     the last item in the list. Optional.

   Keywords:

   ALL: If this keyword is set, all items in the list are deleted.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 FUNCTION LINKEDLIST::GET_COUNT

   The GET_COUNT method returns the number of items in the list.

   Return Value: The number of items stored in the linked list.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 FUNCTION LINKEDLIST::GET_ITEM, index

   The GET_ITEM method returns a pointer to the specified data
   item from the list.

   Parameters:

   index: The location in the list from which the data item is
     to be retrieved. If not present, the last item in the list
     is retrieved. Optional.

   Return Value: A pointer to the specified data item stored
     in the list.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 FUNCTION LINKEDLIST::GET_NODE, index

   The GET_NODE method returns a pointer to the specified node
   from the list.

   Parameters:

   index: The location in the list from which the data node is
     to be retrieved. If not present, the last node in the list
     is retrieved. The node is a structure with three fields:
     Previous is a pointer to the previous node in the list.
     Next is a pointer to the next node in the list. A null pointer
     in the previous field indicates the first node on the list. A
     null pointer in the next field indicates the last node on the
     list. The item field is a pointer to the item stored in the
     node. Optional.

   Return Value: A pointer to the specified node structure in
     the linked list.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 PRO LINKEDLIST::HELP, PRINT=print

 The HELP method performs a HELP command on each item
 in the linked list.

   Keywords:

    PRINT: If this keyword is set, the PRINT command is used
      instead of the HELP command on the items in the list.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 PRO LINKEDLIST::MOVE_NODE, nodeIndex, location, BEFORE=before

   The MOVE_NODE method moves a list node from one location to another.

   Parameters:

   nodeIndex: The location in the list of the node you are moving.
     Required.

   location: The location (index) you are moving the node to. If
     location is missing, the location points to the node at the
     end of the list.

   Keywords:

    BEFORE: If this keyword is set, the node is added to the
      list before the location node. Otherwise, it is added after
      the location node.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 EXAMPLE:

   mylist = Obj_New("LINKEDLIST", 5)
   mylist->Add, 10
   mylist->Add, 7.5, 1, /Before
   mylist->Add, 12.5
   mylist->Help
   mylist->Delete
   mylist->Help, /Print

 MODIFICATION HISTORY:
   Written by: David Fanning, 25 August 98.
   25 August 99. Fixed several errors in various methods dealing with
       moving nodes from one place to another. DWF.

(See /nstxusr1/util/idl_cvs/coyote/linkedlist__define.pro)


LOADDATA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       LOADDATA

 PURPOSE:
       The purpose of this function is to read a selection of standard
       data sets that are found in the normal IDL distribution in the
       subdirectory $IDL_DIR/examples/data. At least 17 data sets are
       available in all categories of data. The user selects one of the
       possible data sets with the mouse.

 CATEGORY:
       File I/O.

 CALLING SEQUENCE:

       If calling from the IDL command line:

          data = LoadData()

       If calling from within a widget program:

          data = LoadData(Cancel=cancelled, Group_Leader=event.top)

       If you know which data set you want, you can load it directly:

          data = LoadData(7)

 OPTIONAL INPUTS:
       selection : The number of the data selection. Values start at 1,
           and go up to the number of data sets available (currently 17).

 KEYWORD PARAMETERS:
       CANCEL : An output keyword that is 1 of the use clicked the CANCEL
           button and 0 otherwise.

              data = Loaddata(Cancel=cancelled)
              IF cancelled THEN RETURN

        GROUP_LEADER: The group leader of the widget. This keyword
           is required if you wish LOADDATA to be a modal widget program.
           (Which you *always* do when calling it from a widget program.)

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To load the world elevation data set:

       image = LoadData(7)

 MODIFICATION HISTORY:
       Written by:  David Fanning, 5 March 1999.
       Added some additonal random data capability. 29 April 99. DWF

(See /nstxusr1/util/idl_cvs/coyote/loaddata.pro)


NORMALIZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NORMALIZE

 PURPOSE:

       This is a utility routine to calculate the scaling vector
       required to position a graphics primitive of specified range
       at a specific position in an arbitray coordinate system. The
       scaling vector is given as a two-element array like this:

          scalingVector = [translationFactor, scalingFactor]

       The scaling vector should be used with the [XYZ]COORD_CONV
       keywords of a graphics object or model. For example, if you
       wanted to scale an X axis into the coordinate range of -0.5 to 0.5,
       you might type something like this:

          xAxis->GetProperty, Range=xRange
          xScale = Normalize(xRange, Position=[-0.5, 0.5])
          xAxis, XCoord_Conv=xScale

 AUTHOR:

       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:

       Object Graphics

 CALLING SEQUENCE:
       xscaling = NORMALIZE(xrange, POSITION=position)

 INPUTS:
       XRANGE: A two-element vector specifying the data range.

 KEYWORD PARAMETERS:
       POSITION: A two-element vector specifying the location
       in the coordinate system you are scaling into. The vector [0,1]
       is used by default if POSITION is not specified.

 COMMON BLOCKS:
       None.

 EXAMPLE:
       See above.

 MODIFICATION HISTORY:
       Written by:  David Fanning, OCT 1997.

(See /nstxusr1/util/idl_cvs/coyote/normalize.pro)


OBJECT_SHADE_SURF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       OBJECT_SHADE_SURF

 PURPOSE:

       This program shows you the correct way to write an
       elevation-shaded surface in object graphics. This would
       be the equivalent of these direct graphics commands:

           Surface, data, Shades=BytScl(data)
           Shade_Surf, data, Shades=BytScl(data)

 AUTHOR:

       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:

       Object Graphics

 CALLING SEQUENCE:
       OBJECT_SHADE_SURF, data, x, y

 INPUTS:
       data: The 2D surface data.
       x:    A vector of X values, corresponding to the X values of data.
       y:    A vector of Y values, corresponding to the Y values of data.

 KEYWORD PARAMETERS:
       STYLE: Set equal to 1 for a wire-frame surface. Set equal to 2 for
       a solid surface (the default).

 COMMON BLOCKS:
       None.

 EXAMPLE:
       OBJECT_SHADE_SURF

 MODIFICATION HISTORY:
       Written by:  David Fanning, November 1998.

(See /nstxusr1/util/idl_cvs/coyote/object_shade_surf.pro)


OWINDOW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       OWINDOW

 PURPOSE:
       The purpose of this program is to create an object window.
       I use it mostly when I am creating and testing object graphics
       programs, but it is also a nice template for larger object
       graphics programs. The window is resizeable and it destroys
       its objects when it is destroyed.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets, IDL 5 Object Graphics.

 CALLING SEQUENCE:
       thisWindow = OWindow(thisView)

 REQUIRED INPUTS:
       None. A default view object is created with a gray background and
          a viewplane rectangle defined as [0,0,1,1].

 OPTIONAL INPUTS:

       thisView: A view or scene object that you wish to be displayed
          in the window.

 RETURN VALUE:
       thisWindow: The window graphics object associated with this window.

 OPTIONAL KEYWORD PARAMETERS:

       GROUP_LEADER: The group leader for this program. When the group leader
          is destroyed, this program will be destroyed.

       TITLE: A string used as the title of the graphics window.

       XSIZE: The X Size of the graphics window in device coordinates. The
          default value is 300.

       YSIZE: The Y Size of the graphics window in device coordinates. The
          default value is 300.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To display a view object in this window, type:

          IDL> thisWindow = OWindow(thisView)

       Later, after you have modified the view object, you can type:

          IDL> thisWindow->Draw, modifiedView

 MODIFICATION HISTORY:
       Written by David Fanning, 19 June 97.
       Set RETAIN=1 on draw widget. 6 Oct 97. DWF.
       Changed discredited IDLgrContainer to IDL_Container. 29 JUN 98. DWF.

(See /nstxusr1/util/idl_cvs/coyote/owindow.pro)


PARSELINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   PARSELINE

 PURPOSE:
   This function accepts a string as an argument and returns an
   array which contains the numerical values in that string.  It can
   handle space or comma delimited numerical values.  It returns
   a value of -1 if non-numerical stuff is found in the line.

 CALLING SEQUENCE:
   array_out = PARSELINE(string_in, desired_data)

 OPTIONAL INPUTS:

   DESIRED_DATA -- An array which specifies the desired columns of data
   from the string.  It is zero based.  Column numbers can be repeated in
   the array.  If this is not specified the default is to return an array
   containing each value in the string once in the order they appear in
   the string.

 KEYWORD PARAMETERS:

   DOUBLE -- The default behavior.  The returned array will be a double
   precision floating point array.

   FLOAT -- The returned array will be a single precision floating point
   array.

   INTEGER -- The returned array will be an array of short integers.

 RETURN VALUE:

   array_out = dblarr(n_data)  N_DATA is either the number of columns in
   the string or the number of elements in the DESIRED_DATA array.

 USAGE:

 The calling procedure will look something like:

    IDL> text=''
    IDL> openr,1,'input.dat'
    IDL> readf,1,text
    IDL> data=parseline(text,[0,1,5,4,6,7])
    IDL> print,data
    0.10000000  3.4000000  2.4000000e-06  5.0000000  2.0080000  0.0000000

 MAJOR FUNCTIONS and PROCEDURES:

   None.

 MODIFICATION HISTORY:

   Written by: Alan Munter, munter@uiuc.edu, May 1997.

(See /nstxusr1/util/idl_cvs/coyote/parseline.pro)


PROCESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       PROCESS

 PURPOSE:
       The purpose of this routine is to demonstrate a simple
       image processing program that runs as a "color aware"
       application. The program works on 8-bit, 16-bit, and
       24-bit displays. The image is displayed in a resizeable
       graphics window and the window contents can be saved as
       GIF or JPEG images. The application can "protect" its
       colors from other applications that change colors. The
       color protection is implemented via draw widget EXPOSE
       events or the Refresh Colors button in the menubar.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets.

 CALLING SEQUENCE:
       PROCESS

 INPUTS:
       image: An optional 2D image. The image is always scaled.

 KEYWORD PARAMETERS:
       BOTTOM: The lowest color index of the colors to be changed.

       GROUP: The group leader for this program. When the group leader
       is destroyed, this program will be destroyed.

       NCOLORS: This is the number of colors to load when a color table
       is selected.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       This is a non-blocking widget.

 RESTRICTIONS:
       The GETIMAGE and XCOLORS programs from the Fanning Consulting
       web page are required: http://www.dfanning.com/.

 EXAMPLE:
       To run the program, type:

       PROCESS

 MODIFICATION HISTORY:
       Written by:     David Fanning, 13 April 97.
       Fixed a bug in the TVImage call. 25 June 97. DWF.
       Extensively modified to incorporate changing ideas
         about color protection and operation on 8-bit and
         24-bit displays. 19 Oct 97. DWF.
       Whoops. Forgot to make *this* draw widget the current
         graphics window. 15 Nov 97. DWF.
       IDL 5.1 changed the way color decomposition works. Had
         to find a fix for this. 25 May 98. DWF.

(See /nstxusr1/util/idl_cvs/coyote/process.pro)


PSWINDOW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  PSWINDOW

 PURPOSE:
  This function is used to calculate the size of a PostScript
  window that has the same aspect ratio (ratio of height to
  width) as the current display graphics window. It creates
  the largest possible PostScript output window with the
  desired aspect ratio. This assures that graphics output
  looks similar, if not identical, to PostScript output.

 CATEGORY:
  Graphics.

 CALLING SEQUENCE:

  pageInfo = PSWINDOW()

 INPUTS:
  None.

 KEYWORD PARAMETERS:
  CM: Normally the structure value that is returned from this
  function reports its values in inches. Setting this keyword
  causes the return values to be in units of centimeters.

  LANDSCAPE: Normally this function assumes a PostScript window
  in Portrait mode. Setting this keyword assumes you want
  the graphic in Landscape mode.

  MARGIN: Normally this function creates the largest possible
  PostScript window of the specified aspect ratio that can fit
  on an 8.5 x 11 inch PostScript page. The margin is an amount
  subtracted from the page size before the output window is sized.
  A default margin of 0.5 is used to assure that the page can be
  printed on most PostScript printers. The value should be
  specified in the same units the function returns.

 OUTPUTS:
  pageInfo: The output value is a named structure defined like
  this:

     pageInfo = {PSWINDOW_STRUCT, XSIZE:0.0, YSIZE:0.0, $
        XOFSET:0.0, YOFFSET:0.0, INCHES:0, PORTRAIT:0, LANDSCAPE:0}

  The units of the four size fields are inches unless the CM
  keyword is set.

 RESTRICTIONS:
  The aspect ratio of the current graphics window is calculated
  like this:

     aspectRatio = FLOAT(!D.Y_VSIZE) / !D.X_VSIZE

  A PostScript page of 8.5 x 11.0 inches is assumed.

 EXAMPLE:
  To create a PostScript output window with the same aspect
  ratio as the curently active display window, type:

     sizes = PSWINDOW()
     SET_PLOT, 'PS'
     DEVICE, XSIZE=sizes.xsize, YSIZE=sizes.ysize, $
         XOFFSET=sizes.xoffset, YOFFSET=sizes.yoffset, INCHES=sizes.inches

 MODIFICATION HISTORY:
  Written by: David Fanning, November 1996.
       Fixed a bug in which the YOFFSET was calculated incorrectly
          in Landscape mode. 12 Feb 97.
       Took out a line of code that wasn't being used. 14 Mar 97.
       Added correct units keyword to return structure. 29 JUN 98. DWF
       Fixed a bug in how landscape offsets were calculated. 19 JUL 99. DWF.
       Fixed a bug in the way margins were used to conform to my
          original conception of the program. 19 JUL 99. DWF.
       Added Landscape and Portrait fields to the return structure. 19 JUL 99. DWF.

(See /nstxusr1/util/idl_cvs/coyote/pswindow.pro)


PS_FORM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   PS_FORM

 PURPOSE:

   This function displays a form the user can interactively manipulate
   to configure the PostScript device driver (PS) setup. The function returns
   a structure of keywords that can be sent directly to the DEVICE command
   via its _EXTRA keyword

 AUTHOR:

   FANNING SOFTWARE CONSULTING
   David Fanning, Ph.D.
   2642 Bradbury Court
   Fort Collins, CO 80521 USA
   Phone: 970-221-0438
   E-mail: davidf@dfanning.com
   Coyote's Guide to IDL Programming: http://www.dfanning.com

 MAJOR TOPICS:

   Device Drivers, Hardcopy Output, PostScript Output

 PROCEDURE:

   This is a pop-up form widget. It is a modal or blocking widget.
   Keywords appropriate for the PostScript (PS) DEVICE command are returned.
   The yellow box in the upper right hand corner of the form represents the
   PostScript page. The green box represents the "window" on the PostScript
   page where the graphics will be drawn.

   Use your LEFT mouse button to move the plot "window" around the page.
   Use your RIGHT mouse button to draw your own plot window on the page.

   The CREATE FILE and ACCEPT buttons are meant to indicate slightly
   different operations, although this is sometimes confusing. My idea
   is that PS_FORM is a *configuration* dialog, something the user displays
   if he or she wants to change the way the PostScript device is configured.
   Thus, in many of my widget programs if the user clicks a "Write PostScript File"
   button, I just go ahead and write a PostScript file without displaying the
   form. (I can do this because I always keep a copy of the current device
   configuration in my info structure.) To get to the form, the user must
   select a "Configure PostScript Device" button.

   At that time, the user might select the ACCEPT button to just change
   the PostScript device configurations. Or the user can select the
   CREATE FILE button, which both accepts the configuration *and* creates
   a PostScript file. If you find the CREATE FILE button confusing, you
   can just edit it out of the form and use the ACCEPT button for the
   same purpose.

 HELP:

   formInfo = PS_FORM(/Help)

 USAGE:

  The calling procedure for this function in a widget program will look something
  like this:

     info.ps_config = PS_FORM(/Initialize)
     ...
     formInfo = PS_FORM(Cancel=canceled, Create=create, $
                        Defaults=info.ps_config, Parent=event.top)

     IF NOT canceled THEN BEGIN
        IF create THEN BEGIN
           thisDevice = !D.Name
           Set_Plot, "PS"
           Device, _Extra=formInfo

           Enter Your Graphics Commands Here!

           Device, /Close
           Set_Plot, thisDevice
        ENDIF
        info.ps_config = formInfo
     ENDIF

 OPTIONAL INPUT PARAMETERS:

    XOFFSET -- Optional xoffset of the top-level base of PS_Form. Default is
    to try to center the form on the display.

    YOFFSET -- Optional yoffset of the top-level base of PS_Form. Default is
    to try to center the form on the display.

 INPUT KEYWORD PARAMETERS:

    BITS_PER_PIXEL -- The initial configuration of the bits per pixel button.

    BLOCKING -- Set this keyword to make this a blocking widget under IDL 5.0.
    (All widget programs block under IDL 4.0.)

    COLOR -- The initial configuration of the color switch.

    DEFAULTS -- A stucture variable of the same type and structure as the
    RETURN VALUE of PS_FORM. It will set initial conditions. This makes
    it possible to start PS_FORM up again with the same values it had the
    last time it was called. For example:

       mysetup = PS_FORM()
       newsetup = PS_FORM(Defaults=mysetup)

    NOTE: Using the DEFAULTS keyword will nullify any of the other
    DEVICE-type keywords listed above (e.g., XSIZE, ENCAPSULATED, etc.)

    ENCAPSULATED -- The initial configuration of the encapsulated switch.

    FILENAME -- The initial filename to be used on the form.

    HELP -- Prints a helpful message in the output log.

    INCHES -- The initial configuration of the inches/cm switch.

    INITIALIZE -- If this keyword is set, the program immediately returns the
    "localdefaults" structure. This gives you the means to configue the
    PostScript device without displaying the form to the user. I use this
    to write a PostScript file directly and also to initialize my info
    structure field that contains the current PostScript form setup. Passing
    the setup structure into PS_FORM via the DEFAULTS keyword gives my PS_FORM
    a program "memory".

        info.ps_setup = PS_FORM(/Initialize)

    LANDSCAPE -- The initial configuration of the landscape/portrait switch.

    LOCALDEFAULTS -- A structure like the DEFAULTS structure. Used if the
    "Local Defaults" button is pressed in the form. This gives you the
    opportunity to have a "local" as well as "system" default setup.
    If this keyword is not used, the procedure PS_Form_Set_Personal_Local_Defaults
    is called. Use this procedure (see below) to define your own local
    defaults.

    XOFFSET -- The initial XOffSet of the PostScript window.

    YOFFSET -- The initial YOffSet of the PostScript window.

    XSIZE -- The initial XSize of the PostScript window.

    YSIZE -- The initial YSize of the PostScript window.

 OUTPUT KEYWORD PARAMETERS

    CANCEL -- This is an OUTPUT keyword. It is used to check if the user
    selected the "Cancel" button on the form. Check this variable rather
    than the return value of the function, since the return value is designed
    to be sent directly to the DEVICE procedure. The varible is set to 1 if
    the user selected the "Cancel" button. Otherwise, it is set to 0.

    CREATE -- This output keyword can be used to determine if the user
    selected the 'Create File' button rather than the 'Accept' button.
    The value is 1 if selected, and 0 otherwise.

 RETURN VALUE:

     formInfo = { PS_FORM_INFO, $
                  xsize:0.0, $        ; The x size of the plot
                  xoff:0.0, $         ; The x offset of the plot
                  ysize:0.0, $        ; The y size of the plot
                  yoff:0.0 $          ; The y offset of the plot
                  filename:'', $      ; The name of the output file
                  inches:0 $          ; Inches or centimeters?
                  color:0, $          ; Color on or off?
                  bits_per_pixel:0, $ ; How many bits per image pixel?
                  encapsulated:0,$    ; Encapsulated or regular PostScript?
                  landscape:0 }       ; Landscape or portrait mode?

 MAJOR FUNCTIONS and PROCEDURES:

   None. Designed to work originally in conjunction with XWindow,
   a resizable graphics window.

 MODIFICATION HISTORY:

   Written by: David Fanning, RSI, March 1995.
   Given to attendees of IDL training courses.

   Modified to work when grapics device set to PostScript: 6 May 95.
   Modified to configure initial conditions via keywords: 13 October 95.
   Modified to load personal local defaults if LocalDefaults keyword not
      used: 3 Nov 95.
   Found and fixed bits_per_pixel error in Local Defaults setting
     procedure: 3 Nov 95.
   Modified to produce initial plot box with the same aspect ratio as
      the current graphics window. (XSIZE or YSIZE keywords overrule this
      behavior.) 22 Apr 96.
   Fixed annoying behavior of going to default-sized plot box when selecting
      the Landscape or Portrait option. Now keeps current plot box size.
      22 Apr 96.
   Made the size and offset text widgets a little bigger and changed the
      size and offset formatting from F4.2 to F5.2 to accomodate larger plot
      box sizes. 29 Apr 96.
   Fixed a bug in the filename text widget that caused a crash when a CR
      was hit. 3 Sept 96.
   Added the Initialize keyword to immediately return the "localdefaults"
      structure. 27 Oct 96.
   Fixed another problem with the BITS_PER_PIXEL keyword. 27 Oct 96.
   Made the return value a named structure of the name PS_FORM_INFO.
      3 Nov 96.
   Discovered and fixed a problem whereby YOFFSET was set incorrectly if
      LOCALDEFAULTS was used instead of DEFAULTS keyword. 3 Nov 96.
   Fixed bug in how Portrait mode was set using YSIZE and XSIZE keywords.
      25 Nov 96.
   Fixed a bug in how YOFFSET was calculated when in Landscape mode. 27 Nov 96.
   Fixed a memory leak with the local defaults pointer. 25 Jan 97.
   Added the CREATE keyword and modified the appearance of the form. 22 Apr 97.
   Modifed subroutine names to avoid confusion. 22 Apr 97.
   Fixed a bug I introduced when I added the CREATE keyword. 23 Apr 97.
   Modified the program for IDL 5. 30 May 97, DWF.
   Fixed Inches to CM exclusive button problem. 30 May 97, DWF.
   Fixed a problem when the widget is killed with the mouse. 30 May 97. DWF
   Added a Select Filename button. 12 Oct 97.
   Modified program layout slightly. 12 Oct 97.
   Added valid directory/file error checking for the filename. 12 Oct 97. DWF
   Added further support for IDL 5 modal functionality. 20 Oct 97. DWF

(See /nstxusr1/util/idl_cvs/coyote/ps_form.pro)


SCALE_VECTOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SCALE_VECTOR

 PURPOSE:

       This is a utility routine to scale the points of a vector
       (or an array) into a given data range. The minimum value of
       the vector (or array) is set equal to the minimun data range. And
       the maximun value of the vector (or array) is set equal to the
       maximun data range.

 AUTHOR:

       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:

       Utilities

 CALLING SEQUENCE:
       scaledVector = SCALE_VECTOR(vector, minRange, maxRange)

 INPUTS:
       vector:   The vector (or array) to be scaled.
       minRange: The minimun value of the scaled vector. Set to 0 by default.
       maxRange: The maximun value of the scaled vector. Set to 1 by default.

 RETURN VALUE:
       scaledVector: The vector (or array) values scaled into the data range.
           This is always at least a FLOAT value.

 COMMON BLOCKS:
       None.

 EXAMPLE:
       x = [3, 5, 0, 10]
       xscaled = SCALE_VECTOR(x, -50, 50)
       Print, xscaled
          -20.0000     0.000000     -50.0000      50.0000


 MODIFICATION HISTORY:
       Written by:  David Fanning, 12 Dec 98.

(See /nstxusr1/util/idl_cvs/coyote/scale_vector.pro)


SELECT_OBJECTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SELECT_OBJECTS

 PURPOSE:
       The purpose of this program is to demonstrate how to select
       and move objects in an object graphics window. Once the objects
       appear in the window, use your mouse to select the objects and
       move them in the window. The window is resizeable.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Object Graphics.

 CALLING SEQUENCE:
       SELECT_OBJECTS

 REQUIRED INPUTS:
       None.

 KEYWORD PARAMETERS:
       None.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       Requires VCOLORBAR from the Coyote Library:
           http://www.dfanning.com/programs/vcolorbar__define.pro.

 EXAMPLE:
       Select_Objects

 MODIFICATION HISTORY:
       Written by David Fanning, 21 September 98.
       Added the ability to shrink and expand the objects. 27 Sept 98. DWF.

(See /nstxusr1/util/idl_cvs/coyote/select_objects.pro)


SHOWPROGRESS__DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       SHOWPROGRESS__DEFINE

 PURPOSE:

       An object for creating a progress bar.

 AUTHOR:

       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:

       Utilities

 CALLING SEQUENCE:

       progressBar = Obj_New("SHOWPROGRESS")

 INPUTS:

       parent: A widget identifier of the widget that will be the
           group leader for this program. It is *required* for modal
           operation. If missing, you are on your own. :-(

 KEYWORDS:

      DELAY: The total time the widget should be on the display in AutoUpDate
           mode. The keyword applies only to AutoUpDate mode. Default is 5 seconds.
      STEPS: The number of steps to take in AutoUpDate mode. The keyword applies only
           to AutoUpDate mode.
      MESSAGE: The text of the label above the progress bar. Default is "Operation
           in Progress...".
      TITLE: ; The text of the top-level base title bar. Default is ""
      COLOR: The color to draw the progress bar.
      XSIZE: The XSize of the progress bar in Device coordinates. Default is 150.
      YSIZE: The YSize of the progress bar in Device coordinates. Default is 10.
      AUTOUPDATE: Set this keyword to be in AutoUpDate mode.


 PROCEDURE:
       There are two modes. In AutoUpDate mode, a delay and number of steps is
       required. The modal widget stays on the display until the total time
       exceeds the DELAY or the requested number of steps is taken. A TIMER
       widget is used to generate update events. Nothing can be going on
       concurrently in AutoUpDate mode. To enter AutoUpDate mode, type this:

          progressBar = Obj_New("SHOWPROGRESS", /AutoUpDate, Delay=2, Steps=10)
          progressBar->Start
          Obj_Destroy, progressBar

       The program will update and destroy itself automatically. (The object
       itself is not destroyed. You must do this explicitly, as in the example
       above.)

       In normal mode, the user is responsible for starting, updating, and
       destroying the progress indicator. The sequence of commands might look
       like this:

          progressBar = Obj_New("SHOWPROGRESS")
          progressBar->Start
          FOR j=0,9 DO BEGIN
             Wait, 0.5  ; Would probably be doing something ELSE here!
             progressBar->Update, (j+1)*10
          ENDFOR
          progressBar->Destroy
          Obj_Destroy, progressBar

       Normal mode gives you the opportunity to update the Progress Bar
       in a loop while something else is going on. See the example program
       at the end of this file.

       Note that the object itself is not destroyed when calling the DESTROY
       method. You must explicitly destroy the object, as in the example above.

 METHODS:

       DESTROY: Destroys the ShowProgress widgets. It does NOT destroy the object.

          progressBar->Destroy

       UPDATE: Updates the progress bar. Requires on argument, a number between 0
          and 100 that indicates the percent of progress bar that should be filled
          with a color.

          progressBar->Update, 50

       START: Puts the ShowProgress bar on the display. In AutoUpDate mode, the
          widget starts to automatically update.

          progressBar->Start

       GETPROPERTY: Gets the properties that can be set in the INIT method, including
          the parent widget ID.

          progressBar->GetProperty, Steps=currentNSteps, Delay=currentDelay

       SETPROPERTY: Allows the user to set the INIT parameter via keywords.

          progressBar->SetProperty, Color=244, XSize=200, Message='Please Wait...'

 EXAMPLE:

       See the example program at the bottom of this file.

 RESTRICTIONS:

       In contradiction to the IDL documentation, making the parent widget
          insensitive in normal mode does NOT prevent the parent widgets from
          receiving events on my Windows NT 4.0, SP 4 system running IDL 5.2
          or IDL 5.2.1. RSI Technical Support claims this doesn't happen on
          their machines. We are still questioning each other's sanity. :-)

 MODIFICATION HISTORY:
       Written by:  David Fanning, 26 July 1999.
       Added code so that the current graphics window doesn't change. 1 September 1999. DWF.
       Added yet more code for the same purpose. 3 September 1999. DWF.

(See /nstxusr1/util/idl_cvs/coyote/showprogress__define.pro)


STR_SIZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  STR_SIZE

 PURPOSE:

  The purpose of this function is to return the proper
  character size to make a specified string a specifed
  width in a window. The width is specified in normalized
  coordinates. The function is extremely useful for sizing
  strings and labels in resizeable graphics windows.

 CATEGORY:

  Graphics Programs, Widgets.

 CALLING SEQUENCE:

  thisCharSize = STR_SIZE(thisSting, targetWidth)

 INPUTS:

  thisString:  This is the string that you want to make a specifed
     target size or width.

 OPTIONAL INPUTS:

  targetWidth:  This is the target width of the string in normalized
     coordinates in the current graphics window. The character
     size of the string (returned as thisCharSize) will be
     calculated to get the string width as close as possible to
     the target width. The default is 0.25.

 KEYWORD PARAMETERS:

  INITSIZE:  This is the initial size of the string. Default is 1.0.

  STEP:   This is the amount the string size will change in each step
     of the interative process of calculating the string size.
     The default value is 0.05.

 OUTPUTS:

  thisCharSize:  This is the size the specified string should be set
     to if you want to produce output of the specified target
     width. The value is in standard character size units where
     1.0 is the standard character size.

 EXAMPLE:

  To make the string "Happy Holidays" take up 30% of the width of
  the current graphics window, type this:

               XYOUTS, 0.5, 0.5, ALIGN=0.5, "Happy Holidays", $
        CHARSIZE=STR_SIZE("Happy Holidays", 0.3)

 MODIFICATION HISTORY:

  Written by: David Fanning, 17 DEC 96.
  Added a scaling factor to take into account the aspect ratio
     of the window in determing the character size. 28 Oct 97. DWF

(See /nstxusr1/util/idl_cvs/coyote/str_size.pro)


TVIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     TVIMAGE

 PURPOSE:
     This purpose of TVIMAGE is to allow you to display an image
     on the display or in a PostScript file in a particular position.
     The position is specified by means of the POSITION keyword. In
     this respect, TVIMAGE works like other IDL graphics commands.
     Moreover, the TVIMAGE command works identically on the display
     and in a PostScript file. You don't have to worry about how to
     "size" the image in PostScript. The output on your display and
     in the PostScript file will be identical. The major advantage of
     TVIMAGE is that it can be used in a natural way with other IDL
     graphics commands in resizeable IDL graphics windows. TVIMAGE
     is a replacement for TV and assumes the image has been scaled
     correctly when it is passed as an argument.

 AUTHOR:
       FANNING SOFTWARE CONSULTING:
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
     Graphics display.

 CALLING SEQUENCE:

     TVIMAGE, image

 INPUTS:
     image:    A 2D or 3D image array. It should be byte data.

       x  :    The X position of the lower-left corner of the image.
               This parameter is only recognized if the TV keyword is set.

       y  :    The Y position of the lower-left corner of the image.
               This parameter is only recognized if the TV keyword is set.

 KEYWORD PARAMETERS:
     ERASE:    If this keyword is set an ERASE command is issued
               before the image is displayed. Note that the ERASE
               command puts the image on a new page in PostScript
               output.

     _EXTRA:   This keyword picks up any TV keywords you wish to use.

     KEEP_ASPECT_RATIO: Normally, the image will be resized to fit the
               specified position in the window. If you prefer, you can
               force the image to maintain its aspect ratio in the window
               (although not its natural size) by setting this keyword.
               The image width is fitted first. If, after setting the
               image width, the image height is too big for the window,
               then the image height is fitted into the window. The
               appropriate values of the POSITION keyword are honored
               during this fitting process. Once a fit is made, the
               POSITION coordiates are re-calculated to center the image
               in the window. You can recover these new position coordinates
               as the output from the POSITION keyword.

     MARGIN:   A single value, expressed as a normalized coordinate, that
               can easily be used to calculate a position in the window.
               The margin is used to calculate a POSITION that gives
               the image an equal margin around the edge of the window.
               The margin must be a number in the range 0.0 to 0.333. This
               keyword is ignored if the POSITION keyword is used.

     MINUS_ONE: The value of this keyword is passed along to the CONGRID
               command. It prevents CONGRID from adding an extra row and
               column to the resulting array, which can be a problem with
               small image arrays.

     MULTI:    If this keyword is set, the image output honors the
               !P.MULTI system variable.

     NORMAL:   Setting this keyword means image position coordinates x and y
               are interpreted as being in normalized coordinates. This keyword
               is only valid if the TV keyword is set.

     POSITION: The location of the image in the output window. This is
               a four-element floating array of normalized coordinates of
               the type given by !P.POSITION or the POSITION keyword to
               other IDL graphics commands. The form is [x0, y0, x1, y1].
               The default is [0.0, 0.0, 1.0, 1.0]. Note that this can
               be an output parameter if the KEEP_ASPECT_RATIO keyword is
               used.

     TV:       Setting this keyword makes the TVIMAGE command work much
               like the TV command, although better. That is to say, it
               will still set the correct DECOMPOSED state depending upon
               the kind of image to be displayed (8-bit or 24-bit). It will
               also allow the image to be "positioned" in the window by
               specifying the coordinates of the lower-left corner of the
               image. The NORMAL keyword is activated when the TV keyword
               is set, which will indicate that the position coordinates
               are given in normalized coordinates rather than device
               coordinates.

               Setting this keyword will ensure that the keywords
               KEEP_ASPECT_RATIO, MARGIN, MINUS_ONE, MULTI, and POSITION
               are ignored.

 OUTPUTS:
     None.

 SIDE EFFECTS:
     Unless the KEEP_ASPECT_RATIO keyword is set, the displayed image
     may not have the same aspect ratio as the input data set.

 RESTRICTIONS:
     If the POSITION keyword and the KEEP_ASPECT_RATIO keyword are
     used together, there is an excellent chance the POSITION
     parameters will change. If the POSITION is passed in as a
     variable, the new positions will be returned as an output parameter.

     If the image is 2D then color decomposition is turned OFF
     for the current graphics device (i.e., DEVICE, DECOMPOSED=0).

     If outputting to the PRINTER device, the aspect ratio of the image
     is always maintained and the POSITION coordinates are ignored.
     The image always printed in portrait mode.

 EXAMPLE:
     To display an image with a contour plot on top of it, type:

        filename = FILEPATH(SUBDIR=['examples','data'], 'worldelv.dat')
        image = BYTARR(360,360)
        OPENR, lun, filename, /GET_LUN
        READU, image
        FREE_LUN, lun

        TVIMAGE, image, POSITION=thisPosition, /KEEP_ASPECT_RATIO
        CONTOUR, image, POSITION=thisPosition, /NOERASE, XSTYLE=1, $
            YSTYLE=1, XRANGE=[0,360], YRANGE=[0,360], NLEVELS=10

 MODIFICATION HISTORY:
      Written by:     David Fanning, 20 NOV 1996.
      Fixed a small bug with the resizing of the image. 17 Feb 1997. DWF.
      Removed BOTTOM and NCOLORS keywords. This reflects my growing belief
         that this program should act more like TV and less like a "color
         aware" application. I leave "color awareness" to the program
         using TVIMAGE. Added 24-bit image capability. 15 April 1997. DWF.
      Fixed a small bug that prevented this program from working in the
          Z-buffer. 17 April 1997. DWF.
      Fixed a subtle bug that caused me to think I was going crazy!
          Lession learned: Be sure you know the *current* graphics
          window! 17 April 1997. DWF.
      Added support for the PRINTER device. 25 June 1997. DWF.
      Extensive modifications. 27 Oct 1997. DWF
          1) Removed PRINTER support, which didn't work as expected.
          2) Modified Keep_Aspect_Ratio code to work with POSITION keyword.
          3) Added check for window-able devices (!D.Flags AND 256).
          4) Modified PostScript color handling.
      Craig Markwart points out that Congrid adds an extra row and column
          onto an array. When viewing small images (e.g., 20x20) this can be
          a problem. Added a Minus_One keyword whose value can be passed
          along to the Congrid keyword of the same name. 28 Oct 1997. DWF
      Changed default POSITION to fill entire window. 30 July 1998. DWF.
      Made sure color decomposition is OFF for 2D images. 6 Aug 1998. DWF.
      Added limited PRINTER portrait mode support. The correct aspect ratio
          of the image is always maintained when outputting to the
          PRINTER device and POSITION coordinates are ignored. 6 Aug 1998. DWF
      Removed 6 August 98 fixes (Device, Decomposed=0) after realizing that
          they interfere with operation in the Z-graphics buffer. 9 Oct 1998. DWF
      Added a MARGIN keyword. 18 Oct 1998. DWF.
      Re-established Device, Decomposed=0 keyword for devices that
         support it. 18 Oct 1998. DWF.
      Added support for the !P.Multi system variable. 3 March 99. DWF
      Added DEVICE, DECOMPOSED=1 command for all 24-bit images. 2 April 99. DWF.
      Added ability to preserve DECOMPOSED state for IDL 5.2 and higher. 4 April 99. DWF.
      Added TV keyword to allow TVIMAGE to work like the TV command. 11 May 99. DWF.

(See /nstxusr1/util/idl_cvs/coyote/tvimage.pro)


TVSCALE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     TVSCALE

 PURPOSE:
     This purpose of TVSCALE is to allow you to display an image
     on the display or in a PostScript file in a particular position.
     The position is specified by means of the POSITION keyword. In
     this respect, TVSCALE works like other IDL graphics commands.
     Moreover, the TVSCALE command works identically on the display
     and in a PostScript file. You don't have to worry about how to
     "size" the image in PostScript. The output on your display and
     in the PostScript file will be identical. The major advantage of
     TVSCALE is that it can be used in a natural way with other IDL
     graphics commands in resizeable IDL graphics windows. TVSCALE
     is a replacement for TVSCL. In addition, you can use the TOP
     and BOTTOM keywords to define a particular set of number to
     scale the data to. The algorithm used is this:

         TV. BytScl(image, TOP=top-bottom) + bottom

     Note that if you scale the image between 100 and 200, that
     there are 101 possible pixel values. So the proper way to
     load colors would be like this:

       LoadCT, NColors=101, Bottom=100
       TVSCALE, image, Top=200, Bottom=100

     Alternatively, you could use the NCOLORS keyword:

       LoadCT, NColors=100, Bottom=100
       TVSCALE, image, NColors=100, Bottom=100

 AUTHOR:
       FANNING SOFTWARE CONSULTING:
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
     Graphics display.

 CALLING SEQUENCE:

     TVSCALE, image

 INPUTS:
     image:    A 2D or 3D image array. It does not have to be byte data.

       x  :    The X position of the lower-left corner of the image.
               This parameter is only recognized if the TVSCL keyword is set.

       y  :    The Y position of the lower-left corner of the image.
               This parameter is only recognized if the TVSCL keyword is set.

 KEYWORD PARAMETERS:
     BOTTOM:   The image is scaled so that all displayed pixels have values
               greater than or equal to BOTTOM and less than or equal to TOP.
               The value of BOTTOM is 0 by default.

     ERASE:    If this keyword is set an ERASE command is issued
               before the image is displayed. Note that the ERASE
               command puts the image on a new page in PostScript
               output.

     _EXTRA:   This keyword picks up any TV keywords you wish to use.

     KEEP_ASPECT_RATIO: Normally, the image will be resized to fit the
               specified position in the window. If you prefer, you can
               force the image to maintain its aspect ratio in the window
               (although not its natural size) by setting this keyword.
               The image width is fitted first. If, after setting the
               image width, the image height is too big for the window,
               then the image height is fitted into the window. The
               appropriate values of the POSITION keyword are honored
               during this fitting process. Once a fit is made, the
               POSITION coordiates are re-calculated to center the image
               in the window. You can recover these new position coordinates
               as the output from the POSITION keyword.

     MARGIN:   A single value, expressed as a normalized coordinate, that
               can easily be used to calculate a position in the window.
               The margin is used to calculate a POSITION that gives
               the image an equal margin around the edge of the window.
               The margin must be a number in the range 0.0 to 0.333. This
               keyword is ignored if the POSITION keyword is used.

     MAX:      The data is linearly scaled between the MIN and MAX values,
               if they are provided. MAX is set to MAX(image) by default.

     MIN:      The data is linearly scaled between the MIN and MAX values,
               if they are provided. MIN is set to MIN(image) by default.

     MINUS_ONE: The value of this keyword is passed along to the CONGRID
               command. It prevents CONGRID from adding an extra row and
               column to the resulting array, which can be a problem with
               small image arrays.

     MULTI:    If this keyword is set, the image output honors the
               !P.MULTI system variable.

     NCOLORS:  If this keyword is supplied, the TOP keyword is ignored and
               the TOP keyword is set equal to BOTTOM + NCOLORS - 1. This
               keyword is provided to make TVSCALE easier to use with the
               color-loading programs such as LOADCT:

                  LoadCT, 5, NColors=100, Bottom=100
                  TVScale, image, NColors=100, Bottom=100

     NORMAL:   Setting this keyword means image position coordinates x and y
               are interpreted as being in normalized coordinates. This keyword
               is only valid if the TVSCL keyword is set.

     POSITION: The location of the image in the output window. This is
               a four-element floating array of normalized coordinates of
               the type given by !P.POSITION or the POSITION keyword to
               other IDL graphics commands. The form is [x0, y0, x1, y1].
               The default is [0.0, 0.0, 1.0, 1.0]. Note that this can
               be an output parameter if the KEEP_ASPECT_RATIO keyword is
               used.

     TOP:      The image is scaled so that all displayed pixels have values
               greater than or equal to BOTTOM and less than or equal to TOP.
               The value of TOP is !D.Table_Size by default.

     TVSCL:    Setting this keyword makes the TVIMAGE command work much
               like the TVSCL command, although better. That is to say, it
               will still set the correct DECOMPOSED state depending upon
               the kind of image to be displayed (8-bit or 24-bit). It will
               also allow the image to be "positioned" in the window by
               specifying the coordinates of the lower-left corner of the
               image. The NORMAL keyword is activated when the TV keyword
               is set, which will indicate that the position coordinates
               are given in normalized coordinates rather than device
               coordinates.

               Setting this keyword will ensure that the keywords
               KEEP_ASPECT_RATIO, MARGIN, MINUS_ONE, MULTI, and POSITION
               are ignored.

 OUTPUTS:
     None.

 SIDE EFFECTS:
     Unless the KEEP_ASPECT_RATIO keyword is set, the displayed image
     may not have the same aspect ratio as the input data set.

 RESTRICTIONS:
     If the POSITION keyword and the KEEP_ASPECT_RATIO keyword are
     used together, there is an excellent chance the POSITION
     parameters will change. If the POSITION is passed in as a
     variable, the new positions will be returned as an output parameter.

     If the image is 2D then color decomposition is turned OFF
     for the current graphics device (i.e., DEVICE, DECOMPOSED=0).

     If outputting to the PRINTER device, the aspect ratio of the image
     is always maintained and the POSITION coordinates are ignored.
     The image always printed in portrait mode.

 EXAMPLE:
     To display an image with a contour plot on top of it, type:

        filename = FILEPATH(SUBDIR=['examples','data'], 'worldelv.dat')
        image = BYTARR(360,360)
        OPENR, lun, filename, /GET_LUN
        READU, image
        FREE_LUN, lun

        thisPosition = [0.1, 0.1, 0.9, 0.9]
        TVSCALE, image, POSITION=thisPosition, /KEEP_ASPECT_RATIO
        CONTOUR, image, POSITION=thisPosition, /NOERASE, XSTYLE=1, $
            YSTYLE=1, XRANGE=[0,360], YRANGE=[0,360], NLEVELS=10

 MODIFICATION HISTORY:
      Written by:     David Fanning, 27 May 1999 from TVIMAGE code.
      Added MIN, MAX, and NCOLORS keywords 28 May 1999. DWF.

(See /nstxusr1/util/idl_cvs/coyote/tvscale.pro)


UNDEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       UNDEFINE

 PURPOSE:
       The purpose of this program is to delete or undefine
       an IDL program variable from within an IDL program or
       at the IDL command line. It is a more powerful DELVAR.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Utilities.

 CALLING SEQUENCE:
       UNDEFINE, variable

 REQUIRED INPUTS:
       variable: The variable to be deleted.

 SIDE EFFECTS:
       The variable no longer exists.

 EXAMPLE:
       To delete the variable "info", type:

        IDL> Undefine, info

 MODIFICATION HISTORY:
       Written by David Fanning, 8 June 97, from an original program
       given to me by Andrew Cool, DSTO, Adelaide, Australia.

(See /nstxusr1/util/idl_cvs/coyote/undefine.pro)


VCOLORBAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       VCOLORBAR

 FILENAME:
       vcolorbar__define.pro
;
 PURPOSE:
       The purpose of this program is to create a vertical
       colorbar object to be used in conjunction with other
       IDL 5 graphics objects.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com/

 CATEGORY:
       IDL 5 Object Graphics.

 CALLING SEQUENCE:
       thisColorBar = Obj_New('VColorBar')

 REQUIRED INPUTS:
       None.

 INIT METHOD KEYWORD PARAMETERS:

       COLOR: A three-element array representing the RGB values of a color
          for the colorbar axes and annotation. The default value is
          white: [255,255,255].

       NAME: The name associated with this object.

       NCOLORS: The number of colors associated with the colorbar. The
          default is 256.

       MAJOR: The number of major tick divisions on the colorbar axes.
          The default is 5.

       MINOR: The number of minor tick marks on the colorbar axes.
          The default is 4.

       PALETTE: A palette object for the colorbar. The default palette
           is a gray-scale palette object.

       POSITION: A four-element array specifying the position of the
           colorbar in normalized coordinate space. The default position
           is [0.90, 0.10, 0.95, 0.90].

       RANGE: The range associated with the colorbar axis. The default
           is [0, NCOLORS].

       TEXT: A text object. Colorbar axis annotation will use this text
           object to set its properties. The default is a text object
           using a 8 point Helvetica font in the axis color.

       TITLE: A string containing a title for the colorbar axis
           annotation. The default is a null string.

 OTHER METHODS:

       GetProperty (Procedure): Returns colorbar properties in keyword
          parameters as defined for the INIT method. Keywords allowed are:

               COLOR
               NAME
               MAJOR
               MINOR
               PALETTE
               POSITION
               RANGE
               TEXT
               TITLE

       SetProperty (Procedure): Sets colorbar properties in keyword
          parameters as defined for the INIT method. Keywords allowed are:

               COLOR
               NAME
               MAJOR
               MINOR
               PALETTE
               POSITION
               RANGE
               TEXT
               TITLE

 SIDE EFFECTS:
       A VCOLORBAR object is created. The colorbar INHERITS IDLgrMODEL.
       Thus, all IDLgrMODEL methods and keywords can also be used. It is
       the model that is selected in a selection event, since the SELECT_TARGET
       keyword is set for the model.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To create a colorbar object and add it to a plot view object, type:

       thisColorBarObject = Obj_New('VColorBar')
       plotView->Add, thisColorBarObject
       plotWindow->Draw, plotView

 MODIFICATION HISTORY:
       Written by David Fanning, 19 June 97.
       Changed the optional "colorbarmodel" parameter to an
           optional GETMODEL parameter. 26 June 97. DWF.
       Fixed bug in the way the color palette was assigned. 13 Aug 97. DWF.
       Added missing container object to self structure. 13 Aug 97. DWF.
       Removed image model, which was a workaround for
           broken 5.0 objects. 5 Oct 97. DWF
       Fixed cleanup procedure to clean up ALL objects. 12 Feb 98. DWF.
       Changed IDLgrContainer to IDL_Container to fix 5.1 problems. 20 May 98. DWF.
       Modified colorbar to INHERIT an IDLgrModel object. This allows me to
           add the colorbar to other models directly. 20 Sept 98. DWF.
       Added NAME keyword to give the colorbar a name. 20 Sept 98. DWF.
       Changed a reference to _Ref_Extra to _Extra. 27 Sept 98. DWF.
       Fixed bug when adding a text object via the TEXT keyword. 9 May 99. DWF.

(See /nstxusr1/util/idl_cvs/coyote/vcolorbar__define.pro)


WHERETOMULTI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		wheretomulti.pro

 FUNCTION:	Convert WHERE output to 2d or 3d indices

 USAGE:	WhereToMulti, Array, Indices, Col, Row, Frame

 INPUT ARGUMENTS: 
   Array: the array that was WHERE'd
   Indices: the indices returned by WHERE

 OUTPUT ARGUMENTS: 
   Col:     Indices to first dimension.
   Row:     Indices to second dimension.
   Frame:   Indices to third dimension. Returned only for 3-d array.

 OPTIONAL ARGUMENTS: 

 KEYWORDS: 

 REQUIRED MODULES: 

 SIDE EFFECTS: 

 ERROR HANDLING:
   If Array is not a vector or matrix, all return values are set to zero
   and a message is written to the screen.

 NOTES:

 HISTORY:
 1998 Sept 15	J.L.Saba	Developed based on code from David Fanning's
                               web site.

(See /nstxusr1/util/idl_cvs/coyote/wheretomulti.pro)


WRITE_MPEG

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
        WRITE_MPEG



 PURPOSE: 
        Write a sequence of images as an mpeg movie



 CATEGORY: utility



 CALLING SEQUENCE:
        WRITE_MPEG,'movie.mpg',ims


 INPUTS:
         ims: sequence of images as a 3D array with dimensions [sx, sy, nims]
              where sx = xsize of images
                    sy = ysize of images
                    nims = number of images

 OPTIONAL INPUTS:



 KEYWORD PARAMETERS:
             delaft:   if set delete temporary array after movie was created
                       you should actually always do it otherwise you get
                       problems with permissions on multiuser machines (since
                       /tmp normally has the sticky bit set)
             rep:      if given means repeat every image 'rep' times
                       (as a workaround to modify replay speed)


 OUTPUTS: None

 OPTIONAL OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:
          creates some files in TMPDIR which are only removed when
          the DELAFT keyword is used


 RESTRICTIONS:
          depends on the program mpeg_encode from University of
          California, Berkeley, which must be installed in /usr/local/bin


 PROCEDURE:
         writes a parameter file based on the dimensions of the image
         array + the sequence of images in ppm format into a
         temporary directory; finally spawns mpeg_encode to build the
         movie


 EXAMPLE:



 MODIFICATION HISTORY:

       Mon Nov 18 13:13:53 1996, Christian Soeller
       

		grabbed original from the net and made slight modifications

(See /nstxusr1/util/idl_cvs/coyote/write_mpeg.pro)


XCD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   xcd

 PURPOSE:
   Change current directory via mouse.

   Two lists are displayed side by side.  The one on the left shows
   directories.  Click on a directory to cd there.  The list
   on the right shows files to help you see where you are.
   (The list on the right does not respond to mouse clicks.)
 CATEGORY:
   Utility.
 CALLING SEQUENCE:
   xcd
 INPUTS:
   None.
 KEYWORD PARAMETERS:
   None
 OUTPUTS:
   None.
 SIDE EFFECTS:
   Your current directory can be changed.
 RESTRICTIONS:
   Windows & OpenVMS platforms only.  Originally written on Windows95.
   Should work on other Windows platforms, but I (Paul) havn't tried it.

   With a little effort, one probably could port Xcd to other platforms
   (i.e. Unix or Mac).

   Note that drive names (e.g. "a:", "c:", etc.) are hardcoded in
   xcd::init.  Change that line of code to show drive letters
   appropriate for your system.

 PROCEDURE:
   Xcd creates an object that has a reference to a DirListing, and
   widgets for displaying that DirListing.  If the user clicks on a
   sub-directory (or "..\") in the xcd object, or droplist-selects
   a different drive via the xcd object, the xcd object changes
   IDL's current directory to that location, and refreshes with a
   new current-directory DirListing.

 MODIFICATION HISTORY:
   Paul C. Sorenson, July 1997. paulcs@netcom.com.
        Written with IDL 5.0.  The object-oriented design of Xcd is
        based in part on an example authored by Mark Rivers.
   Jim Pendleton, July 1997. jimp@rsinc.com
        Modified for compatability with OpenVMS as a basis for
        platform independent code
   Paul C. Sorenson, July 13 1997.  Changes so that DirListing class
        methods do not return pointers to data members.  (Better
        object-oriented design that way.)

(See /nstxusr1/util/idl_cvs/coyote/xcd.pro)


XCOLORS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       XCOLORS

 PURPOSE:
       The purpose of this routine is to interactively change color tables
       in a manner similar to XLOADCT. No common blocks are used so
       multiple copies of XCOLORS can be on the display at the same
       time (if each has a different TITLE). XCOLORS has the ability
       to notify a widget event handler or an object method if and when
       a new color table has been loaded. The event handler or object method
       is then responsibe for updating the program's display on 16- or
       24-bit display systems.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets.

 CALLING SEQUENCE:
       XCOLORS

 INPUTS:
       None.

 KEYWORD PARAMETERS:
       BOTTOM: The lowest color index of the colors to be changed.

       DRAG: Set this keyword if you want colors loaded as you drag
       the sliders. Default is to update colors only when you release
       the sliders.

       FILE: A string variable pointing to a file that holds the
       color tables to load. The normal colors1.tbl file is used by default.

       GROUP_LEADER: The group leader for this program. When the group
       leader is destroyed, this program will be destroyed.

       NCOLORS: This is the number of colors to load when a color table
       is selected.

       NOTIFYID: A 2-column by n-row array that contains the IDs of widgets
       that should be notified when XCOLORS loads a color table. The first
       column of the array is the widgets that should be notified. The
       second column contains IDs of widgets that are at the top of the
       hierarchy in which the corresponding widgets in the first column
       are located. (The purpose of the top widget IDs is to make it
       possible for the widget in the first column to get the "info"
       structure of the widget program.) An XCOLORS_LOAD event will be
       sent to the widget identified in the first column. The event
       structure is defined like this:

       event = {XCOLORS_LOAD, ID:0L, TOP:0L, HANDLER:0L, $
          R:BytArr(!D.N_COLORS < 256), G:BytArr(!D.N_COLORS < 256), $
          B:BytArr(!D.N_COLORS < 256), INDEX:0}

       The ID field will be filled out with NOTIFYID[0, n] and the TOP
       field will be filled out with NOTIFYID[1, n]. The R, G, and B
       fields will have the current color table vectors, obtained by
       exectuing the command TVLCT, r, g, b, /Get. The INDEX field will
       have the index number of the just-loaded color table.

       Note that XCOLORS can't initially tell *which* color table is
       loaded, since it just uses whatever colors are available when it
       is called. Thus, it stores a -1 in the INDEX field to indicate
       this "default" value. Programs that rely on the INDEX field of
       the event structure should normally do nothing if the value is
       set to -1. This value is also set to -1 if the user hits the
       CANCEL button.

       Typically the XCOLORS button will be defined like this:

           xcolorsID = Widget_Button(parentID, Value='Load New Color Table...', $
               Event_Pro='Program_Change_Colors_Event')

       The event handler will be written something like this:

           PRO Program_Change_Colors_Event, event

              ; Handles color table loading events. Allows colors be to changed.

           Widget_Control, event.top, Get_UValue=info, /No_Copy
           thisEvent = Tag_Names(event, /Structure_Name)
           CASE thisEvent OF

              'WIDGET_BUTTON': BEGIN

                    ; Color table tool.

                 XColors, NColors=info.ncolors, Bottom=info.bottom, $
                    Group_Leader=event.top, NotifyID=[event.id, event.top]
                 ENDCASE

              'XCOLORS_LOAD': BEGIN

                    ; Update the display for 24-bit displays.

                 Device, Get_Visual_Depth=thisDepth
                 IF thisDepth GT 8 THEN BEGIN
                    WSet, info.wid

                    ...Whatever display commands are required go here. For example...

                    TV, info.image

                 ENDIF
                 ENDCASE

           ENDCASE

           Widget_Control, event.top, Set_UValue=info, /No_Copy
           END

       NOTIFYOBJ: A vector of structures (or a single structure), with
       each element of the vector defined as follows:

          struct = {XCOLORS_NOTIFYOBJ, object:Obj_New(), method:'', wid:0}

       where the "object" is an object reference, "method" is the object
       method that should be called when XCOLORS loads its color tables,
       and "wid" is the window index number of the window where the object
       output should be displayed. Note that the current graphics window
       will be set to struct.wid before the object method is called.

           ainfo = {XCOLORS_NOTIFYOBJ, a, 'Draw', 0}
           binfo = {XCOLORS_NOTIFYOBJ, b, 'Display', 3}
           XColors, NotifyObj=[ainfo, binfo]

       Note that the XColors program must be compiled before these structures
       are used. Alternatively, you can put this program, named
       "xcolors_notifyobj__define.pro" (*three* underscore characters in this
       name!) in your PATH:

           PRO XCOLORS_NOTIFYOBJ__DEFINE
              struct = {XCOLORS_NOTIFYOBJ, OBJECT:Obj_New(), METHOD:'', WID:0}
           END

       TITLE: This is the window title. It is "Load Color Tables" by
       default. The program is registered with the name 'XCOLORS:' plus
       the TITLE string. The "register name" is checked before the widgets
       are defined. If a program with that name has already been registered
       you cannot register another with that name. This means that you can
       have several versions of XCOLORS open simultaneously as long as each
       has a unique title or name. For example, like this:

         IDL> XColors, NColors=100, Bottom=0, Title='First 100 Colors'
         IDL> XColors, NColors=100, Bottom=100, Title='Second 100 Colors'

       XOFFSET: This is the X offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

       YOFFSET: This is the Y offset of the program on the display. The
       program will be placed approximately in the middle of the display
       by default.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       Colors are changed. Events are sent to widgets if the NOTIFYID
       keyword is used. Object methods are called if the NOTIFYOBJ keyword
       is used. This program is a non-blocking widget.

 RESTRICTIONS:
       None.

 EXAMPLE:
       To load a color table into 100 colors, starting at color index
       50 and send an event to the widget identified at info.drawID
       in the widget heirarchy of the top-level base event.top, type:

       XCOLORS, NCOLORS=100, BOTTOM=50, NOTIFYID=[info.drawID, event.top]

 MODIFICATION HISTORY:
       Written by:     David Fanning, 15 April 97. Extensive modification
         of an older XCOLORS program with excellent suggestions for
         improvement by Liam Gumley. Now works on 8-bit and 24-bit
         systems. Subroutines renamed to avoid ambiguity. Cancel
         button restores original color table.
       23 April 97, added color protection for the program. DWF
       24 April 97, fixed a window initialization bug. DWF
       18 June 97, fixed a bug with the color protection handler. DWF
       18 June 97, Turned tracking on for draw widget to fix a bug
         in TLB Tracking Events for WindowsNT machines in IDL 5.0. DWF
       20 Oct 97, Changed GROUP keyword to GROUP_LEADER. DWF
       19 Dec 97, Fixed bug with TOP/BOTTOM reversals and CANCEL. DWF.
        9 Jun 98, Fixed bug when using BOTTOM keyword on 24-bit devices. DWF
        9 Jun 98, Added Device, Decomposed=0 for TrueColor visual classes. DWF
        9 Jun 98, Removed all IDL 4 compatibility.
       21 Oct 98, Fixed problem with gamma not being reset on CANCEL. DWF
        5 Nov 98. Added the NotifyObj keyword, so that XCOLORS would work
         interactively with objects. DWF.
        9 Nov 98. Made slider reporting only at the end of the drag. If you
         want continuous updating, set the DRAG keyword. DWF.
        9 Nov 98. Fixed problem with TOP and BOTTOM sliders not being reset
         on CANCEL. DWF.
       10 Nov 98. Fixed fixes. Sigh... DWF.
        5 Dec 98. Added INDEX field to the XCOLORS_LOAD event structure. This
         field holds the current color table index number. DWF.
        5 Dec 98. Modified the way the colorbar image was created. Results in
         greatly improved display for low number of colors. DWF.
        6 Dec 98. Added the ability to notify an unlimited number of objects. DWF.
       12 Dec 98. Removed obsolete Just_Reg keyword and improved documetation. DWF.
       30 Dec 98. Fixed the way the color table index was working. DWF.
        4 Jan 99. Added slightly modified CONGRID program to fix floating divide
          by zero problem. DWF
        2 May 99. Added code to work around a Macintosh bug in IDL through version
          5.2 that tries to redraw the graphics window after a TVLCT command. DWF.
        5 May 99. Restore the current window index number after drawing graphics.
          Not supported on Macs. DWF.
        9 Jul 99. Fixed a couple of bugs I introduced with the 5 May changes. Sigh... DWF.
       13 Jul 99. Scheesh! That May 5th change was a BAD idea! Fixed more bugs. DWF.
       31 Jul 99. Substituted !D.Table_Size for !D.N_Colors. DWF.
        1 Sep 99. Got rid of the May 5th fixes and replaced with something MUCH simpler. DWF.

(See /nstxusr1/util/idl_cvs/coyote/xcolors.pro)


XCONTOUR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       XCONTOUR

 PURPOSE:
       The purpose of this program is to demonstrate how to
       create a contour plot with axes and a title in the
       new IDL 5 object graphics.

 AUTHOR:
       FANNING SOFTWARE CONSULTING
       David Fanning, Ph.D.
       2642 Bradbury Court
       Fort Collins, CO 80521 USA
       Phone: 970-221-0438
       E-mail: davidf@dfanning.com
       Coyote's Guide to IDL Programming: http://www.dfanning.com

 CATEGORY:
       Widgets, IDL 5 Object Graphics.

 CALLING SEQUENCE:
       XCONTOUR, data, x, y

 REQUIRED INPUTS:
       None. Fake data will be used if no data is supplied in call.

 OPTIONAL INPUTS

       data: A 2D array of surface data.

       x: A vector of X data values.

       y: A vector of Y data values.

 OPTIONAL KEYWORD PARAMETERS:

       _EXTRA: This keyword collects otherwise undefined keywords that are
       passed to the old IDL contour command. Most of the keywords will
       have absolutely no effect.

       GROUP_LEADER: The group leader for this program. When the group leader
       is destroyed, this program will be destroyed.

       NLEVELS: The number of equally spaced contour intervals to draw.
       Default is 10. Note that contour levels are acutally calculated,
       since the NLEVELS keyword to the contour object does not always
       result in the correct number of contour levels.

       TITLE: A string used as the title of the plot.

       XTITLE: A string used as the X title of the plot.

       YTITLE: A string used as the Y title of the plot.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       Requires the VCOLORBAR__DEFINE program from the Coyote Library:

          http://www.dfanning.com/programs/vcolorbar__define.pro

 EXAMPLE:
       To use this program with your 2D data, type:

        IDL> XContour, data

 MODIFICATION HISTORY:
       Written by David Fanning, 9 June 97.
       Added a colorbar to the plot. 19 June 97, DWF.
       Modified the way VCOLORBAR was called. 14 July 97. DWF.
       Fixed cleanup procedure to clean up ALL objects. 12 Feb 98. DWF.
       Changed IDLgrContainer to IDL_Container to fix 5.1 problems. 20 May 98. DWF.
       Modified to use the IDLgrColorbar object. 20 Sept 98. DWF.
       Added the ability to do a filled contour. 27 Sept 98. DWF.
       Fixed a bug in the way the data was scaled into the view. 9 May 99. DWF.
       Fixed a bug in the filled contours. 11 May 99. DWF.

(See /nstxusr1/util/idl_cvs/coyote/xcontour.pro)