📄 gui_mesh_plot.m
字号:
' facecolor = str2num(MESHPlot.p.mesh.plot.facecolor); ',...
' if and(isequal(size(facecolor,1),1),isequal(size(facecolor,2),3)), ',...
' set(MESHPlot.p.mesh.plot.Hpatch{MESHPlot.p.mesh.current},''FaceColor'',facecolor);',...
' else, ',...
' msg = sprintf(''FaceColor must be ''''none'''' or 1x3 element RGB values between 0-1\n'');',...
' warndlg(msg,''Mesh Plot Warning'');',...
' end; ',...
'end; ',...
'set(gcbf,''Userdata'',MESHPlot); clear facecolor MESHPlot;'));
% Face Transparency...
G.Tfacealpha = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
'Position',[.10 .65 .3 .05],...
'TooltipString','Face Transparency: 0 transparent, 1 opaque, 0-1 float',...
'String','Face Alpha:','HorizontalAlignment','left');
G.Efacealpha = uicontrol('Parent',GUI,'Style','edit',...
'Tag','p.mesh.plot.Hpatch.facealpha','Units','Normalized',Font, ...
'Position',[.50 .65 .4 .05],...
'String',sprintf('%2.1f',get(p.mesh.plot.Hpatch{p.mesh.current},'FaceAlpha')),...
'TooltipString','Face Transparency: 0 transparent, 1 opaque, 0-1 float',...
'Callback',strcat('MESHPlot = get(gcbf,''Userdata'');',...
'MESHPlot.p.mesh.plot.facealpha = get(MESHPlot.handles.Efacealpha,''String'');',...
'if MESHPlot.p.mesh.plot.facealpha, ',...
' facealpha = str2num(MESHPlot.p.mesh.plot.facealpha); ',...
' if isequal(size(facealpha),[1 1]), ',...
' set(MESHPlot.p.mesh.plot.Hpatch{MESHPlot.p.mesh.current},''FaceAlpha'',facealpha);',...
' else, ',...
' msg = sprintf(''FaceAlpha must be 1 element float values between 0-1\n'');',...
' warndlg(msg,''Mesh Plot Warning'');',...
' end; ',...
'else, ',...
' set(MESHPlot.p.mesh.plot.Hpatch{MESHPlot.p.mesh.current},''FaceAlpha'',1);',...
'end; ',...
'set(gcbf,''Userdata'',MESHPlot); clear facealpha MESHPlot;'));
% Provide some GUI callbacks to change lighting...
G.Flight = uicontrol('Parent',GUI,'Style','frame','Units','Normalized',Font, ...
'Position',[.04 .15 .92 .45],...
'TooltipString','Lighting Parameters',...
'HorizontalAlignment','left');
G.Tlight = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
'Position',[.06 .54 .45 .05],...
'TooltipString','Lighting Parameters',...
'String','Light','HorizontalAlignment','left');
G.Tambient = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
'Position',[.10 .45 .45 .05],...
'TooltipString','Ambient Strength: 0-1 values',...
'String','Ambient Strength:','HorizontalAlignment','left');
G.Eambient = uicontrol('Parent',GUI,'Style','edit',...
'Tag','p.mesh.plot.Hpatch.ambient','Units','Normalized',Font, ...
'Position',[.65 .45 .2 .05],...
'String',sprintf('%2.1f',get(p.mesh.plot.Hpatch{p.mesh.current},'AmbientStrength')),...
'TooltipString','Ambient Strength: 0-1 values',...
'Callback',strcat('MESHPlot = get(gcbf,''Userdata'');',...
'MESHPlot.p.mesh.plot.ambient = get(MESHPlot.handles.Eambient,''String'');',...
'set(MESHPlot.p.mesh.plot.Hpatch{MESHPlot.p.mesh.current},''AmbientStrength'',str2num(MESHPlot.p.mesh.plot.ambient));',...
'set(gcbf,''Userdata'',MESHPlot); clear MESHPlot;'));
G.Tdiffuse = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
'Position',[.10 .40 .45 .05],...
'TooltipString','Diffuse Strength: 0-1 values',...
'String','Diffuse Strength:','HorizontalAlignment','left');
G.Ediffuse = uicontrol('Parent',GUI,'Style','edit',...
'Tag','p.mesh.plot.Hpatch.diffuse','Units','Normalized',Font, ...
'Position',[.65 .40 .2 .05],...
'String',sprintf('%2.1f',get(p.mesh.plot.Hpatch{p.mesh.current},'DiffuseStrength')),...
'TooltipString','Diffuse Strength: 0-1 values',...
'Callback',strcat('MESHPlot = get(gcbf,''Userdata'');',...
'MESHPlot.p.mesh.plot.diffuse = get(MESHPlot.handles.Ediffuse,''String'');',...
'set(MESHPlot.p.mesh.plot.Hpatch{MESHPlot.p.mesh.current},''DiffuseStrength'',str2num(MESHPlot.p.mesh.plot.diffuse));',...
'set(gcbf,''Userdata'',MESHPlot); clear MESHPlot;'));
G.Tspecular = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
'Position',[.10 .35 .45 .05],...
'TooltipString','Specular Strength: 0-1 values',...
'String','Specular Strength:','HorizontalAlignment','left');
G.Especular = uicontrol('Parent',GUI,'Style','edit',...
'Tag','p.mesh.plot.Hpatch.specular','Units','Normalized',Font, ...
'Position',[.65 .35 .2 .05],...
'String',sprintf('%2.1f',get(p.mesh.plot.Hpatch{p.mesh.current},'SpecularStrength')),...
'TooltipString','Specular Strength: 0-1 values',...
'Callback',strcat('MESHPlot = get(gcbf,''Userdata'');',...
'MESHPlot.p.mesh.plot.specular = get(MESHPlot.handles.Especular,''String'');',...
'set(MESHPlot.p.mesh.plot.Hpatch{MESHPlot.p.mesh.current},''SpecularStrength'',str2num(MESHPlot.p.mesh.plot.specular));',...
'set(gcbf,''Userdata'',MESHPlot); clear MESHPlot;'));
G.Tspecexp = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
'Position',[.10 .30 .45 .05],...
'TooltipString','Specular Exponent',...
'String','Specular Exponent:','HorizontalAlignment','left');
G.Especexp = uicontrol('Parent',GUI,'Style','edit',...
'Tag','p.mesh.plot.Hpatch.specexp','Units','Normalized',Font, ...
'Position',[.65 .30 .2 .05],...
'String',sprintf('%d',get(p.mesh.plot.Hpatch{p.mesh.current},'SpecularExponent')),...
'TooltipString','Specular Exponent',...
'Callback',strcat('MESHPlot = get(gcbf,''Userdata'');',...
'MESHPlot.p.mesh.plot.specexp = get(MESHPlot.handles.Especexp,''String'');',...
'set(MESHPlot.p.mesh.plot.Hpatch{MESHPlot.p.mesh.current},''SpecularExponent'',str2num(MESHPlot.p.mesh.plot.specexp));',...
'set(gcbf,''Userdata'',MESHPlot); clear MESHPlot;'));
G.Tspeccolor = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ...
'Position',[.10 .20 .45 .08],...
'TooltipString','Specular Color Reflectance: 0-1 values',...
'String','Specular Color Reflectance:','HorizontalAlignment','left');
G.Especcolor = uicontrol('Parent',GUI,'Style','edit',...
'Tag','p.mesh.plot.Hpatch.speccolor','Units','Normalized',Font, ...
'Position',[.65 .21 .20 .07],...
'String',sprintf('%2.1f',get(p.mesh.plot.Hpatch{p.mesh.current},'SpecularColorReflectance')),...
'TooltipString','Specular Color Reflectance: 0-1 values',...
'Callback',strcat('MESHPlot = get(gcbf,''Userdata'');',...
'MESHPlot.p.mesh.plot.speccolor = get(MESHPlot.handles.Especcolor,''String'');',...
'set(MESHPlot.p.mesh.plot.Hpatch{MESHPlot.p.mesh.current},''SpecularColorReflectance'',str2num(MESHPlot.p.mesh.plot.speccolor));',...
'set(gcbf,''Userdata'',MESHPlot); clear MESHPlot;'));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Font.FontWeight = 'bold';
% RETURN, return file parameters
G.Breturn = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
'Position',[.05 .01 .275 .05],...
'String','RETURN','BusyAction','queue',...
'TooltipString','Return the plot parameters and close.',...
'BackgroundColor',[0.0 0.5 0.0],...
'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
'Callback',strcat('MESHPlot = get(gcbf,''Userdata'');',...
'p = gui_mesh_plot(MESHPlot.p,''return'');',...
'clear MESHPlot;'));
% CANCEL, return file parameters
G.Bcancel = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...
'Position',[.40 .01 .25 .05],...
'String','CLOSE','BusyAction','queue',...
'TooltipString','Close, do not return the plot parameters.',...
'BackgroundColor',[0.75 0.0 0.0],...
'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...
'Callback',strcat('MESHPlot = get(gcbf,''Userdata'');',...
'MESHPlot.p = gui_mesh_plot(MESHPlot.p,''close'');',...
'clear MESHPlot;'));
% Hold GUI Open checkbox
G.Bhold = uicontrol('Parent',GUI,'Style','checkbox','Units','Normalized', Font, ...
'Position',[.70 .01 .25 .05],'String','Hold','BusyAction','queue',...
'TooltipString','MESH Plot GUI remains open after ''Return'' commands.',...
'Value',p.hold,'HorizontalAlignment', 'center');
% Store userdata
if exist('parent','var'), MESHPlot.parent.gui = parent; end
MESHPlot.handles = G;
MESHPlot.p = p;
set(GUI,'Userdata',MESHPlot);
figure(MESHPlot.gui);
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -