
;+ ***********************************************************************
; NAME:
;	NRH1_GETZONE
;
; PURPOSE:
;	Cette fonction permet la determination d'un ou deux points 
;	d'une zone par curseur
;
; CATEGORY:
;	NRH1 General
;
; CALLING SEQUENCE:
;	Resultat = NRH1_GETZONE()
;
; INPUTS:
;	Non
;	
; KEYWORD PARAMETERS:
;	SINGLE	Determination d'un seul point
;
; OUTPUTS:
;	Describe any outputs here
;
; SIDE EFFECTS:
;	Dans le cas de la determination de 2 points, cette fonction appelle
;	BOX_CURSOR2
;
; MODIFICATION HISTORY: bonmartin@obspm.fr
;	Adapte de XHELIO le 20/12/98
;	remplace le courseur par BOX_CURSOR2 le 20/12/98 (JB)
;-*******************************************************************

FUNCTION NRH1_GETZONE, SINGLE=single

; .
;
; Parametres: SINGLE	Mot cle a mettre si l'on determine un seul point 

IF (!D.WINDOW EQ -1) THEN RETURN,0

IF NOT KEYWORD_SET(SINGLE) THEN BEGIN

;       Acquisition of the cursor position in DEVICE coordinates.
;	Conversion of the DEVICE coordinates into DATA coordinates.

;             WHILE ((X EQ -1) OR (Y EQ -1)) DO CURSOR,X,Y,/DEVICE,/DOWN
;             v1 = CONVERT_COORD([x,y], /DEVICE, /TO_DATA)
	BOX_CURSOR2,X0, Y0, Nx, Ny
		V1= CONVERT_COORD([x0,y0], /DEVICE, /TO_DATA)
        	V2 = CONVERT_COORD([x0+Nx,y0+Ny], /DEVICE, /TO_DATA)
       return,[v1(0), v1(1), v2(0), v2(1)]	
ENDIF

IF KEYWORD_SET(SINGLE) THEN BEGIN
	x=-1
	y=-1
	DEVICE,CURSOR_STANDARD = 14
             WHILE ((X EQ -1) OR (Y EQ -1)) DO CURSOR,X,Y,/DEVICE,/DOWN
             v2 = CONVERT_COORD([x,y], /DEVICE, /TO_DATA)
	DEVICE,/CURSOR_CROSSHAIR
       return,[v2(0), v2(1)]
ENDIF
END             
    
