Changeset 144 for trunk/src


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

connection between uvmat and get_field improved, cleaning of GUI get_field

Location:
trunk/src
Files:
4 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)
  • trunk/src/uvmat.m

    r141 r144  
    23072307    if isequal(FileType,'netcdf')  %read the first nc field
    23082308        if isequal(FieldName,'get_field...')% read the field names on the interface get_field.
    2309             hget_field=findobj(allchild(0),'Name','uvmat_field');%find the get_field... GUI
     2309            hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI
    23102310            if isempty(hget_field)
    23112311                hget_field= get_field(filename);%open the get_field GUI   
    2312                 set(hget_field,'name','uvmat_field')
     2312              %  set(hget_field,'name','get_field')
    23132313            elseif UvData.NewSeries% refresh the fet_field GUI for a new series
    23142314                delete(hget_field)
    23152315                hget_field= get_field(filename);%open the get_field GUI
    2316                 set(hget_field,'name','uvmat_field')%rename  get_field GUI for the 'slave' mode
     2316                set(hget_field,'name','get_field')%rename  get_field GUI for the 'slave' mode
    23172317            end
    23182318            hhget_field=guidata(hget_field);
     2319            set(hhget_field.list_fig,'Value',1)
     2320            set(hhget_field.list_fig,'String',{'uvmat'})
    23192321            funct_list=get(hhget_field.ACTION,'UserData');
    23202322            funct_index=get(hhget_field.ACTION,'Value');
     
    23352337    if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FileType_1,'netcdf') %read the second file
    23362338        if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field.
    2337             hget_field_1=findobj(allchild(0),'Name','uvmat_field_1');%find the get_field... GUI
     2339            hget_field_1=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI
    23382340            if isempty(hget_field_1)
    23392341                 hget_field_1= get_field(filename_1);%open the get_field GUI
    2340                  set(hget_field_1,'name','uvmat_field_1')
     2342                 set(hget_field_1,'name','get_field_1')
     2343            elseif UvData.NewSeries% refresh the fet_field GUI for a new series
     2344                delete(hget_field_1)
     2345                hget_field_1= get_field(filename);%open the get_field GUI
     2346                set(hget_field_1,'name','get_field_1')%rename  get_field GUI for the 'slave' mode
    23412347            end
    23422348            hhget_field_1=guidata(hget_field_1);%handles of GUI elements in get_field
     2349            set(hhget_field_1.list_fig,'Value',1)
     2350            set(hhget_field_1.list_fig,'String',{'uvmat'})
    23432351            funct_list=get(hhget_field_1.ACTION,'UserData');
    23442352            funct_index=get(hhget_field_1.ACTION,'Value');
     
    32163224     set_veltype_display(veltype_handles,0) % unvisible civ buttons
    32173225     filename=read_file_boxes(handles);
    3218      hget_field=findobj(allchild(0),'name','uvmat_field');
    3219      if isempty(hget_field)
    3220          hget_field=get_field(filename);
    3221          set(hget_field,'Name','uvmat_field')       
     3226     hget_field=findobj(allchild(0),'name','get_field');
     3227     if ~isempty(hget_field)
     3228         delete(hget_field)
    32223229     end
     3230     hget_field=get_field(filename);
     3231     set(hget_field,'Name','get_field')       
     3232     hhget_field=guidata(hget_field);
     3233     set(hhget_field.list_fig,'Value',1)
     3234     set(hhget_field.list_fig,'String',{'uvmat'})
     3235     set(handles.transform_fct,'Value',1)% no transform by default
     3236     set(handles.path_transform,'String','')
    32233237    return %no action
    32243238end
     
    33803394     hget_field=get_field(filename);
    33813395     set(hget_field,'name','get_field_1')
     3396     hhget_field=guidata(hget_field);
     3397     set(hhget_field.list_fig,'Value',1)
     3398     set(hhget_field.list_fig,'String',{'uvmat'})
     3399     set(handles.transform_fct,'Value',1)% no transform by default
     3400     set(handles.path_transform,'String','')
    33823401    return %no action
    33833402end
  • trunk/src/view_field.m

    r116 r144  
    7272handles_mouse=handles;
    7373huvmat=findobj(allchild(0),'Name','uvmat');
    74 hhuvmat=guidata(huvmat);
    75 set(hhuvmat.list_object_2,'Visible','on')
    76 % handles_mouse.create=hhuvmat.create;
    77 handles_mouse.edit=hhuvmat.edit;
    78 pos_uvmat=get(huvmat,'Position');
    79 pos_view_field(1)=pos_uvmat(1)+pos_uvmat(3)/2;
    80 pos_view_field(2)=pos_uvmat(2)-pos_uvmat(3)/4;
    81 pos_view_field(3:4)=pos_uvmat(3:4);
    82 set(hObject,'Position',pos_view_field)
     74if ~isempty(huvmat)
     75    hhuvmat=guidata(huvmat);
     76    set(hhuvmat.list_object_2,'Visible','on')
     77    % handles_mouse.create=hhuvmat.create;
     78    handles_mouse.edit=hhuvmat.edit;
     79    pos_uvmat=get(huvmat,'Position');
     80    pos_view_field(1)=pos_uvmat(1)+pos_uvmat(3)/2;
     81    pos_view_field(2)=pos_uvmat(2)-pos_uvmat(3)/4;
     82    pos_view_field(3:4)=pos_uvmat(3:4);
     83    set(hObject,'Position',pos_view_field)
     84end
    8385
    8486%functions for the mouse and keyboard
Note: See TracChangeset for help on using the changeset viewer.