;+
;
; @file_comments
; Same thing that contour but compatible with the whole environment
; (common included)
;
; @categories
; Graphics
;
; @keyword NOREINITPLT
; We active it if we do not want environment variables !p, !x, !y, !z
; to be reinitilalized by the procedure reinitplt
;
; @keyword _EXTRA
; Used to pass keywords
;
; @uses
; common
;
; @examples
;
; IDL> z = dist(100)
; IDL> scontour, z, nlevels=10,small=[1,2,1],xstyle=1,ystyle=1
; IDL> \@ps
;
; @history
; Sebastien Masson (smasson\@lodyc.jussieu.fr)
; 10/10/1999
;
; @version
; $Id$
;
;-
PRO scontour, x, y, z, NOREINITPLT=noreinitplt, _EXTRA=ex
;
compile_opt idl2, strictarrsubs
;
@common
; 1) I reinitialize the graphic environment (variables !x, !y and !p):
if NOT keyword_set(NOREINITPLT) then reinitplt, _extra = ex
; 2) i put the drawing on the screen like on the postscript
; if ex contains norease and c_orientation keywords we force ex.noerase = 0
IF chkstru(ex, 'overplot') EQ 0 THEN placedessin, 'autre', _extra = ex
; fiddle when noerase is used with c_orientation...
; call contour with /nodata to get the graphic environment, then force
; noerase = 0 and overplot = 1
IF size(ex, /type) EQ 8 THEN BEGIN
; check if noerase is used with c_orientation
alltags = strlowcase(tag_names(ex))
dummy = where(alltags EQ 'noerase', count1)
dummy = where(alltags EQ 'c_orientation', count2)
IF count1*count2 NE 0 THEN BEGIN
case n_params() OF
1:contour, x, /nodata, _EXTRA = ex
2:contour, x, y, /nodata, _EXTRA = ex
3:contour, x, y, z, /nodata, _EXTRA = ex
endcase
ex.noerase = 0
ex = get_extra(/overplot, _extra = ex)
noerase_orientation = 1
ENDIF
ENDIF
; 3) je fais mon joli dessin
case n_params() OF
1:contour, x, xstyle = 1, ystyle = 1, _EXTRA = ex
2:contour, x, y, xstyle = 1, ystyle = 1, _EXTRA = ex
3:contour, x, y, z, xstyle = 1, ystyle = 1, _EXTRA = ex
ENDCASE
; fiddle when noerase is used with c_orientation... draw the contour axis
IF keyword_set(noerase_orientation) THEN BEGIN
ex.noerase = 1
ex.overplot = 0
case n_params() OF
1:contour, x, xstyle = 1, ystyle = 1, /nodata, _EXTRA = ex
2:contour, x, y, xstyle = 1, ystyle = 1, /nodata, _EXTRA = ex
3:contour, x, y, z, xstyle = 1, ystyle = 1, /nodata, _EXTRA = ex
ENDCASE
ENDIF
; 4) End of drawing
terminedessin, _extra = ex
return
end