?? vis_show_gui_tool.m
字號:
function r=vis_show_gui_tool(h,action,varargin)%VIS_SHOW_GUI_TOOL is a subfunction of SOM_SHOW_GUI.%% r = vis_show_gui_tool(handle, action, varargin)%% Input arguments:% handle (struct) % action (string)% varargin (varies)% % See also SOM_SHOW_GUI.% Copyright (c) 2000 by Roman Feldman and Juha Vesanto% Contributed to SOM Toolbox on August 22nd, 2000% http://www.cis.hut.fi/projects/somtoolbox/ % Version 2.0beta roman 160800 juuso 220800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%if ishandle(h(1)), udata = get(h(1),'UserData'); if isfield(udata,'plot_array'), plot_array = udata.plot_array; if isfield(udata,'vis_h') % get most recent plotted children = get(0,'children'); % first refresh plot info udata.vis_h = setdiff(udata.vis_h,setdiff(udata.vis_h,children)); set(h(1),'userdata',udata); for i=1:length(children), if any(children(i)==udata.vis_h), child = children(i); [handles,msg,lattice,msize,dim]=vis_som_show_data('all',children(i)); break; elseif i==length(children), errordlg({'Plot not found', ... 'Try to visualize first'},'Error in SOM_VIS: tools'); return; end end else errordlg({'Plot not found', ... 'Try to visualize first'},'Error in SOM_VIS: tools'); return; end endend%--- color vars --- fig_color = [0.8 0.8 0.8]; bg_color1 = [0.701960784313725 0.701960784313725 0.701960784313725]; bg_color2 = [0.9 0.9 0.9];%--- object position vars (in pixels) --- % calculations based on case 'comp' %% hint text hint_dist1 = 98.17-(61.27+36.9); % hint text lower edge and next lower frame upper edge hint_dist2 = 123-(98.17+18.45); % figure upper edge and hint text upper edge %% general dist1 = 67.42-61.27; % general distance between frame edge and object in frame %% frame + ok / cancel frames_dist = 61.27-(8.38+36.9); frames_dist2 = 8.38; f_fr = [7.9 8.38 216.2 36.9]; % final frame ok_pb = [17.1 15.76 75.9 22.14]; cancel_pb = [139 15.76 75.9 22.14]; %% objects hint_txt = [460 18.45]; % hint text width and height interp_cb = [98.9 24.6]; title_txt = [90 hint_txt(2)-3]; title_edit_h = 23.083; var_pop = [interp_cb(1) ok_pb(4)]; list_lt = [130 130]; calc_txt = [list_lt(1) hint_txt(2)]; selvar_pb = [110 ok_pb(4)]; strd_ed = [var_pop(1) title_edit_h]; radio_rb = selvar_pb; %%%%%%%%%%%% add_label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%if strcmp(action,'add_label') old_fig_n = watchon; W = 345.4; H = 222.769; o21 = zeros(1,4); o21(1) = (W-f_fr(3))/2; f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14]; hint_txt = [W 18.45]; % hint text width and height units = get(h,'units'); set(h,'units','pixels'); fp = get(h,'Position'); fig_pos = [(fp(1)+fp(3)) ... (fp(2)+fp(2)+fp(4)/2-H/2) ... W ... H]; o1 = sum(f_fr([2 4]))+frames_dist; o2 = 4*dist1+2*max([title_edit_h,title_txt(2)]) ... +max([title_txt(2),var_pop(2)]); o6 = max([title_txt(2),var_pop(2)]); o7 = max([title_txt(2),title_edit_h]); o8 = max([title_txt(2),title_edit_h,selvar_pb(2)]); o3 = o1+0.5*o6+dist1-title_txt(2)/2; o4 = o1+0.5*o6+dist1-var_pop(2)/2; o5 = ok_pb(1)+title_txt(1); o9 = o1+o6+0.5*o7+2*dist1-title_txt(2)/2; o10 = o1+o6+0.5*o7+2*dist1-title_edit_h/2;; o11 = o1+o6+o7+0.5*o8+3*dist1-title_txt(2)/2; o12 = o1+o6+o7+0.5*o8+3*dist1-title_edit_h/2; o13 = o1+o6+o7+0.5*o8+3*dist1-selvar_pb(2)/2; o15 = o1+o2+frames_dist2; o16 = 2*dist1+o7; o17 = o5+strd_ed(1)+2*dist1; % W-ok_pb(1)-selvar_pb(1); o18 = o15+0.5*o7+dist1-title_txt(2)/2; o19 = o15+0.5*o7+dist1-title_edit_h/2; o20 = o15+o16+hint_dist1; hint_text_pos = [1 o20 hint_txt]; frame1_pos = [f_fr(1) o15 f_fr(3) o16]; subplots_text_pos = [ok_pb(1) o18 title_txt]; subplots_pos = [o5 o19 strd_ed]; frame2_pos = [f_fr(1) o1 f_fr(3) o2]; labels_text_pos = [ok_pb(1) o11 title_txt]; labels_pos = [o5 o12 strd_ed]; sel_var_pos = [o17 o13 selvar_pb]; text_size_text_pos = [ok_pb(1) o9 title_txt]; text_size_pos = [o5 o10 strd_ed]; text_color_text_pos = [ok_pb(1) o3 title_txt]; text_color_pos = [o5 o4 var_pop]; f_fr = [7.9 8.38 216.2 36.9]; % final frame cancel_pb = [139 15.76 75.9 22.14]; frame3_pos = f_fr+o21; ok_pos = ok_pb+o21; cancel_pos = cancel_pb+o21; fig_h = figure( ... 'Units','pixels', ... 'Position', fig_pos, ... 'Color',fig_color, ... 'NumberTitle','off', ... 'Name','add label', ... 'MenuBar','none', ... 'Visible','off'); set( ... uicontrol( ... %% hint 'Units','pixels', ... 'BackgroundColor',fig_color, ... 'HorizontalAlignment','center', ... 'Position',hint_text_pos, ... 'String','Options for adding labels', ... 'Style','text'),'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame1_pos, ... 'Style','frame'),'units','normalized'); set( ... uicontrol( ... %% To subplot(s) 'Units','pixels', ... 'Position',subplots_text_pos, ... 'HorizontalAlignment','left', ... 'String','To subplot(s)', ... 'Style','text'),'units','normalized'); ed1_h = uicontrol( ... %% [edit] 'Units','pixels', ... 'BackgroundColor',bg_color2, ... 'Position',subplots_pos, ... 'FontSize',12, ... 'Style','edit'); set(ed1_h,'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame2_pos, ... 'Style','frame'),'units','normalized'); set( ... uicontrol( ... %% Labels 'Units','pixels', ... 'Position',labels_text_pos, ... 'HorizontalAlignment','left', ... 'String','Labels', ... 'Style','text'),'units','normalized'); ed2_h = uicontrol( ... %% [edit] 'Units','pixels', ... 'BackgroundColor',bg_color2, ... 'Position',labels_pos, ... 'FontSize',12, ... 'Style','edit'); set(ed2_h,'units','normalized'); s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... 'vis_show_gui_tool(tmp(2),''select'')']; set( ... uicontrol( ... %% Select variable 'Units','pixels', ... 'Position',sel_var_pos, ... 'String','Select variable', ... 'Callback',s),'units','normalized'); set( ... uicontrol( ... %% Text size 'Units','pixels', ... 'Position',text_size_text_pos, ... 'HorizontalAlignment','left', ... 'String','Text size', ... 'Style','text'),'units','normalized'); ed3_h = uicontrol( ... %% [edit] 'Units','pixels', ... 'BackgroundColor',bg_color2, ... 'Position',text_size_pos, ... 'String','10', ... 'FontSize',12, ... 'Style','edit'); set(ed3_h,'units','normalized'); set( ... uicontrol( ... %% Text color 'Units','pixels', ... 'Position',text_color_text_pos, ... 'HorizontalAlignment','left', ... 'String','Text color', ... 'Style','text'),'units','normalized'); ud = {'k' 'w' 'y' 'm' 'c' 'r' 'g' 'b' 'xor' 'none'}; s = {'black' 'white' 'yellow' 'magenta' 'cyan' 'red' 'green' ... 'blue' 'xor' 'none'}; p_h = uicontrol( ... %% [popupmenu] 'Units','pixels', ... 'Position',text_color_pos, ... 'UserData',ud, ... 'String',s, ... 'Style','popupmenu'); set(p_h,'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame3_pos, ... 'Style','frame'),'units','normalized'); s = ['vis_show_gui_tool(' mat2str(h) ',''label'',' mat2str(fig_h) ')']; set( ... uicontrol( ... %% OK 'Units','pixels', ... 'Position',ok_pos, ... 'String','OK', ... 'Callback',s),'units','normalized'); set( ... uicontrol( ... %% Cancel 'Units','pixels', ... 'Position',cancel_pos, ... 'String','Cancel', ... 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); watchoff(old_fig_n); ud = [ed1_h ed2_h ed3_h p_h]; set(fig_h,'units','normalized', ... 'Visible','on', ... 'UserData',ud, ... 'handlevisibility','off'); %%%%%%%%%% add_hit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%elseif strcmp(action,'add_hit') old_fig_n = watchon; W = 424.3; H = 337.642; o37 = zeros(1,4); o37(1) = (W-f_fr(3))/2; f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14]; hint_txt = [W 18.45]; % hint text width and height units = get(h,'units'); set(h,'units','pixels'); fp = get(h,'Position'); fig_pos = [(fp(1)+fp(3)) ... (fp(2)+fp(2)+fp(4)/2-H/2) ... W ... H]; o1 = sum(f_fr([2 4]))+frames_dist; o2 = o1+dist1; o6 = max([title_txt(2),var_pop(2)]); o7 = max([title_txt(2),title_edit_h]); o8 = max([title_txt(2),title_edit_h,var_pop(2)]); o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]); o3 = o8+o6+3*dist1; o4 = o1+0.5*o8+dist1-title_txt(2)/2; o5 = o1+0.5*o8+dist1-var_pop(2)/2; o9 = o1+0.5*o8+dist1-title_edit_h/2; o21 = o1+o8+0.5*o6+2*dist1-title_txt(2)/2; o22 = o1+o8+0.5*o6+2*dist1-var_pop(2)/2; o20 = ok_pb(1)+title_txt(1); o10 = o20+var_pop(1)+2*dist1; o11 = o10+title_txt(1); o12 = o2+o8+dist1+0.5*o6-title_txt(2)/2; o13 = o2+o8+dist1+0.5*o6-var_pop(2)/2; o14 = o1+o3+frames_dist2; o15 = 2*o6+o8+4*dist1; o16 = o14+dist1+0.5*o6-title_txt(2)/2; o17 = o14+dist1+0.5*o6-var_pop(2)/2; o18 = o14+o6+2*dist1+0.5*o8-title_txt(2)/2; o19 = o14+o6+2*dist1+0.5*o8-title_edit_h/2; o23 = o14+o6+2*dist1+0.5*o8-var_pop(2)/2; o24 = o14+o6+3*dist1+o8+0.5*o6-title_txt(2)/2; o25 = o14+o6+3*dist1+o8+0.5*o6-var_pop(2)/2; o26 = o14+o15+frames_dist2; o27 = o8+2*dist1; o28 = o26+dist1+0.5*o38-title_txt(2)/2; o29 = o26+dist1+0.5*o38-title_edit_h/2; o30 = o26+dist1+0.5*o38-selvar_pb(2)/2; o31 = o10; %W-(ok_pb(1)+selvar_pb(1)); o32 = o26+o27+frames_dist2; o33 = o7+2*dist1; o34 = o32+dist1+0.5*o7-title_txt(2)/2; o35 = o32+dist1+0.5*o7-title_edit_h/2; o36 = o32+o33+hint_dist1; hint_text_pos = [1 o36 hint_txt]; frame1_pos = [f_fr(1) o32 f_fr(3) o33]; subplots_text_pos = [ok_pb(1) o34 title_txt]; subplots_pos = [o20 o35 strd_ed]; frame2_pos = [f_fr(1) o26 f_fr(3) o27]; trace_vect_text_pos = [ok_pb(1) o28 title_txt]; trace_vect_pos = [o20 o29 strd_ed]; sel_vect_pos = [o31 o30 selvar_pb]; frame3_pos = [f_fr(1) o14 f_fr(3) o15]; marker_text_pos = [ok_pb(1) o24 title_txt]; marker_pos = [o20 o25 var_pop]; marker_size_text_pos = [ok_pb(1) o18 title_txt]; marker_size_pos = [o20 o19 strd_ed]; size_fact_text_pos = [o10 o18 title_txt]; size_fact_pos = [o11 o23 var_pop]; marker_color_text_pos = [ok_pb(1) o16 title_txt]; marker_color_pos = [o20 o17 var_pop]; edge_color_text_pos = [o10 o16 title_txt]; edge_color_pos = [o11 o17 var_pop]; frame4_pos = [f_fr(1) o1 f_fr(3) o3]; text_text_pos = [ok_pb(1) o21 title_txt]; text_pos = [o20 o22 var_pop]; text_color_text_pos = [ok_pb(1) o4 title_txt]; text_color_pos = [o20 o5 var_pop]; text_size_text_pos = [o10 o4 title_txt]; text_size_pos = [o11 o9 strd_ed]; f_fr = [7.9 8.38 216.2 36.9]; % final frame cancel_pb = [139 15.76 75.9 22.14]; frame5_pos = f_fr+o37; ok_pos = ok_pb+o37; cancel_pos = cancel_pb+o37; fig_h = figure( ... 'Units','pixels', ... 'Position', fig_pos, ... 'Color',fig_color, ... 'NumberTitle','off', ... 'Name','add hit histogram', ... 'MenuBar','none', ... 'Visible','off'); set( ... uicontrol( ... %% hint 'Units','pixels', ... 'BackgroundColor',fig_color, ... 'HorizontalAlignment','center', ... 'Position',hint_text_pos, ... 'String','Options for adding hit histogram', ... 'Style','text'),'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame1_pos, ... 'Style','frame'),'units','normalized'); set( ... uicontrol( ... %% To subplot(s) 'Units','pixels', ... 'Position',subplots_text_pos, ... 'HorizontalAlignment','left', ... 'String','To subplot(s)', ... 'Style','text'),'units','normalized'); ed1_h = uicontrol( ... %% [edit] 'Units','pixels', ... 'BackgroundColor',bg_color2, ... 'Position',subplots_pos, ... 'FontSize',12, ... 'Style','edit'); set(ed1_h,'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame2_pos, ... 'Style','frame'),'units','normalized');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -