;+ ; ; NAME : ; SUMER_TOOL_MAIN_EVENT ; PURPOSE : ; Responds to main events in XRASTER ; CALLING SEQUENCE: ; SUMER_TOOL_MAIN_EVENT, event [, group=group] ; INPUTS: ; EVENT an event structure variable (given by XRASTER) ; OUTPUTS: ; None ; KEYWORDS: ; GROUP widget ID of the group leader (optional input) ; COMMON BLOCKS: ; XLOADCT_COM MONOCOLORS_BLOCK ; SIDE EFFECTS: ; Changes some variables in the common blocks ; Controls various kinds of display ; REQUIRED ROUTINES: ; DISPLAY_IMA DISPLAY_X DISPLAY_Y DISPLAY_W ; DISPLAY_SPECTRUM MARK_ON_IMAGE ; MODIFICATION HISTORY ; March 1997 Jongchul Chae ;- PRO SUMER_TOOL_MAIN_Event, Event, GROUP=group common sumer_tool_block, xras, data_str ;@xloadct_com xsize_image_dev = fix(xras.par.xdim*xras.par.mag_x) ysize_image_dev =fix(xras.par.ydim*xras.par.mag_y) WIDGET_CONTROL,Event.Id,GET_UVALUE=Ev CASE Event.id OF xras.widget.IMA_COL : begin xras.par.icol(0)=event.index widget_control,xras.widget.IMA_COL, set_droplist_select=xras.par.icol(0) sumer_display_ima end xras.widget.y_COL : begin xras.par.icol(1)=event.index widget_control, xras.widget.Y_COL, set_droplist_select=xras.par.icol(1) ; if xras.par.ipar(1) lt 3 then $ sumer_display_spectrum end xras.widget.W_COL : begin xras.par.icol(3)=event.index widget_control, xras.widget.W_COL, set_droplist_select=xras.par.icol(3) sumer_display_w end xras.widget.w_fit : begin sumer_tool_fit_event, event, group=group end xras.widget.IMA_PAR : begin xras.par.ipar(0)=event.index widget_control, xras.widget.IMA_PAR, set_droplist_select=xras.par.ipar(0) sumer_display_ima end xras.widget.XRAS_PD: sumer_tool_PD_Event, Event, GROUP=group xras.widget.TEXT_A: BEGIN Print, 'Event for TEXT_A' END xras.widget.DRAW_IMA: BEGIN ; Print, 'Event for DRAW_IMA' ;@xloadct_com @monocolors_block if event.press ge 1 then $ case event.press of 1 : begin widget_control, xras.widget.draw_ima, get_value=DRAW_IMA_id wset, DRAW_IMA_id xmark=event.x ymark=event.y mark_on_image,xmark,ymark, color=green x = fix(float(event.x-xras.par.xoff_dev)/xras.par.mag_x) x = (xras.par.roi_space(0)+x) x = x > xras.par.roi_space(0) < xras.par.roi_space(2) y = fix(float(event.y-xras.par.yoff_dev)/xras.par.mag_y) y = xras.par.roi_space(3)-y y = y > xras.par.roi_space(1) < xras.par.roi_space(3) widget_control, xras.widget.FIELD_X, $ set_value=string(xras.par.xval(x), format='(f8.1)') widget_control, xras.widget.FIELD_Y, $ set_value=string(xras.par.yval(y), format='(f8.1)') ;if xras.par.ipar(0)+1 eq 1 then factor=data_str.amp else factor=1. case xras.par.ipar(0) of 3 : unit = 'log(count/pix)' 0 : unit = 'log(count)' 1 : unit = 'km/s' 2 : unit = 'km/s' end tmp = line_par_conv($ xras.par.data_fit(*,y,x,xras.par.icol(0)), $ data_str.refpos(0,xras.par.icol(0)), $ data_str.deltas(0,xras.par.icol(0)), $ xras.par.rest_pixel(x, xras.par.icol(0))) if xras.par.ipar(0) le 2 then value=tmp(xras.par.ipar(0)+1) else $ value=tmp(0) if belong(xras.par.ipar(0), [0, 3]) then value=alog10(value>0.01) widget_control, xras.widget.FIELD_VAL, set_value= $ string(value, format='(f10.2)')+' '+unit end 2 : begin widget_control, xras.widget.draw_ima, get_value=DRAW_IMA_id wset, DRAW_IMA_id xmark=event.x ymark=event.y mark_on_image,xmark,ymark, color=green x = fix(float(event.x-xras.par.xoff_dev)/xras.par.mag_x) x = (xras.par.roi_space(0)+x) x = x > xras.par.roi_space(0) < xras.par.roi_space(2) y = fix(float(event.y-xras.par.yoff_dev)/xras.par.mag_y) y = xras.par.roi_space(3)-y y = y > xras.par.roi_space(1) < xras.par.roi_space(3) widget_control, xras.widget.FIELD_X, $ set_value=string(xras.par.xval(x), format='(f8.1)') widget_control, xras.widget.FIELD_Y, $ set_value=string(xras.par.yval(y), format='(f8.1)') factor=1. case xras.par.ipar(0) of 3 : unit = 'count/pix' 0 : unit = 'count' 1 : unit = 'km/s' 2 : unit = 'km/s' end tmp = line_par_conv($ xras.par.data_fit(*,y,x,xras.par.icol(0)), $ data_str.refpos(0,xras.par.icol(0)), $ data_str.deltas(0,xras.par.icol(0)), $ xras.par.rest_pixel(x, xras.par.icol(0))) if xras.par.ipar(0) le 2 then value=tmp(xras.par.ipar(0)+1) else $ value=tmp(0) widget_control, xras.widget.FIELD_VAL, set_value= $ string(value/factor, format='(g12.3)')+' '+unit xras.par.x_curr(0) = x xras.par.y_curr(0) = y xras.par.x_curr(3) = x xras.par.y_curr(3) = y sumer_display_spectrum sumer_display_w end 4 : begin widget_control, xras.widget.draw_ima, get_value=DRAW_IMA_id wset, DRAW_IMA_id xmark=event.x ymark=event.y mark_on_image,xmark,ymark, color=green x = fix(float(event.x-xras.par.xoff_dev)/xras.par.mag_x) x = (xras.par.roi_space(0)+x) x = x > xras.par.roi_space(0) < xras.par.roi_space(2) y = fix(float(event.y-xras.par.yoff_dev)/xras.par.mag_y) y = xras.par.roi_space(3)-y y = y > xras.par.roi_space(1) < xras.par.roi_space(3) ; x, y : image pixel value xras.par.x_curr(0) = x xras.par.y_curr(0) = y xras.par.x_curr(3) = x xras.par.y_curr(3) = y sumer_display_w end endcase END ELSE : print, '' ENDCASE END