Changeset 144 for trunk/src/get_field.m


Ignore:
Timestamp:
Nov 30, 2010, 12:03:49 AM (13 years ago)
Author:
sommeria
Message:

connection between uvmat and get_field improved, cleaning of GUI get_field

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_field.m

    r128 r144  
    111111    set(handles.inputfile,'String',filename)% prefill the input file name
    112112    set(handles.inputfile,'Enable','off')% desactivate the input file edit box   
    113     set(handles.list_fig,'Value',2)% plotting axes =uvmat selected
    114     set(handles.list_fig,'Visible','off')%
    115     set(handles.RUN,'Visible','off')% RUN button not visible (passive mode, get_field used to define the field for uvamt)
     113  %  set(handles.list_fig,'Value',2)% plotting axes =uvmat selected
     114  %  set(handles.list_fig,'Visible','off')%
     115    set(handles.RUN,'String','REFRESH')% passive mode, get_field used to define the field for uvamt
    116116    set(handles.MenuOpen,'Visible','off')
    117117    set(handles.MenuExport,'Visible','off')
     
    120120else  %master mode
    121121    set(handles.inputfile,'String','')   
     122    set(handles.RUN,'String','RUN')%
    122123    % load the list of previously browsed files for the upper bar menu Open
    123124    dir_perso=prefdir;
     
    171172inputfile=get(handles.inputfile,'String');
    172173Field=nc2struct(inputfile);% reads the whole field
    173 hfig=get(handles.inputfile,'parent');
    174 set(hfig,'UserData',Field);
     174set(handles.figure1,'UserData',Field);
    175175Field_input(eventdata,handles,Field);
    176176
     
    792792function RUN_Callback(hObject, eventdata, handles)
    793793%---------------------------------------------------------
    794 index=get(handles.ACTION,'Value');
    795 list_func=get(handles.ACTION,'UserData');
    796 h_fun=list_func{index};
    797 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
    798 drawnow
    799 SubField=h_fun(handles.figure1);%handles.figure1 =handles of the GUI get_field
    800 if ~isempty(SubField)
    801     plot_get_field(SubField,handles)
    802 end
    803 browse_fig(handles.list_fig); %update the list of new existing figures
     794figstring=get(handles.list_fig,'String');
     795if isequal(figstring,{'uvmat'})
     796    huvmat=findobj(allchild(0),'tag','uvmat');
     797    hhuvmat=guidata(huvmat);
     798    uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat, show the image in phys coordinates
     799else
     800    index=get(handles.ACTION,'Value');
     801    list_func=get(handles.ACTION,'UserData');
     802    h_fun=list_func{index};
     803    set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
     804    drawnow
     805    SubField=h_fun(handles.figure1);%handles.figure1 =handles of the GUI get_field
     806    if ~isempty(SubField)
     807        plot_get_field(SubField,handles)
     808    end
     809    browse_fig(handles.list_fig); %update the list of new existing figures
     810end
    804811
    805812%------------------------------------------------------------------------
     
    809816val=get(handles.list_fig,'Value');
    810817if strcmp(list_fig{val},'uvmat')
    811     set(handles.figure1,'Name','uvmat_field')
     818%     set(handles.figure1,'Name','uvmat_field')
    812819    set(handles.inputfile,'Enable','off')% desactivate the input file edit box   
    813820%     set(handles.list_fig,'Visible','off')%
     
    816823    set(handles.MenuExport,'Visible','off')
    817824    uvmat(get(handles.inputfile,'String'))
     825elseif strcmp(list_fig{val},'view_field')
     826    view_field(SubField)
    818827else
    819828    hfig=str2num(list_fig{val});% chosen figure number from tyhe GUI
     
    10651074
    10661075% update dimensions;
    1067 if isfield(Field,'VarDimIndex')
     1076if isfield(Field,'ListDimName')
     1077    Field.ListDimName
    10681078    Tabdim={};%default
    1069     if isequal(index,1)
     1079    if isequal(index,1)%list all dimensions
    10701080        dim_indices=1:length(Field.ListDimName);
    10711081        set(handles.dimensions_txt,'String', 'dimensions')
    10721082    else
    1073         dim_indices=Field.VarDimIndex{index-1};
     1083        DimCell=Field.VarDimName{index-1};
     1084        if ischar(DimCell)
     1085            DimCell={DimCell};
     1086        end   
     1087        dim_indices=[];
     1088        for idim=1:length(DimCell)
     1089            dim_index=strcmp(DimCell{idim},Field.ListDimName);%vector with size of Field.ListDimName, =0
     1090            dim_index=find(dim_index,1);
     1091            dim_indices=[dim_indices dim_index];
     1092        end
     1093        %dim_indices=find(dim_list) %removes 0 values
    10741094        set(handles.dimensions_txt,'String', ['dimensions of ' var_select])
    10751095    end
     
    12511271for ifig=1:length(hh)  %look for all existing figures
    12521272    name=get(hh(ifig),'Name');
    1253      if ~isequal(name,'uvmat')%case of uvmat GUI
     1273     if ~strcmp(name,'uvmat')&& ~strcmp(name,'view_field') %case of uvmat GUI
    12541274        hchild=get(hh(ifig),'children');% look for axes contained in each figure
    12551275        nbaxe=0;
     
    12741294     end
    12751295end
    1276 list=['new fig...';'uvmat';list];
     1296list=['view_field';list];
    12771297set(menu_handle,'Value',1)
    12781298set(menu_handle,'String',list)
     
    12851305fig_val=get(handles.list_fig,'Value');
    12861306plot_fig=list_fig{fig_val};
    1287 if isequal(plot_fig,'uvmat')
    1288     huvmat=findobj(allchild(0),'name','uvmat');
    1289     if ~isempty(huvmat)
    1290         uistack(huvmat,'top')
    1291     end   
    1292 elseif ~isequal(plot_fig,'new fig...') & ~isequal(plot_fig,'uvmat')
     1307if strcmp(plot_fig,'view_field')
     1308%     huvmat=findobj(allchild(0),'name','uvmat');
     1309%     if ~isempty(huvmat)
     1310%         uistack(huvmat,'top')
     1311%     end   
     1312else%if ~isequal(plot_fig,'new fig...') & ~isequal(plot_fig,'uvmat')
    12931313    sep=regexp(plot_fig,'_');
    12941314    if ~isempty(sep)
Note: See TracChangeset for help on using the changeset viewer.