FSC_COLORBAR__DEFINE Note: The name of the routine has been changed from COLORBAR__DEFINE on 25 Sept 2010 to avoid conflicts with an IDL 8.0 routine of the same name. See the article "IDL 8 Name Conflicts" here: http://www.idlcoyote.com/ng_tips/idl8_name_conflicts.html
The purpose of this routine is to implement a FSC_COLORBAR object class. The ColorBar is rendered in the direct graphics system.
FANNING SOFTWARE CONSULTING David Fanning, Ph.D. 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com
Graphics.
colorbar = Obj_New("FSC_COLORBAR")
All inputs to the program are via 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.1 TickV: Locations for the tick marks in data units. This is the same as the [XY]TickV keyword. Default is to do what IDL would do normally. 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.
Clamp: This procedure method allows the color bar range to be "clamped" to a particular data range. 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
None.
The display window is not erased first.
None.
To create a colorbar, use it, then destroy it, type: colorbar = Obj_New("FSC_COLORBAR", Title='Colorbar Values', Range=[0,1000],$ Format='(I4)') Window LoadCT, 5 colorbar->Draw colorbar->SetProperty, Range=[0,500], /Erase, /Draw Obj_Destroy, colorbar
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. 10 Oct 99. Modified the program so that current plot and map coordinates are saved and restored after the colorbar is drawn. DWF. 26 May 2000 Added {XY}TICKV capability to the draw method. This required adding TickV to the object data structure, and to the INIT, GetProperty and SetProperty methods. Changed default tick length to -0.1. DWF (and Jack Saba) 18 Nov 2001. Added Clamp method. DWF. 25 September 2010. Renamed to FSC_Colorbar__Define to avoid conflict with a Colorbar__Define program introduced with IDL 8.0. DWF.