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

📄 meshc_buttons.m

📁 matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译
💻 M
字号:
function tit=meshc_buttons(tit)
%MESH_BUTTONS Inizialize the surface uicontrols

%
% Copyright (c) 1995 by Claudio Rivetti and Mark Young
% claudio@alice.uoregon.edu,    mark@alice.uoregon.edu
%

global rb ContourLines Handlefig B_frame deg_ed  plane_ed deg_txt LineSpace PlaneSpace mstyle msm msmvalue edgecolor edgem edgevalue facecolor facem facevalue

if isempty(msmvalue)
  msmvalue=1;
end
if isempty(edgevalue)
  edgevalue=2;
end
if isempty(facevalue)
  facevalue=3;
end
if strcmp(tit, 'Mesh Plot')
  edgevalue=2;
  facevalue=1;
end

mstyle=['both  ';'row   ';'column'];
edgecolor=str2mat('none', 'flat', 'interp', 'single');
facecolor=str2mat('none', 'flat', 'interp', 'texturemap', 'single');

if isempty(PlaneSpace)
  PlaneSpace=0;
end


% Position variables---------------------------------------------------
pos=get(B_frame, 'Position');
uiwidth=0.10;
uithick=0.035;
middle=pos(1)+(pos(3)-uiwidth)/2;
%---------------------------------------------------------------------


wd1='v=findobj(''label'', ''View '');ch=get(v, ''child'');set(ch, ''checked'', ''off'');';
wd2='set(ch(length(ch)), ''checked'', ''on'');showimage;';
whendone=[wd1 wd2];

gvar='';
deg_ed_cbk=[gvar 'editstr2value(deg_ed, 1, 5);LineSpace=get(deg_ed, ''value'');showimage;'];
plane_ed_cbk=[gvar 'editstr2value(plane_ed, 0, inf);PlaneSpace=get(plane_ed, ''value'');showimage;'];

% Positions of buttons -----------------------------------------------------

deg_txt_pos=[pos(1)+(pos(3)-0.18)/2 , pos(2)+0.73, 0.18, uithick]; 
deg_ed_pos=[middle, pos(2)+0.73-uithick, uiwidth, uithick]; 
plane_txt_pos=[pos(1)+(pos(3)-0.18)/2 , pos(2)+0.65, 0.18, uithick]; 
plane_ed_pos=[middle, pos(2)+0.65-uithick, uiwidth, uithick]; 

msm_txt_pos=[pos(1)+(pos(3)-0.18)/2 , pos(2)+0.55, 0.18, uithick]; 
msm_pos=[middle, pos(2)+0.55-0.025, uiwidth, 0.03];
edge_txt_pos=[pos(1)+(pos(3)-0.18)/2 , pos(2)+0.47, 0.18, uithick]; 
edgem_pos=[middle, pos(2)+0.47-0.025, uiwidth, 0.03];
face_txt_pos=[pos(1)+(pos(3)-0.18)/2 , pos(2)+0.39, 0.18, uithick]; 
facem_pos=[middle, pos(2)+0.39-0.025, uiwidth, 0.03];

rb_txt_pos=[pos(1)+(pos(3)-0.18)/2 , pos(2)+0.3, 0.18, uithick]; 
rbpos=[middle, pos(2)+0.3-0.035, uiwidth, 0.03];
pos=rbpos;
%---------------------------------------------------------------------------

	bg = [0.55 0.55 0.55];
	initbuttons(tit, 'Done', whendone);

	deg_txt=uicontrol(Handlefig, 'Style', 'text',...
		'String', 'Line Spacing',...
		'Units', 'normalized',...
		'Position', deg_txt_pos,...
		'BackgroundColor', bg,...
		'Visible', 'on',...
		'HorizontalAlignment', 'center'); 

	deg_ed  = uicontrol(Handlefig, 'Style', 'edit',...
		'String', num2str(LineSpace),...
		'Units', 'normalized',...
		'Position', deg_ed_pos,...
		'Visible', 'on',...
		'Value', LineSpace,...
		'HorizontalAlignment', 'center',...
		'CallBack', deg_ed_cbk);


	plane_txt=uicontrol(Handlefig, 'Style', 'text',...
		'String', 'Plane Offset',...
		'Units', 'normalized',...
		'Position', plane_txt_pos,...
		'BackgroundColor', bg,...
		'Visible', 'on',...
		'HorizontalAlignment', 'center'); 

	plane_ed  = uicontrol(Handlefig, 'Style', 'edit',...
		'String', num2str(PlaneSpace),...
		'Units', 'normalized',...
		'Position', plane_ed_pos,...
		'Visible', 'on',...
		'Value', PlaneSpace,...
		'HorizontalAlignment', 'center',...
		'CallBack', plane_ed_cbk);


	  msm_txt=uicontrol(Handlefig, 'Style', 'text',...
		'String', 'Mesh Style',...
		'Units', 'normalized',...
		'Position', msm_txt_pos,...
		'BackgroundColor', bg,...
		'Visible', 'on',...
		'HorizontalAlignment', 'center'); 
  

     
       
	msm=uicontrol(Handlefig, 'Style', 'popup',...
		'String', ' Both | Rows | Cols ',...
		'Units', 'Normalized',...
		'Position', msm_pos,...
		'HorizontalAlignment', 'left',...
		'Call', [gvar 'msmvalue=get(msm, ''value'');set(msm, ''userdata'', mstyle(get(msm, ''value''), :));showimage'],...
		'Value', msmvalue, ...
		'Userdata', mstyle(msmvalue,:));
		
		
		
	edge_txt=uicontrol(Handlefig, 'Style', 'text',...
		'String', 'Edge Color',...
		'Units', 'normalized',...
		'Position', edge_txt_pos,...
		'BackgroundColor', bg,...
		'Visible', 'on',...
		'HorizontalAlignment', 'center'); 
		
		
	
	
	edgem=uicontrol(Handlefig, 'Style', 'popup',...
		'String', 'None |Flat |Interp |Single ',...
		'Units', 'Normalized',...
		'Position', edgem_pos,...
		'HorizontalAlignment', 'left',...
		'Call', [gvar 'edgevalue=get(edgem, ''value'');set(edgem, ''userdata'', edgecolor(get(edgem, ''value''), :));showimage'],...
		'Value', edgevalue, ...
		'Userdata', edgecolor(edgevalue,:));
		
		
	
	face_txt=uicontrol(Handlefig,...
		'Style', 'text',...
		'String', 'Face Color',...
		'Units', 'normalized',...
		'Position', face_txt_pos,...
		'BackgroundColor', bg,...
		'Visible', 'on',...
		'HorizontalAlignment', 'center'); 
	
	facem=uicontrol(Handlefig,...
		'Style', 'popup',...
		'String', 'None |Flat |Interp |Texmap |Single ',...
		'Units', 'Normalized',...
		'Position', facem_pos,...
		'HorizontalAlignment', 'left',...
		'Call', [gvar 'facevalue=get(facem, ''value'');set(facem, ''userdata'', facecolor(get(facem, ''value''), :));showimage'],...
		'Value', facevalue, ...
		'Userdata', facecolor(facevalue,:));



    if strcmp(tit, 'Mesh/Contour Plot') == 1
		rb_txt=uicontrol(Handlefig, 'Style', 'text',...
			'String', 'Contour Lines',...
			'Units', 'normalized',...
			'Position', rb_txt_pos,...
			'BackgroundColor', bg,...
			'Visible', 'on',...
			'HorizontalAlignment', 'center'); 
  

		rb=zeros(length(ContourLines),1);
		for i=1:length(ContourLines)
			pos(2)=rbpos(2)-0.03*(i-1);
			rb(i)=uicontrol(Handlefig, 'Style', 'radio',...
			'String', '-----',...
			'Units', 'Normalized',...
			'Fore', get(ContourLines(i), 'color'),...
			'Position', pos,...
			'HorizontalAlignment', 'left',...
			'Call', [gvar 'set(ContourLines(' num2str(i) '), ''visible'', onoff(get(rb(' num2str(i) '), ''value'')))'],...
			'Value', 1);
        end
	end

return

⌨️ 快捷键说明

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