; ; NAME mouse_pos ; ; FUNCTION Determine pixel coordinates of the mouse cursor. ; ; HISTORY Andrew L. Stanger HAO/NCAR 14 May 1999 ;- PRO mouse_pos, xdim, ydim, xcen, ycen, pixrs, roll angle = 0.0 radius = 0.0 TVCRS, xcen, ycen ; Enable cursor PRINT, 'Click left mouse button to print cursor position [r,pos_angle].' PRINT, 'Click middle mouse button to terminate cursor position coordinates.' WHILE ( 1 ) DO $ BEGIN CURSOR, rxcur, rycur, /DEVICE, WAIT=3 IF (!ERR EQ 2) THEN GOTO, quit ; Done if middle button clicked. ierror = rcoord (radius, angle, rxcur, rycur, -1, roll, xcen, ycen, pixrs) ; PRINT, 'x, y: ', rxcur, rycur, ' radius, angle: ', radius, angle PRINT, FORMAT = '("[x,y]: ", i4, i4, " [r,th]: ", F5.2, " Rsun ", F7.2, " degrees")', $ rxcur, rycur, radius, angle WAIT, 0.5 ;--- Write Region information into log file. ; OPENW, lulog, logfile, /GET_LUN ; PRINTF, lulog, 'Mouse-Defined Curved Wedge Region: ', $ ; STRING (aoinum, FORMAT='(i3)') ; PRINTF, lulog, STRING (rmin, FORMAT='(F7.2)'), ' --> ', $ ; STRING (rmax, FORMAT='(F7.2)'), ' Rsun ', $ ; STRING (angmin, FORMAT='(F7.2)'), ' --> ', $ ; STRING (angmax, FORMAT='(F7.2)'), ' degrees' ; PRINTF, lulog, 'polygon vertices file: ', pvfile ; CLOSE, lulog ; FREE_LUN, lulog ;--- Write info to screen. ; PRINT, STRING (rmin, FORMAT='(F7.2)'), ' --> ', $ ; STRING (rmax, FORMAT='(F7.2)'), ' Rsun ', $ ; STRING (angmin, FORMAT='(F7.2)'), ' --> ', $ ; STRING (angmax, FORMAT='(F7.2)'), ' degrees' ;--- Draw point at cursor position. xv = [rxcur - 3, rxcur + 3] yv = [rycur - 3, rycur + 3] PLOTS, xv, yv, color=253, /DEVICE xv = [rxcur + 3, rxcur - 3] yv = [rycur - 3, rycur + 3] PLOTS, xv, yv, color=253, /DEVICE END quit: WAIT, 1.0 END