📄 gm_meshgui.m
字号:
function gm_meshgui(opcode, data)%% gm_mggui(opcode,data)%% Called by gm_meshgen to create a GUI for the quadtree/octree%% mesh generatorglobal GM_MESHGUI_HANDLEglobal GM_CANCEL_BUTTONif opcode == 0.0 % create GUI GM_MESHGUI_HANDLE = figure; set(GM_MESHGUI_HANDLE,'color',[0,1,1]); hold on; set(GM_MESHGUI_HANDLE, 'units', 'centimeters'); h1 = uicontrol('style','pushbutton', ... 'units','centimeters', ... 'position',[2.0,0,1.5,1.0], ... 'backgroundcolor', [1,1,0], ... 'string', 'Cancel', ... 'tag', 'CancelButton', ... 'callback', 'gm_meshgui(6)'); GM_CANCEL_BUTTON = 0; axis('off') plot(0,0,'.c') plot(5,5,'.c') h = text(0.5,4.9,'QMG 2.0 mesh generation in progress', ... 'fontsize', 14); set(h, 'tag', 'TitleText');elseif opcode == 1.0 % update GUI figure(GM_MESHGUI_HANDLE); h = findobj(GM_MESHGUI_HANDLE, 'tag', 'NumActiveBoxTag'); if length(h) > 0 delete(h); end h = text(0.5,4.5, sprintf('Number of active boxes = %d ', data(1))); set(h, 'tag', 'NumActiveBoxTag'); h = findobj(GM_MESHGUI_HANDLE, 'tag', 'NumFinishedBoxTag'); if length(h) > 0 delete(h) end h = text(0.5,4.0, sprintf('Number of finished boxes = %d ', data(2))); set(h, 'tag', 'NumFinishedBoxTag'); h = findobj(GM_MESHGUI_HANDLE, 'tag', 'NumVerticesTag'); if length(h) > 0 delete(h); end h = text(0.5,3.5, sprintf('Number of vertices = %d ', data(4))); set(h, 'tag', 'NumVerticesTag'); h = findobj(GM_MESHGUI_HANDLE, 'tag', 'NumSimplicesTag'); if length(h) > 0 delete(h); end h = text(0.5,3.0, sprintf('Number of simplices = %d ', data(3))); set(h, 'tag', 'NumSimplicesTag'); drawnowelseif opcode == 2 | opcode == 3 % Error has occurred or mg done; Terminate GUI: create dismiss button figure(GM_MESHGUI_HANDLE); h = findobj(GM_MESHGUI_HANDLE,'tag','DismissButton'); if length(h) == 0 h = findobj(GM_MESHGUI_HANDLE, 'tag', 'CancelButton'); if length(h) > 0 delete(h); end h = findobj(GM_MESHGUI_HANDLE, 'tag', 'TitleText'); if length(h) > 0 delete(h) end if opcode == 3 text(0.5, 4.9, 'QMG 2.0 mesh generation is complete', 'fontsize', 14); else text(0.5, 4.9, 'QMG 2.0 mesh generation error has occurred', 'fontsize', 14); end uicontrol('style','pushbutton','units', 'centimeters', 'position',[0,0,1.5,1.0], ... 'backgroundcolor',[1,1,0], ... 'string', 'Dismiss', 'callback', 'gm_meshgui(7)', ... 'tag', 'DismissButton'); set(GM_MESHGUI_HANDLE,'HandleVisibility','callback'); endelseif opcode == 4.0 % Update current operation figure(GM_MESHGUI_HANDLE); h = findobj(GM_MESHGUI_HANDLE, 'tag', 'Operation1'); if length(h) > 0 delete(h); end h = text(0.5, 1.5, data); set(h, 'tag', 'Operation1'); set(h, 'interpreter', 'none');elseif opcode == 5.0 % Update current operation2 figure(GM_MESHGUI_HANDLE); h = findobj(GM_MESHGUI_HANDLE, 'tag', 'Operation2'); if length(h) > 0 delete(h); end h = text(0.5, 1.0, data); set(h, 'tag', 'Operation2'); set(h, 'interpreter', 'none');elseif opcode == 6.0 % cancel button pressed GM_CANCEL_BUTTON = 1; disp('Cancel pressed 1');elseif opcode == 7.0 % called when dismiss button is pushed delete(gcf)else opcode error('Unknown opcode in gm_meshgui');end% ------------------------------------------------------------------% Copyright (c) 1999 by Cornell University. All rights reserved.% See the accompanying file 'Copyright' for authorship information,% the terms of the license governing this software, and disclaimers% concerning this software.% ------------------------------------------------------------------% This file is part of the QMG software. % Version 2.0 of QMG, release date September 3, 1999% ------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -