📄 slicetool.m
字号:
else xlabel(objget(obj,'dataname',xdisp)); end % label the y axis if( length(ydisp)>1 ) ylabel('Multiple Curves'); else ylabel(objget(obj,'dataname',ydisp)); end set(hmsg,'string',objget(obj,'name')); end %see if we are in autoident mode if(strcmp(get(hautoident,'checked'),'on')) slicetool('autoident') end return;end% actions switchboardif( strcmp(action,'actions') ) hthisaction = gcbo; %unset all button functions set(gcf,'WindowButtonDownFcn',''); set(gcf,'WindowButtonmotionfcn',''); set(gcf,'WindowButtonUpFcn',''); h=get(gcf,'userdata'); haction=h(6); hmsg=h(11); flag = get(hthisaction,'userdata'); if( ~isempty(flag) ) flag=flag(1); end % uncheck previous action and check this one dat = get(haction,'userdata'); set(dat(dat(1)+1),'checked','off'); set(hthisaction,'checked','on'); if( size(dat(1))==size(flag) ) dat(1)=flag; end set(haction,'userdata',dat); % set the doit button if( ~isempty(flag) ) if( flag == 1) % a plot % enable the doit button set(h(1),'enable','on'); set(hmsg,'string','Push DOIT when ready to plot'); elseif( flag == 3 ) % an unzoom % enable the doit button set(h(1),'enable','on'); elseif( flag==2 ) % a zoom % zoom no longer works through 'actions' elseif( flag==4 ) % a pickslope % see which slopetool is active hslopetools=h(21); toolid=get(hslopetools,'userdata'); if(toolid==1) %simple slope display drawlineinit('slicetool(''buttonup'')'); set(hmsg,'string','MB1: draw slope'); elseif( toolid==2 ) %peters depth estimate hmsg=h(11); set(hmsg,'string','MB1: Select a zone of interest'); selboxinit('slicetool(''buttonup'')'); end % disable the doit button set(h(1),'enable','off'); elseif( flag == 5) % a polyfit % initial the selectionbox selboxinit('slicetool(''buttonup'')'); % enable the doit button set(h(1),'enable','on'); set(hmsg,'string',... 'MB1: draw fit range (default is entire curve) ... then DOIT'); elseif (flag == 6 | flag==9)% initiate the identify sequence % define the buttondown function set(gcf,'WindowButtonDownFcn','slicetool(''identify'')'); % define the buttonup function set(gcf,'WindowButtonUpFcn',''); % disable the doit button set(h(1),'enable','off'); set(hmsg,'string',... 'MB1: identify curve MB2: change text MB3: move text'); if( flag==9 ) slicetool('autoident'); end end end return;end% set the modeif( strcmp(action,'mode') ) h = get(gcf,'userdata'); hthismode = gcbo; hmode = h(10); dat = get(hmode,'userdata'); set(dat(dat(1)+1),'checked','off'); set(hthismode,'checked','on'); dat(1)=get(hthismode,'userdata'); set(hmode,'userdata',dat); % set the zoom state to unzoom haction = h(6); actdat=get(haction,'userdata'); hzoom=actdat(3); zinfo=get(hzoom,'userdata'); set(hzoom,'userdata',[zinfo(1)]); return;end% here is the doit button callback. This is basically a switchboardif( strcmp(action,'doit') ) h=get(gcf,'userdata'); % determine the action state haction = h(6); actdat = get(haction,'userdata'); flag = actdat(1); if( flag == 1 | flag == 2 ) % plot & zoom call the same thing set(gcf,'WindowButtonDownFcn',''); set(gcf,'WindowButtonmotionfcn',''); set(gcf,'WindowButtonUpFcn',''); slicetool('plot'); elseif (flag == 3) % an unzoom slicetool('unzoom'); elseif ( flag == 4) % pickslopes slicetool('pickslopes'); elseif( flag == 5) % polyfit slicetool('polyfit'); elseif( flag==7) % algebra slicetool('algebra3'); elseif( flag==10) % smooth slicetool('smooth3'); elseif( flag==11) % deriv slicetool('deriv3'); end % reset action to plot if(flag ~= 7) set(actdat(flag+1),'checked','off'); set(actdat(2),'checked','on'); actdat(1)=1; set(haction,'userdata',actdat); end return;end% set the x data or the y dataif( strcmp(action,'xdata') | strcmp(action,'ydata') )h = get(gcf,'userdata');hmsg=h(11);hautopro=h(22); if( strcmp(action,'xdata') ) hdata = h(7); else hdata = h(8); end % get the menu infor menuinfo = get(hdata,'userdata'); %get the menu that triggered this call hthismenu =gcbo; % get the options flag hdataopt = menuinfo(2+menuinfo(1)); flag = get(hdataopt,'userdata'); flag=flag(1); if( flag == 1) % check or uncheck it flag=get(hthismenu,'checked'); if( strcmp(flag,'on') ) set(hthismenu,'checked','off'); else set(hthismenu,'checked','on'); end elseif(flag == 2) % uncheck all selections for k=1:menuinfo(1) set(menuinfo(1+k),'checked','off'); end % check this one set(hthismenu,'checked','on'); end % build the data info flagvec = []; for k=1:menuinfo(1) thismenu = menuinfo(1+k); flag=get(thismenu,'checked'); if( strcmp(flag,'on') ) flagvec = [flagvec get(thismenu,'position')]; end end % set the information into the data userinformation menuinfo= [menuinfo(1:2+menuinfo(1)) flagvec]; set(hdata,'userdata',menuinfo); % set the transform store to zero slicetool('zerotranstore'); %set the action to plot unless we are in an auto-promote sequence %see if there is a command in hautopro to execute cmd=get(hautopro,'userdata'); if( isempty(cmd) ) haction=h(6); dat = get(haction,'userdata'); hplot=dat(2); %set(gcf,'currentmenu',hplot); slicetool('actions'); set(hmsg,'string','Push DOIT when ready for new plot'); endreturn;end% zero the transform & complex storage binsif(strcmp( action,'zerotranstore' ) ) h=get(gcf,'userdata'); htranstore=h(12); set(htranstore,'userdata',[]); slicetool('zerocmplxstore'); return;endif(strcmp( action,'zerocmplxstore' ) ) h=get(gcf,'userdata'); hstore=h(13); set(hstore,'userdata',[]); return;endif( strcmp(action,'quit') | strcmp(action,'quit2')) if(strcmp(action,'quit')) %put up a save first dialog yesnoinit('slicetool(''quit2'')','Save changes first?'); return; elseif(strcmp(action,'quit2')) reply=yesnofini; if(reply==1) slicetool('save'); elseif(reply==-1) return; end close(gcf); endend% set the dataoptionif( strcmp(action,'dataoption') ) h = get(gcf,'userdata'); hthisoption = gcbo; hdataopt = get(hthisoption,'parent'); dat = get(hdataopt,'userdata'); set(dat(dat(1)+1),'checked','off'); set(hthisoption,'checked','on'); dat(1)=get(hthisoption,'userdata'); set(hdataopt,'userdata',dat); return;end%% change the setting on a boolean flag menu item.%if( strcmp(action,'boolean') ) hthis = gcbo; % get the current flag setting flag = get(hthis,'checked'); % toggle it the other way if( strcmp(flag,'on') ) set(hthis,'checked','off'); else set(hthis,'checked','on'); end return;end% set any exclusive boolean option% the userdata of such an option is assumed to consist of% an integer flag (ignored by this action) followed by a list of % handles which are to have the opposite boolean setting% if the integer flag is negative, this signals special action:% 0) let h=userdata of the optionmenu% 1) the absolute value of h(1) is stored as user data in h(2)% 2) h(3)...h(length(h)) are set to the opposite settings of the option%if( strcmp(action,'exboolean') ) hflag = gcbo; flag=get(hflag,'checked'); list=get(hflag,'userdata'); if( length(list)>1 ) intflag=list(1); list=list(2:length(list)); else list=[]; end if( strcmp(flag,'on') ) set(hflag,'checked','off'); if( length(list)>0 ) if(intflag>0) for k=1:length(list) set(list(k),'checked','on'); end else d=get(list(1),'userdata'); if( isempty(d)) d=abs(intflag); else d(1) = abs(intflag); end set(list(1),'userdata',d); for k=2:length(list) set(list(k),'checked','on'); end end end else set(hflag,'checked','on'); if( length(list)>0 ) if(intflag>0) for k=1:length(list) set(list(k),'checked','off'); end else d=get(list(1),'userdata'); if( isempty(d)) d=abs(intflag); else d(1) = abs(intflag); end set(list(1),'userdata',d); for k=2:length(list) set(list(k),'checked','off'); end end end end return;end% set the complex data flagsif( strcmp(action,'complex') ) hthismenu=gcbo; hcomplex=get(hthismenu,'parent'); cdata=get(hcomplex,'userdata'); % uncheck the previous option set(cdata(cdata(1)+1),'checked','off'); % check this one set(hthismenu,'checked','on'); % update the user data in the hcomplex cdata(1)=get(hthismenu,'userdata'); set(hcomplex,'userdata',cdata); % set the complex storage bucket to zero h=get(gcf,'userdata'); hcmplxstore=h(13); set(hcmplxstore,'userdata',[]); return;end% process a button up eventif( strcmp(action,'buttonup') ) h=get(gcf,'userdata'); hdoit=h(1); % determine the action state haction = h(6); actdat=get(haction,'userdata'); state=actdat(1); if( state == 2 | state == 5) % a zoom or a polynomial fit set(gcf,'windowbuttonmotionfcn',''); box=selboxfini; xmin = min(box(1), box(3)); xmax = max(box(1), box(3)); ymin = min(box(2), box(4)); ymax = max(box(2), box(4)); hzoom=actdat(3); zinfo=get(hzoom,'userdata'); set(hzoom,'userdata',[zinfo(1),xmin,xmax,ymin,ymax,box(5)]); set(hdoit,'enable','on'); elseif (state == 4) % save slope info % determine which slope tool
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -