⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dellog.m

📁 基于matlab的反演程序,用于地球物理勘探中射线追踪及偏移成像程序.
💻 M
字号:
function dellog(action,transfer,hmasterfig,lognames)

% dellog(action,transfer,hmasterfig,lognames)
%
% DELLOG is called by LOGEDIT to initiate a dialog to delete logs from
% the active LAS file
%
% action ... should be the string 'init' when called from logedit
% transfer ... transfer command to be called when the user pushes the delete
%              button. Usually this will be the string 'logedit(''dellog2'','.
%              When a log is selected for deletion, dellog will append its 
%              name to this as a second argument and call is with eval.
%              Thus if the log to be deleted has its name stored in the
%              string variable: name, then the eval statement will be:
%	eval([transfer name ');'])
% hmasterfig ... handle of the masterfigure (usually a LOGEDIT window) in
%		control of the dialog
% lognames ... list of names of logs with individual names separated by '|' 
%		such as: 'fred|sam|billy|wilma'
%
% G.F. Margrave Jan 1996
%
% NOTE: It is illegal for you to use this software for a purpose other
% than non-profit education or research UNLESS you are employed by a CREWES
% Project sponsor. By using this software, you are agreeing to the terms
% detailed in this software's Matlab source file.
 
% BEGIN TERMS OF USE LICENSE
%
% This SOFTWARE is maintained by the CREWES Project at the Department
% of Geology and Geophysics of the University of Calgary, Calgary,
% Alberta, Canada.  The copyright and ownership is jointly held by 
% its author (identified above) and the CREWES Project.  The CREWES 
% project may be contacted via email at:  crewesinfo@crewes.org
% 
% The term 'SOFTWARE' refers to the Matlab source code, translations to
% any other computer language, or object code
%
% Terms of use of this SOFTWARE
%
% 1) Use of this SOFTWARE by any for-profit commercial organization is
%    expressly forbidden unless said organization is a CREWES Project
%    Sponsor.
%
% 2) A CREWES Project sponsor may use this SOFTWARE under the terms of the 
%    CREWES Project Sponsorship agreement.
%
% 3) A student or employee of a non-profit educational institution may 
%    use this SOFTWARE subject to the following terms and conditions:
%    - this SOFTWARE is for teaching or research purposes only.
%    - this SOFTWARE may be distributed to other students or researchers 
%      provided that these license terms are included.
%    - reselling the SOFTWARE, or including it or any portion of it, in any
%      software that will be resold is expressly forbidden.
%    - transfering the SOFTWARE in any form to a commercial firm or any 
%      other for-profit organization is expressly forbidden.
%
% END TERMS OF USE LICENSE

if( strcmp(action,'init'))

	fgkol=[0 0 0];
	bgkol=[0 1 1];

	%make a new figure
	hfig=figure('visible','off','menubar','none','numbertitle','off','name','Delete Log Dialog');

	pos=get(hfig,'position');

	height=20;
	figheight=5.5*height;
	
	figwidth=302;
	sep=1;
	xnow=sep;
	ynow=figheight-height-sep;
	width=figwidth - 2*sep;
	htitle=uicontrol('style','text','position',[xnow,ynow,width,height],'string',...
		'Select Log(s) for Deletion',...
		'foregroundcolor','r');

	xnow=sep;
	ynow=ynow-2*height-sep;
	msg='WARNING: No UNDO is available. Be sure before pushing delete button.';
	
	hmsg=uicontrol('style','text','position',[xnow,ynow,width,2*height],'string',...
		msg);

	xnow=sep;
	ynow=ynow-height-sep;
	width=150;
	hloglbl=uicontrol('style','text','string','Log to be deleted -->','position',...
		[xnow,ynow,width,height]);

	xnow=xnow+width+sep;
	width=150;
	hlog=uicontrol('style','popupmenu','string',lognames,'position',...
		[xnow,ynow,width,height],...
		'value',1,'backgroundcolor',bgkol,'foregroundcolor',fgkol,...
		'callback','dellog(''setlog'')');
		
	%the buttons
	xnow=sep;
	ynow=ynow-height-sep-sep-sep;
	width=150;
	% the done button is enabled when the mode is switched to compute
	iii=find(lognames=='|');
	if(~isempty(iii))
	    delstring = ['Delete ' lognames(1:iii(1)-1)];
	else
	    delstring = ['Delete ' lognames(1,:)];
	end
	hdelete=uicontrol('style','pushbutton','string',delstring,'position',...
		[xnow,ynow,width,height],'callback','dellog(''delete'');',...
		'userdata',transfer,'enable','on',...
		'backgroundcolor','r','foregroundcolor','y');

	xnow=xnow+width+sep;
 	width=150;
	hcancel=uicontrol('style','pushbutton','string','Done','position',...
		[xnow,ynow,width,height],'callback','dellog(''cancel'');',...
		'backgroundcolor',bgkol,'foregroundcolor',fgkol);

	set(hfig,'userdata',[hmasterfig, htitle, hmsg, hlog, hdelete, hcancel]);
				
	set(hfig,'position',[pos(1:2) figwidth figheight]);
	set(hfig,'visible','on');

	return;

end

%
% handle the delete button
%
if(strcmp(action,'delete'))
	h=get(gcf,'userdata');	
	hmasterfig=h(1);
	hmsg=h(3);
	hlog=h(4);
	hdelete=h(5);
	
	hax=get(hmasterfig,'currentaxes');
	
	%get the name to delete log
	ilog=get(hlog,'value');
	lognames=get(hlog,'string');
	
	deadname= strunpad(lognames(ilog,:));
	
	
	%call the transfer function
	transfer=get(hdelete,'userdata');
	figure(hmasterfig);
	eval([transfer '''' deadname '''' ');']);
	
	set(hmsg,'string',['Log ' deadname ' toasted']);
	
	lognames(ilog,:)=[];
	set(hlog,'string',lognames,'value',size(lognames,1));
	dellog('setlog');
	 
	return;
end

% 
% do a cancel
% 
if(strcmp(action,'cancel'))
	h=get(gcf,'userdata');
	hmasterfig=h(1);
	hdelete=h(5);
	transfer=get(hdelete,'userdata');
	figure(hmasterfig);
	eval([transfer '[]);']);
	
	return;
	
end

%
% handle the setlog callback
%
if(strcmp(action,'setlog'))
	h=get(gcf,'userdata');	
	hmasterfig=h(1);
	hmsg=h(3);
	hlog=h(4);
	hdelete=h(5);
	
	hax=get(hmasterfig,'currentaxes');
	
	%get the name to delete log
	ilog=get(hlog,'value');
	lognames=get(hlog,'string');
	
	if( ~isempty(lognames) )
		deadname= lognames(ilog,:);
	else
		dellog('cancel');
		return;
	end
	
	%change the string on the delete button
	set(hdelete,'string',['Delete ' deadname]);
	
	return;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -