PRO qImage_cw_Update, state, fresh=fresh, no_zupdate=no_zupdate ;+ ; NAME: ; qImage_cw_Update ; PURPOSE: ; Update display after the box in the x,y widgets is modified ; CATEGORY: ; Compound widget qImage_cw ; CALLING SEQUENCE: ; qImage_cw_Update, state [, /fresh] ; INPUTS: ; state array[1]; type: structure ; qImage_cw state structure ; OPTIONAL INPUT PARAMETERS: ; /fresh If not set infomation from a previous qImage_cw_Update ; is used to redraw portions of the screen: an existing ; box, and the cross section at top and right are erased. ; If set then these redraw operations are not done. This ; options is used when a full screen has been redrawn ; after a call to href=qImage_cw_Set_Value=. ; OUTPUTS: ; (screen updates) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; IsType, InitVar, qImage_cw_Box, qImage_cw_BoxImage, qImage_cw_Wedge ; qImage_cw_Transform, qImage_cw_Blowup, qImage_cw_DrawCross, qImage_cw_ZUpdate ; PROCEDURE: ; Once an image is put on the display by href=qImage_cw_Set_Value= all updates ; to the display are made by calls to this procedure. ; STATE INFO USED: ; widget_info(state.wid_draw,/valid_id) ; widget_control, state.wid_tool , get_uvalue=tool, /no_copy ; widget_control, state.wid_draw , get_value=wdraw_main ; widget_control, state.wid_draw , get_uvalue=image_box, /no_copy ; widget_control, state.wid_smei , get_uvalue=set ; STATE INFO MODIFIED: ; widget_control, state.wid_draw , set_uvalue=image_box, /no_copy ; ; state.img_wedge is set to 0 or 1 depending on whether or not a ; wedge was drawn on the display ; MODIFICATION HISTORY: ; FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, no_zupdate, /key zupdate = 1-no_zupdate ; First check whether an image is on display IF NOT widget_info(state.wid_draw,/valid_id) THEN RETURN wold = !d.window ; Current window widget_control, state.wid_tool, get_uvalue=tool_state, /no_copy zoom = tool_state.send.zoom_uval color = tool_state.send.white ellipse = tool_state.send.ellipse widget_control, state.wid_tool, set_uvalue=tool_state, /no_copy color = color*!p.background+(1-color)*!p.color InitVar, fresh, /key ;==================================================== ; First redraw the box in the main draw widget widget_control, state.wid_draw, get_value=wdraw_main wset, wdraw_main ; Check whether the bitmap for the previous box needs to be put back in ; The bitmap is stored in the user value of the draw widget ; This should also erase the box outline widget_control, state.wid_draw, get_uvalue=img_box, /no_copy IF NOT fresh THEN BEGIN IF IsType(img_box, /defined) THEN BEGIN edge = img_box[0:3] img_box = reform(img_box[4:*],edge[2]-edge[0]+1,edge[3]-edge[1]+1) tv, img_box, edge[0], edge[1] ENDIF ENDIF widget_control, state.wid_smei, get_uvalue=smei_set ; Check the current box setting. ; edge encloses the part of the image that needs to be restored on the next update CASE smei_set OF 0: BEGIN qImage_cw_Box, state, box, /get edge = box END 1: edge = qImage_cw_Wedge(state, box=box, wedge=wedge) ENDCASE ; The box represented by edge may extend (partly or entirely) beyond the visible ; part of the display for zoom > 1. We only need the part on the display. edge = qImage_cw_Transform(state, fromimage=edge, /toscreen, /boxedge) IF qImage_cw_BoxImage(state, edge, sub_img=sub_img, sub_box=sub_edge, /screen) THEN BEGIN sub_img = [reform(sub_edge,4),reform(sub_img,n_elements(sub_img))] widget_control, state.wid_draw, set_uvalue=sub_img, /no_copy ENDIF ; Now draw the box outline. Use back- or foreground color depending ; on the setting of the user value of the 'white box' button widget. IF smei_set THEN BEGIN plots, qImage_cw_Transform(state, fromimage=wedge, /toscreen), /device, color=color widget_control, state.wid_showfov, get_uvalue=set IF set THEN BEGIN qImage_cw_Box, state, /center, p_box=p_box edge = qImage_cw_Wedge(state, p_box, wedge=wedge, /noupdate) plots, qImage_cw_Transform(state, fromimage=wedge, /toscreen), /device, color=color, linestyle=1, thick=2 ENDIF ENDIF edge = qImage_cw_Transform(state, fromimage=box, /toscreen, /boxedge) nedge = 1L*(edge[2]-edge[0]+1)*(edge[3]-edge[1]+1) ; # pixels IF nedge GT zoom*zoom AND nedge LT !d.x_size*!d.y_size THEN BEGIN plots, [[edge[0:1]], [edge[[2,1]]], [edge[2:3]], [edge[[0,3]]], [edge[0:1]]], $ /device, color=color, linestyle=2*(smei_set OR ellipse) IF ellipse THEN BEGIN a = 2*findgen(181)/!radeg ca = cos(a) sa = sin(a) cntr = (edge[2:3]+edge[0:1])/2 axes = (edge[2:3]-edge[0:1])/2 plots, transpose( [[cntr[0]+axes[0]*ca], [cntr[1]+axes[1]*sa]] ),/device, color=color ENDIF xyouts, -1, -1, '0', /device, chars=1.5, color=color ;xyouts, edge[0], edge[1], '0', /device, chars=1.5, color=color ENDIF qImage_cw_DrawEphem, state, color=color wset, wold qImage_cw_Blowup, state ; Fill in the 'blowup' draw widget. qImage_cw_DrawCross, state ; Draw cross sections IF zupdate THEN qImage_cw_ZUpdate, state RETURN & END