FUNCTION SSMMHH, Time hour = long(Time)/3600 minute = long(Time-3600*hour)/60 sec = Time mod 60 sec_int=double(fix(sec)) msec=(sec-sec_int)*1d3 hour=hour mod 24 return, string(transpose([[hour], [minute], [sec_int], [msec]]), $ format = "(I2.2,':',I2.2,':',I2.2,'.', I3.3)") END function cursorpos, button=button, data=data, $ device=device, normal=normal, time=time, top=top, hours=hours, $ seconds=seconds, ytime=ytime ;+ ; CURSORPOS ; ; PURPOSE: ; Read the value of the pixel under the cursor. ; Display x,y under the cursor in the graphic window. ; ; CATEGORY: ; Image analysis. ; ; CALLING SEQUENCE: ; Coord = CURSORPOS() ; ; INPUTS: ; None ; ; OPTIONAL INPUT PARAMETERS: ; None ; ; KEYWORD PARAMETERS: ; ; BUTTON: return value of the pressed button (1 - left, 4 - right). ; ; DATA: If set and non-zero, DATA coordinate system is processed (by default). ; ; DEVICE: If set and non-zero, DEVICE coordinate system is processed. ; ; NORMAL: If set and non-zero, NORMAL coordinate system is processed. ; ; TIME: Display X coordinate in form "hh:mm:ss". Seconds along the X axis are intended. ; ; TOP: Display X,Y in the top left corner of the window ; ; HOURS: Display X coordinate in form "hh:mm:ss". Hours along the X axis are intended. ; ; SECONDS: Display X coordinate in the form "hh:mm:ss". Seconds along the X axis are ; intended. Same as TIME keyword. ; ; YTIME: Display Y coordinate in the form "hh:mm:ss". Seconds along the X axis are ; intended. ; ; OUTPUTS: ; None. ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; The X, Y, and value of the pixel under the cursor are continuously displayed. ; ; RESTRICTIONS: ; None. ; ; PROCEDURE: ; X,Y values are printed as the cursor is moved over the plotting area. ; Press any mouse button to exit the procedure. ; ; MODIFICATION HISTORY: ; ISTP SD RAS, Feb, 1994. ; Victor Grechnev (grechnev@iszf.irk.ru): Initially written. ; ;- height=20 erase=replicate(!p.background, !d.x_size/2, height) Xout=3 if keyword_set(top) then Yout=!d.y_size-height else Yout=3 if keyword_set(top) then tv, erase, 0 else tv, erase, 0, 0 old_data=' ' REPEAT BEGIN cursor, xc, yc, /ch, data=data, device=device, normal=normal button=!err if keyword_set(ytime) then begin CASE 1 OF keyword_set(time) or keyword_set(seconds): aa= $ string(xc, format='(g12.5)')+', '+SSMMHH(yc) keyword_set(hours): aa=string(xc, format='(g12.5)')+', '+SSMMHH(yc*3600) ELSE: aa=string(xc, format='(g12.5)')+', '+SSMMHH(yc) ENDCASE endif else begin CASE 1 OF keyword_set(time) or keyword_set(seconds): aa=SSMMHH(xc)+ $ ', '+string(yc, format='(g12.5)') keyword_set(hours): aa=SSMMHH(xc*3600)+', '+string(yc, format='(g12.5)') ELSE: aa=string(xc, yc, format='(g12.5, ", ", g12.5)') ENDCASE endelse xyouts, Xout, Yout, old_data, /dev, font=0, col=!p.background xyouts, Xout, Yout, aa, /dev, font=0 old_data=aa ENDREP UNTIL ((button and 7B) ge 1B) or $ n_elements(in_data) gt 0 wait, 0.3 RETURN, [xc, yc] end