pro qSkyImage_ChangeCoordinates, state, event ;+ ; NAME: ; qSkyImage_ChangeCoordinates ; PURPOSE: ; Controls the units of the location and viewing directions. ; Units are either ecliptic or heliographic ; CATEGORY: ; Widgets: qSkyImage ; CALLING SEQUENCE: ; qSkyImage_ChangeCoordinates, state, event ; INPUTS: ; state array[1]; type: structure ; qSkyImage state structure ; event array[1]; type: structure ; event structure with event.id=state.wid_ecliptic or ; state.wid_heliographic ; OUTPUTS: ; (updates values of state.wid_loc and state.wid_dir) ; CALLS: ; CarringtonT, TimeSet, CvSky ; SIDE EFFECTS: ; RESTRICTIONS: ; PROCEDURE: ; The user value of state.wid_clabel stores the information about which coordinate system ; is currently in use: it stores the widget ID of state.wid_ecliptic of state.wid_heliographic ; If the event ID does not match this value and event.select=1 then the values ; of both time widgets are converted to the new units, and the user value of ; state.wid_clabel is updated accordingly. ; STATE INFO USED: ; widget_control, state.wid_clabel , get_uvalue=wid_unit ; widget_control, state.wid_loc[0] , get_value=loc_lng ; widget_control, state.wid_loc[1] , get_value=loc_lat ; widget_control, state.wid_dir[0] , get_value=dir_lng ; widget_control, state.wid_dir[1] , get_value=dir_lat ; widget_control, state.wid_earth[0] , get_value=earth_lng ; widget_control, state.wid_earth[1] , get_value=earth_lat ; widget_control, state.wid_tdisplay, get_value=tdisplay ; widget_control, state.wid_tlabel , get_uvalue=wid_tunit ; STATE INFO MODIFIED: ; widget_control, state.wid_loc[0] , set_value=loc[0,0] ; widget_control, state.wid_loc[1] , set_value=loc[1,0] ; widget_control, state.wid_dir[0] , set_value=loc[0,1] ; widget_control, state.wid_dir[1] , set_value=loc[1,1] ; widget_control, state.wid_clabel, set_uvalue=event.id ; widget_control, state.wid_earth[0] , set_value=loc[0,2] ; widget_control, state.wid_earth[1] , set_value=loc[0,2] ; MODIFICATION HISTORY: ; MAY-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- on_error, 2 ; On error, return to caller COMPILE_OPT hidden widget_control, event.id, set_button=event.select, set_uvalue=event.select if event.select then begin widget_control, state.wid_clabel , get_uvalue=wid_unit if wid_unit ne event.id then begin widget_control, state.wid_loc[0] , get_value=loc_lng widget_control, state.wid_loc[1] , get_value=loc_lat widget_control, state.wid_dir[0] , get_value=dir_lng widget_control, state.wid_dir[1] , get_value=dir_lat widget_control, state.wid_earth[0] , get_value=earth_lng widget_control, state.wid_earth[1] , get_value=earth_lat loc = [ [loc_lng, loc_lat], [dir_lng, dir_lat], [earth_lng, earth_lat] ] widget_control, state.wid_tdisplay, get_value=tdisplay widget_control, state.wid_tlabel , get_uvalue=wid_tunit case wid_tunit of state.wid_uttime : TT = TimeSet(tdisplay) state.wid_rotation: TT = Carrington(double(tdisplay)) endcase case event.id of state.wid_ecliptic : loc = CvSky(TT, from_heliographic=loc, /to_ecliptic, /degrees) state.wid_heliographic: loc = CvSky(TT, from_ecliptic=loc, /to_heliographic, /degrees) endcase widget_control, state.wid_loc[0] , set_value=loc[0,0] widget_control, state.wid_loc[1] , set_value=loc[1,0] widget_control, state.wid_dir[0] , set_value=loc[0,1] widget_control, state.wid_dir[1] , set_value=loc[1,1] widget_control, state.wid_earth[0] , set_value=loc[0,2] widget_control, state.wid_earth[1] , set_value=loc[1,2] widget_control, state.wid_clabel, set_uvalue=event.id endif endif return & end