;+
; NAME:
;	SMEI_SHOW
;
;
; PURPOSE:
;	Display a SMEI sequence
;
;
; CATEGORY:
;	CLI
;
;
; CALLING SEQUENCE:
;	smei_show, seqref[, image]
;
;
; INPUTS:
;	seqref	objref	Object reference of the SMEI sequence
;
;
; OPTIONAL INPUTS:
;	image	int	The number of an image for a static
;			display. If this is specified, then the
;			sequence is started at that image and in a
;			paused state.
;
; KEYWORD PARAMETERS:
;	delay		float	The delay in seconds between images.
;	colour_table	int	The colour table to use
;	colour_map	byte	A 256x3 byte array that contains an explicit
;				colour map to use
;	grid		int	Whether to add a grid
;	nodate		int	Whether to omit the date range
;	range		float	2-element array with the range from
;				black to white
;	shift		int	Select the central PA for a
;				rectangular map (0=North, 1=East,
;				2=South, 3=West)
;
; RESTRICTIONS:
;	The keyword settings are persistent.
;
;
; MODIFICATION HISTORY:
;	Original: 11/12/02; SJT
;	Renamed: 18/12/02; SJT
;	Modify colour handling: 19/12/02; SJT
;	Add shift: 23/11/09; SJT
;-

pro smei_show, seq, image, delay = delay, colour_table = colour_table, $
               grid = grid, nodate = nodate, range = range, colour_map $
               = colour_map, shift = shift, help = help 

if keyword_set(help) then begin
    self_help
    return
endif


if not obj_valid(seq) then begin
    smei_msg, /alert, 'The specfied sequence is not a valid object'
    return
endif

if not obj_isa(seq, 'SMEI_SEQUENCE') then begin
    smei_msg, /alert, 'The specified sequence is not a SMEI_SEQUENCE'
    return
endif

if n_elements(colour_table) ne 0 then seq -> set_colour_map, table = $
  colour_table $
else if keyword_set(colour_map) then seq -> set_colour_map, map = $
  colour_map

if n_elements(grid) ne 0 then seq -> set_annotations, grid = $
  keyword_set(grid)
if n_elements(nodate) ne 0 then seq -> set_annotations, date = $
  keyword_set(nodate) eq 0

if n_elements(range) eq 2 then seq -> set_data_range, range $
else if n_elements(range) ne 0 then smei_msg, /warn, "The range must " + $
  "be a 2-element array, ignoring"

if seq -> get_projection() eq 2 && n_elements(shift) ne 0 then $
  seq -> set_shift, shift

seq -> show, image, delay = delay

end
