Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/display_suplevs.pro'
;+
; NAME:
;	Display_SupLevs
; PURPOSE:
;	Display the super-Levels created by user, as boxes around the
;	merged energy Levels, and display group number at upper-right corner.
; CALLING:
;	Display_SupLevs, SupLevs
; INPUTS:
;	SupLevs = array of structures with tags giving Location of superlevels.
; KEYWORDS:
;	ZOOM_FACTOR = magnification (default=1) to be applied to:
;		both x & y axes if one number is specified, or
;		x & y axes respectively if two numbers are specified.
; OUTPUTS:
;	None.
; EXTERNAL CALLS:
;	function N_struct
; PROCEDURE:
;	Create coordinates of boxes from corner Locations and call IDL plots.
; HISTORY:
;	Written: Frank Varosi NASA/GSFC 1995.
;-

pro Display_SupLevs, SupLevs, ZOOM_FACTOR=zoomf

	on_error,2
	NLev = N_struct( SupLevs )
	if (NLev LE 0) then return

	w = where( SupLevs.sel, nsel )
	if (nsel LE 0) then return

	Locs = SupLevs(w).Locs > 0

	CASE N_elements( zoomf ) OF
	  1:	Locs = temporary( Locs ) * zoomf
	  2:	Locs = temporary( Locs ) * $
			reform( [zoomf,zoomf] # replicate(1,nsel), 2, 2, nsel )
	  else:
	 ENDCASE

	Boxes = intarr( 2, 5, nsel )
	Boxes(*,0,*) = Locs(*,0,*)
	Boxes(0,1,*) = Locs(0,1,*)
	Boxes(1,1,*) = Locs(1,0,*)
	Boxes(*,2,*) = Locs(*,1,*)
	Boxes(0,3,*) = Locs(0,0,*)
	Boxes(1,3,*) = Locs(1,1,*)
	Boxes(*,4,*) = Locs(*,0,*)
	cols = SupLevs(w).color
	grps = strtrim( SupLevs(w).group, 2 )

	for i=0,nsel-1 do begin
		plots, Boxes(*,*,i),/DEV, COL=cols(i)
		Lxy = Locs(*,*,i)
		xyouts, Lxy(0,1)+3, Lxy(1,0), grps(i), FONT=0, COL=cols(i),/DEV
	  endfor

	SupLevs(w).disp = 0
end