kriging3dfig.m

来自「Kriging插值matlab toolbox」· M 代码 · 共 817 行 · 第 1/2 页

M
817
字号
function fig = kriging3dfig()
%% function fig = kriging3dfig() establishes a GUI configuration for task Krig, 
%% it opens the kriging window
%%
%%  Kriging Software Package  version 3.0,   May 1, 2004
%%  Copyright (c) 1999, 2001, 2004, property of Dezhang Chu and Woods Hole Oceanographic
%%  Institution.  All Rights Reserved.

global hdl data para color

grey=color.grey;
dark_grey=color.dark_grey;
blue=color.blue;

if ~isempty(findobj('type','figure','Tag','Kriging')) 
  figure(hdl.krig.h0);
  if isfield(para.dataprep,'fileID')
    set(hdl.krig.fileID,'string',para.dataprep.fileID);
  end
  return
end

hdl.krig.h0= figure('Units','normalized', ...
	'Color',color.background, ...
	'Name','Kriging Configuration', ...
	'Tag','Kriging', ...
	'Position',hdl.window_position,'NumberTitle','off');
      set(0, 'showhidden', 'on')
      ch=get(gcf, 'children');
%	delete(ch(1))								%Help
   wmhdl=findobj(ch,'Label','&Help');		
   delete(wmhdl);
   ch(find(ch == wmhdl))=[];
%	delete(ch(3))								%Tools
   wmhdl=findobj(ch,'Label','&Tools');		
   delete(wmhdl);
   ch(find(ch == wmhdl))=[];
%     new feature in V6.x delete(ch(6))			%Edit
   wmhdl=findobj(ch,'Label','&Edit');		
   delete(wmhdl);
   ch(find(ch == wmhdl))=[];
%      new feature in V6.x                      %insert
   wmhdl=findobj(ch,'Label','&Insert');		
   if ~isempty(wmhdl)
     delete(wmhdl);
     ch(find(ch == wmhdl))=[];
   end
%      new feature in V6.x                      %View
   wmhdl=findobj(ch,'Label','&View');		
   if ~isempty(wmhdl)
     delete(wmhdl);
     ch(find(ch == wmhdl))=[];
   end
%      new feature of V7.0                      
   wmhdl=findobj(ch,'Label','&Desktop');	    %Desktop
   if ~isempty(wmhdl)
     delete(wmhdl);
     ch(find(ch == wmhdl))=[];
   end
Filehdl=findobj(ch,'Label','&File');
ch_file=get(Filehdl,'children');
%% ch_file   1  '&Print...'
%            2  'Print Pre&view...'
%            3  'Print Set&up...'
%            4  'Pa&ge Setup...'
%            5  'Pre&ferences...'
%            6  '&Export...'
%            7  'Save &As...'
%            8  '&Save'
%            9  '&Close'
%           10  '&Open...'
%           11  '&New Figure'
set(findobj(ch_file(1:end),'Label','&Open...'),'Label','&Load Data File','callback','file_browser3d(3,2);')
file_hdl=findobj(ch_file,'Label','&New Figure');
if ~isempty(file_hdl) 
   delete(file_hdl);
   ch_file(find(ch_file == file_hdl))=[];	
end
set(findobj(ch_file(1:end),'Label','&Save'),'Label','Save &Figure As','callback','file_browser3d(4,3);')
file_hdl=findobj(ch_file,'Label','Save &As...');
if ~isempty(file_hdl) 
   delete(file_hdl);
   ch_file(find(ch_file == file_hdl))=[];	
end
file_hdl=findobj(ch_file,'Label','&Export...');
if ~isempty(file_hdl) 
   delete(file_hdl);
   ch_file(find(ch_file == file_hdl))=[];	
end	
file_hdl=findobj(ch_file,'Label','Pre&ferences...');
if ~isempty(file_hdl) 
   delete(file_hdl);
   ch_file(find(ch_file == file_hdl))=[];	
end


h2= uimenu('Parent',hdl.krig.h0,'label','&Task');
h20=uimenu(h2,'label','&Navigator','callback','main_menu3d','separator','off');
h2a=uimenu(h2,'label','   &Load Data','callback','dataprep3dfig;','separator','on');
h2b=uimenu(h2,'label','   &Variogram','callback','variogram3dfig;','separator','off');
h2d=uimenu(h2,'label','   &Visualization','callback','dispkrig3dfig;','separator','off');
%h2e=uimenu(h2,'label','   &Save Output','callback','file_browser(5);','separator','off');
h2e= uimenu(h2,'label','&Save Window Position','callback','save_window_pos(hdl.krig.h0);','separator','on');

hdl.kriging.help=uimenu(hdl.krig.h0,'label','&Help','separator','off');
%% Kriging grid coordinates
hdl_kriging_help_C=uimenu(hdl.kriging.help,'label','&Coordinates','separator','on');
uimenu(hdl_kriging_help_C,'label','   X-axis','Callback','kriging_help(1)','separator','off');
uimenu(hdl_kriging_help_C,'label','   Y-axis','Callback','kriging_help(1)','separator','off');
uimenu(hdl_kriging_help_C,'label','   Z-axis','Callback','kriging_help(1)','separator','off');
uimenu(hdl_kriging_help_C,'label','   Minimum','Callback','kriging_help(1)','separator','off');
uimenu(hdl_kriging_help_C,'label','   Maximum','Callback','kriging_help(1)','separator','off');
uimenu(hdl_kriging_help_C,'label','   Resolution','Callback','kriging_help(1)','separator','off');
uimenu(hdl_kriging_help_C,'label','   Customized Grid File','Callback','kriging_help(20)','separator','on');
%% kriging parameters
hdl_kriging_help_KP=uimenu(hdl.kriging.help,'label','&Kriging Parameters','separator','on');
hdl_kriging_help_K1=uimenu(hdl_kriging_help_KP,'label','Model','separator','off');
uimenu(hdl_kriging_help_K1,'label','   Simple Kriging','Callback','kriging_help(2)','separator','off');
uimenu(hdl_kriging_help_K1,'label','   Ordinary Kriging','Callback','kriging_help(2)','separator','off');
uimenu(hdl_kriging_help_K1,'label','   Universal Kriging (Linear drift)','Callback','kriging_help(2)','separator','off');
hdl_kriging_help_K2=uimenu(hdl_kriging_help_KP,'label','Scheme','separator','on');
uimenu(hdl_kriging_help_K2,'label','   Point to Point','Callback','kriging_help(3)','separator','off');
uimenu(hdl_kriging_help_K2,'label','   Point to Block','Callback','kriging_help(3)','separator','off');
hdl_kriging_help_KB=uimenu(hdl_kriging_help_KP,'label','   Block Size','separator','off');
uimenu(hdl_kriging_help_KB,'label','      (X,Y,Z)','Callback','kriging_help(3)','separator','off');

%% Other kriging parameters
hdl_kriging_help_K3=uimenu(hdl_kriging_help_KP,'label','Other parameters','separator','on');
uimenu(hdl_kriging_help_K3,'label','   Search Radius','Callback','kriging_help(5)','separator','off');
uimenu(hdl_kriging_help_K3,'label','   Minimum Krig Points','Callback','kriging_help(5)','separator','off');
uimenu(hdl_kriging_help_K3,'label','   Maximum Krig Points','Callback','kriging_help(5)','separator','off');
uimenu(hdl_kriging_help_K3,'label','   Relative Variance','Callback','kriging_help(5)','separator','off');

%% Variogram/Krig Parameter files
hdl_kriging_help_PF=uimenu(hdl.kriging.help,'label','&Parameter File','separator','on');
uimenu(hdl_kriging_help_PF,'label','   Load','Callback','kriging_help(6)','separator','off');
uimenu(hdl_kriging_help_PF,'label','   Save','Callback','kriging_help(6)','separator','off');
uimenu(hdl_kriging_help_PF,'label','     Variogram Parameters Only','Callback','kriging_help(6)','separator','on');
uimenu(hdl_kriging_help_PF,'label','     Kriging Parameters Only','Callback','kriging_help(6)','separator','off');
uimenu(hdl_kriging_help_PF,'label','     Both Parameter Files ','Callback','kriging_help(6)','separator','off');

%% Data/Data Format Fils
hdl_kriging_help_DF=uimenu(hdl.kriging.help,'label','&Data File','separator','on');
uimenu(hdl_kriging_help_DF,'label','   Load Data Format','Callback','kriging_help(7)','separator','off');
uimenu(hdl_kriging_help_DF,'label','   Load Data File','Callback','kriging_help(8)','separator','off');

%% Batch Kriging 
hdl_kriging_help_BP=uimenu(hdl.kriging.help,'label','&Batch File Processing','separator','on');
uimenu(hdl_kriging_help_BP,'label','   Load Filename-list File','Callback','kriging_help(9)','separator','off');
uimenu(hdl_kriging_help_BP,'label','   Save BatchProc Log File','Callback','kriging_help(9)','separator','off');
uimenu(hdl_kriging_help_BP,'label','   Batch Krig','Callback','kriging_help(9)','separator','off');

% Push Buttons
hdl_kriging_help_PB=uimenu(hdl.kriging.help,'label','&Push Buttons','separator','on');
uimenu(hdl_kriging_help_PB,'label','   Krig','Callback','kriging_help(10)','separator','off');
uimenu(hdl_kriging_help_PB,'label','   Refresh','Callback','kriging_help(10)','separator','off');
uimenu(hdl_kriging_help_PB,'label','   Navigator','Callback','kriging_help(10)','separator','off');
uimenu(hdl_kriging_help_PB,'label','   Quit','Callback','kriging_help(10)','separator','off');

hdl_quit=uimenu(hdl.krig.h0,'label','Quit','separator','on');
uimenu(hdl_quit,'label','&Close Current Window','Callback','close_window(3)','separator','off');
uimenu(hdl_quit,'label','&Quit EasyKrig','Callback','close all','separator','off');

%% FILE ID
if isfield(para.dataprep,'fileID')
    fileIDstr=para.dataprep.fileID;
else
    fileIDstr=' ';
end
hdl.krig.fileID = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',dark_grey, ...
	'FontWeight','bold', ...
	'ForegroundColor',[0 0 0.5], ...
	'Position',[0.27 0.95 0.48 0.03], ...
	'String',fileIDstr, ...
	'Style','text', ...
	'Tag','KrigFileID');

%% Coordinate frame
x00=0.08;y00=0.54;Yf=.33;
Lvarstr=0.1;Lvalue=0.08;Lslider=0.15;dx=0.005;
Ly=hdl.object.edit_w;dy=0.05;
x0=0.10;y0=y00+Yf-dy-0.08;

h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'Position',[x00 y00 0.40 Yf], ...
	'Style','frame', ...
	'Tag','FrmCoord');
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontSize',10, ...
	'FontWeight','bold', ...
	'ForegroundColor',[0 0 1], ...
	'Position',[x00+0.1 y00+Yf-0.015 0.2 0.04], ...
	'String','Coordinates', ...
   'Style','text');

%% X,Y Z labels
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontWeight','bold', ...
	'HorizontalAlignment','center', ...
	'Position',[x0+Lvarstr+dx y0+Ly+0.01 Lvalue Ly], ...
	'String','X', ...
	'Style','text');
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontWeight','bold', ...
	'HorizontalAlignment','center', ...
	'Position',[x0+Lvarstr+Lvalue+dx y0+Ly+0.01 Lvalue Ly], ...
	'String','Y', ...
	'Style','text');
hdl.krig.zlabel = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontWeight','bold', ...
	'HorizontalAlignment','center', ...
	'Position',[x0+Lvarstr+2*(Lvalue+dx) y0+Ly+0.01 Lvalue Ly], ...
	'String','Z', ...
	'Style','text');

%% min, max, resolution labels
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontWeight','bold', ...
	'HorizontalAlignment','right', ...
	'Position',[x0 y0 Lvarstr Ly], ...
	'String','Minimum', ...
	'Style','text', ...
   'Tag','minlab');
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontWeight','bold', ...
	'HorizontalAlignment','right', ...
	'Position',[x0 y0-dy Lvarstr Ly], ...
	'String','Maximum', ...
	'Style','text', ...
	'Tag','maxlab');
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontWeight','bold', ...
	'HorizontalAlignment','right', ...
	'Position',[x0 y0-2*dy Lvarstr Ly], ...
	'String','Resolution', ...
	'Style','text', ...
   'Tag','dellab');

% x-dir
hdl.krig.xmin = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+dx y0 Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
   'Tag','xmin');
hdl.krig.xmax = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+dx y0-dy Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
   'Tag','xmax');
hdl.krig.dx = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+dx y0-2*dy Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
	'Tag','dx');

%% y-dir
hdl.krig.ymin = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+Lvalue+2*dx y0 Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
	'Tag','ymin');
hdl.krig.ymax = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+Lvalue+2*dx y0-dy Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
	'Tag','ymax');
hdl.krig.dy = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+Lvalue+2*dx y0-2*dy Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
	'Tag','dy');

%% z-dir
hdl.krig.zmin = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+2*Lvalue+3*dx y0 Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
	'Tag','zmin');
hdl.krig.zmax = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+2*Lvalue+3*dx y0-dy Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
	'Tag','zmax');
hdl.krig.dz = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+Lvarstr+2*Lvalue+3*dx y0-2*dy Lvalue Ly], ...
	'String',' ', ...
	'Style','edit', ...
	'Tag','dz');

% customized grids
hdl.krig.customized_gridfile = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontWeight','bold', ...
	'Callback','radio_action(3,8)', ...
	'HorizontalAlignment','left', ...
	'Position',[x0+Lvalue y0-3.5*dy 2*Lvarstr Ly], ...
	'String','Customized Grid File', ...
	'Style','radio', ...
   'Tag','customized_grid');
hdl.krig.gridfile_browser = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'Callback','file_browser3d(3,8)', ...
	'FontSize',10, ...
	'FontWeight','bold', ...
	'Position',[x0+2.2*Lvarstr+0.02 y0-3.5*dy  Lvalue Ly ], ...
   'String','Browse', ...
   'Enable','off', ...
	'Tag','Gridfile');


%% Kriging parameters
%% Coordinate frame
x00=0.51;y00=0.32;Yf=.58;
Lvarstr=0.1;Lvalue=0.08;Lpopupmenu=0.25;dx=0.005;
Ly=hdl.object.edit_w;
dy=0.05;
x0=0.52;y0=y00+Yf-dy;

h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'Position',[x00 y00+0.1 0.40 Yf-0.1], ...
	'Style','frame', ...
	'Tag','FrmModelPara');
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'FontSize',10, ...
	'FontWeight','bold', ...
	'ForegroundColor',[0 0 1], ...
	'Position',[x00+0.08 y00+Yf-0.005 0.25 Ly], ...
	'String','Kriging Parameters', ...
	'Style','text');
%%% krig model
model_str={'1.  Simple Kriging','2.  Ordinary Kriging','3.  Universal Kriging (linear drift)'};
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'HorizontalAlignment','center', ...
	'FontWeight','bold', ...
	'Position',[x0+2*dx y0-0.004 Lvarstr Ly], ...
	'String',' Model', ...
	'Style','text');
hdl.krig.model = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+3*dx+Lvarstr y0 Lpopupmenu Ly], ...
	'String',model_str, ...
	'Style','popupmenu', ...
	'Tag','krigModel');

%%% krig scheme
model_str={'1.  Point to Point','2.  Point to Block'};
h1 = uicontrol('Parent',hdl.krig.h0, ...
	'Units','normalized', ...
	'BackgroundColor',grey, ...
	'HorizontalAlignment','center', ...
	'FontWeight','bold', ...
	'Position',[x0+2*dx y0-0.004-dy Lvarstr Ly], ...
	'String',' Scheme', ...
	'Style','text');
hdl.krig.scheme = uicontrol('Parent',hdl.krig.h0, ...
   'Units','normalized', ...
   'Callback','popupmenu_action(3,2)', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[x0+3*dx+Lvarstr y0-dy Lpopupmenu Ly], ...
	'String',model_str, ...
	'Style','popupmenu', ...
	'Tag','krigScheme');

%% block size
Lvalue_blk=0.05;

⌨️ 快捷键说明

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