Changeset 221


Ignore:
Timestamp:
Mar 12, 2011, 11:11:01 PM (13 years ago)
Author:
sommeria
Message:

various bug corrections.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_up.m

    r210 r221  
    201201                map=colormap(currentaxes);
    202202                colormap(map);%transmit the current colormap to the zoom fig
    203                 set(hfig2,'Position',[0.2 0.33 0.6 0.6]);         
     203                set(hfig2,'Position',[0.2 0.33 0.6 0.6]);
    204204                set(hfig2,'Unit','normalized')
    205205                set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
     
    229229                    set(hcol_new,'Yticklabel',YTicklabel);
    230230                end
    231             end
    232     %             if ishandle(AxeData.ZoomAxes)
    233 %             hnew_rect=findobj(AxeData.ZoomAxes,'Tag','rect_zoom');
    234 %             if ~isempty(hnew_rect)
    235 %                 delete(hnew_rect);
    236 
    237                 ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window
    238                 ChildAxeData.Drawing='off';
    239                 ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe
    240                 PosRect=CurrentOrigin;
    241                 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    242                 set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)])
    243                 set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)])
    244 %             end
     231            end         
     232            ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window
     233            ChildAxeData.Drawing='off';
     234            ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe
     235            PosRect=CurrentOrigin;
     236            xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     237            set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)])
     238            set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)])
    245239            set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes
    246240        end
     
    253247    xlim=get(currentaxes,'XLim');
    254248    ylim=get(currentaxes,'YLim');
     249 % if left mouse button has been pressed, zoom in by a factor of 2
    255250    if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
    256251        xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
     
    260255        ylim(1)=0.5*xy(1,2)+0.5*ylim(1);
    261256        set(currentaxes,'YLim',ylim)
    262         %zoom out by a factor of 2 out when the right mouse button has been used
    263     else%if isequal(get(currentfig,'SelectionType'),'alt'); %if right button has been pressed
     257 % if right mouse button has been pressed, zoom out by a factor of 2
     258    else
    264259        xlim(1)=2*xlim(1)-xy(1,1);
    265260        xlim(2)=2*xlim(2)-xy(1,1);
    266261        ylim(1)=2*ylim(1)-xy(1,2);
    267262        ylim(2)=2*ylim(2)-xy(1,2);
    268         %             ylim_new(1)=(1+alpha)*ylim(1)/2+(1-alpha)*ylim(2)/2;
    269         %             ylim_new(2)=(1-alpha)*ylim(1)/2+(1+alpha)*ylim(2)/2;
    270263        if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
     264            'TESTup'
     265            AxeData
    271266            xlim(1)=max(AxeData.RangeX(1),xlim(1));
    272267            xlim(2)=min(AxeData.RangeX(2),xlim(2));
    273268            ylim(1)=max(AxeData.RangeY(1),ylim(1));
    274269            ylim(2)=min(AxeData.RangeY(2),ylim(2));
     270         % desactivate the zoom if the full field is visible within the axes
    275271            if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
    276272                set(hhuvmat.zoom,'Value',0)
     
    280276            end
    281277        end
     278        xlim
     279        ylim
    282280        set(currentaxes,'XLim',xlim)
    283281        set(currentaxes,'YLim',ylim)
     
    287285        end
    288286    end
    289 %     if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field
    290 %         hparentrect=AxeData.ParentRect;
    291 %         xlim=get(currentaxes,'XLim');
    292 %         ylim=get(currentaxes,'YLim');
    293 %         rect([1 2])=[xlim(1) ylim(1)];
    294 %         rect([3 4])=[xlim(2)-xlim(1) ylim(2)-ylim(1)];
    295 %         set(hparentrect,'Position',rect)
    296287    if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field)
    297288        set(hhcurrentfig.MinX,'String',num2str(xlim(1)))
     
    327318            Tabchar=[Tabchar ;{'......'}];
    328319            set(h_ListCoord,'String',Tabchar)
    329             %         coord_str=Coord{index_point}; %current line (string)
    330             %         k=findstr('|',coord_str);%find separator indices on the string
    331             %         blanks=blank
    332             %         xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    333             %         if numel(k)>=3
    334             %             coord_str=[coord_str(1:k(3)-1) ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord
    335             %         else
    336             %             coord_str=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
    337             %         end
    338             %         Coord{index_point}=coord_str;
    339             %         set(h_ListCoord,'String',Coord)
    340             %         data=read_geometry_calib(Coord);%transform char cell to numbers
    341320            set(hh,'XData',data.Coord(:,4))
    342321            set(hh,'YData',data.Coord(:,5))
     
    344323    end
    345324end
    346 
    347325
    348326%% finalising ruler
     
    383361        currentobj=gco;%default
    384362    end
    385     if ((nbselect==0) && isequal(get(currentobj,'Type'),'axes')) || isequal(currentobj,huvmat)
    386         currentfig=get(currentobj,'parent');
    387         figname=get(currentfig,'name');
    388         eval(['global Data_' figname])
    389         eval(['Data_' figname '=get(currentobj,''UserData'')']);
    390         evalin('base',['global Data_' figname])%make CurData global in the workspace
    391         objtype=get(currentobj,'Type');
    392         display(['UserData of ' objtype ':'])
    393         evalin('base',['Data_' figname]) %display CurData in the workspace
    394         commandwindow %brings the Matlab command window to the front
    395     end
     363%     if ((nbselect==0) && isequal(get(currentobj,'Type'),'axes')) || isequal(currentobj,huvmat)
     364%         currentfig=get(currentobj,'parent');
     365%         figname=get(currentfig,'name');
     366%         eval(['global Data_' figname])
     367%         eval(['Data_' figname '=get(currentobj,''UserData'')']);
     368%         evalin('base',['global Data_' figname])%make CurData global in the workspace
     369%         objtype=get(currentobj,'Type');
     370%         display(['UserData of ' objtype ':'])
     371%         evalin('base',['Data_' figname]) %display CurData in the workspace
     372%         commandwindow %brings the Matlab command window to the front
     373%     end
    396374end
    397375
  • trunk/src/name_generator.m

    r138 r221  
    272272    num_i1=str2double(field_count);
    273273    num_i2=str2double(str2);
    274     num_j1=stra2double(str_a);
    275     num_j2=stra2double(str_b);
     274    if isnan(num_i2)
     275        num_i2=num_i1;
     276    end
     277    num_j1=stra2num(str_a);
     278    num_j2=stra2num(str_b);
    276279     pathname=fileparts(filebasesub);% CORRIGE LE 6 JUIN (ETAIT DESACTIVE)
    277280    filename=fullfile(pathname,dirpair(indpair).name);
  • trunk/src/plot_field.m

    r210 r221  
    240240    msgbox_uvmat('ERROR', errormsg)
    241241end
    242 if isfield(PlotParamOut,'MinX')
    243     set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX])
    244     set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY])
    245     AxeData.RangeX=[PlotParamOut.MinX PlotParamOut.MaxX];
    246     AxeData.RangeY=[PlotParamOut.MinY PlotParamOut.MaxY];
     242if isfield(PlotParamOut,'RangeX')&& isfield(PlotParamOut,'RangeY')
     243%     'TESTplot'
     244%     haxes
     245%     PlotParamOut.MinX
     246%     PlotParamOut.MaxY
     247%     set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX])
     248%     set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY])
     249    AxeData.RangeX=PlotParamOut.RangeX;%'[PlotParamOut.MinX PlotParamOut.MaxX];
     250    AxeData.RangeY=PlotParamOut.RangeY;%[PlotParamOut.MinY PlotParamOut.MaxY]
    247251end
    248252
     
    508512
    509513%% determine axes bounds
    510  fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits;
     514PlotParamOut.RangeX=[min(XMin) max(XMax)];
     515PlotParamOut.RangeY=[min(YMin_cell) max(YMax_cell)];
     516fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits;
    511517if fix_lim
    512518    if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY')
    513519        fix_lim=0; %free limits if lits are not set,
    514     end  %else PlotParamOut.XMin =PlotParam.XMin...
     520    end
    515521end
    516522if ~fix_lim
     
    10741080        end  %else PlotParamOut.XMin =PlotParam.XMin...
    10751081    end
    1076     if ~fix_lim
     1082%     if ~fix_lim
    10771083        XMin=[];
    10781084        XMax=[];
     
    10911097            YMax=[YMax max(vec_Y)];
    10921098        end
     1099        PlotParamOut.RangeX=[min(XMin) max(XMax)]; %range of x, to be stored in the user data of the plot axes
     1100        PlotParamOut.RangeY=[min(YMin) max(YMax)]; %range of x, to be stored in the user data of the plot axes
     1101    if ~fix_lim
    10931102        PlotParamOut.MinX=min(XMin);
    10941103        PlotParamOut.MaxX=max(XMax);
     
    11021111        end
    11031112    end
    1104 %     if Ylim(2)>Ylim(1)
    1105 %         set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate
    1106 %     end
    1107 %     end
    1108     %    adjust the size of the plot to include the whole field, except if PlotParam.FixLimits=1
    1109     %     if ~(isfield(PlotParam,'FixLimits') && PlotParam.FixLimits) && test_lim
    1110     %         PlotParamOut.MinX=Xlim(1);
    1111     %         PlotParamOut.MaxX=Xlim(2);
    1112     %         PlotParamOut.MinY=Ylim(1);
    1113     %         PlotParamOut.MaxY=Ylim(2);
    1114 %     if Xlim(2)>Xlim(1)
    1115 %         set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates
    1116 %     end
    1117 %     if Ylim(2)>Ylim(1)
    1118 %         set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate
    1119 %     end
    1120     %     end
    1121 
    11221113    set(haxes,'YDir','normal')
    11231114    set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']);
  • trunk/src/read_civxdata.m

    r206 r221  
    111111test_civ2=isequal(VelTypeOut,'civ2')||isequal(VelTypeOut,'interp2')||isequal(VelTypeOut,'filter2');
    112112Field.Time=0; %default
     113Field.TimeUnit='s';
    113114if test_civ1
    114115    if isfield(Field,'absolut_time_T0')
     
    162163end
    163164List(ind_remove)=[];
    164 Field.ListGlobalAttribute=[{'NbCoord'},{'NbDim'} List {'Time','CivStage','CoordUnit'}];
     165Field.ListGlobalAttribute=[{'NbCoord'},{'NbDim'} List {'Time','TimeUnit','CivStage','CoordUnit'}];
    165166Field.CoordUnit='pixel';
    166167
  • trunk/src/read_field.m

    r186 r221  
    7575    if ~test_civx% read the field names on the interface get_field.
    7676        hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
    77         if isempty(hget_field)
     77        if isempty(hget_field)% open the GUI get_field if it is not found
    7878            hget_field= get_field(ObjectName);%open the get_field GUI
    79             set(hget_field,'Name',GUIName)
     79            set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)
    8080        end
    8181        hhget_field=guidata(hget_field);
    8282        %% update  the get_field GUI
     83        set(hhget_field.inputfile,'String',ObjectName)
    8384        set(hhget_field.list_fig,'Value',1)
    8485        funct_list=get(hhget_field.ACTION,'UserData');
  • trunk/src/uvmat.m

    r215 r221  
    948948set(handles.frame_j,'Visible',state_j);
    949949set(handles.j_text,'Visible',state_j);
     950if strcmp(state_j,'on')
     951    set(handles.fix_pair,'Visible','on')
     952else
     953    set(handles.fix_pair,'Visible','off')
     954end
    950955
    951956%% view the field 
     
    13861391    set(handles.scan_i,'Value',0)
    13871392    set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
    1388     NomType=get(handles.FileIndex,'UserData');
     1393    NomType=get(handles.FileIndex,'UserData')
    13891394    switch NomType
    13901395    case {'_i_j1-j2','#_ab','%3dab'},% pair with j index
     
    21152120        index_fields=get(handles.Fields,'Value');% selected string index
    21162121        FieldName= list_fields{index_fields}; % selected field
    2117         if ~strcmp(FieldName,'get_field...')% read the field names on the interface get_field...
    2118            VelType=setfield(handles);
     2122        if ~strcmp(FieldName,'get_field...')
     2123           VelType=setfield(handles);% read the velocity type.
    21192124        end
    21202125        if strcmp(FieldName,'velocity')
     
    24642469            UvData.Field.ZMin=ZMin;
    24652470        else
    2466             UvData.Field.Mesh=sqrt(DX*DY);
     2471            UvData.Field.Mesh=DX;%sqrt(DX*DY);
    24672472        end
    24682473    end
     
    27112716%% display time
    27122717testimedoc=0;
     2718TimeUnit='';
     2719if isfield(UvData.Field,'Time')
     2720    abstime=UvData.Field.Time;%time read from the netcdf input file
     2721end
     2722if isfield(UvData,'Field_1') && isfield(UvData.Field_1,'Time')
     2723    abstime_1=UvData.Field_1.Time;%time read from the netcdf input file
     2724end
     2725if isfield(UvData.Field,'dt')
     2726    dt=UvData.Field.dt;%dt read from the netcdf input file
     2727    if isfield(UvData.Field,'TimeUnit')
     2728       TimeUnit=UvData.Field.TimeUnit;
     2729    end
     2730elseif isfield(UvData,'Field_1') && isfield(UvData.Field_1,'dt')%dt obtained from the second field if not defined in the first
     2731    dt=UvData.Field_1.dt;%dt read from the netcdf input file
     2732    if isfield(UvData.Field_1,'TimeUnit')
     2733       TimeUnit=UvData.Field_1.TimeUnit;
     2734    end
     2735end
     2736% time from xml file overset previous result
    27132737if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'Time')
    27142738    if isempty(num_i2)||isnan(num_i2)
     
    27262750        dt=(UvData.XmlData.Time(num_i2,num_j2)-UvData.XmlData.Time(num_i1,num_j1));
    27272751        testimedoc=1;
     2752        if isfield(UvData.XmlData,'TimeUnit')
     2753            TimeUnit=UvData.XmlData.TimeUnit;
     2754        end
    27282755    end
    27292756end
     
    27562783    set(handles.Dt_txt,'String','')
    27572784else
    2758     if ~(isfield(UvData,'TimeUnit') && ~isempty(UvData.TimeUnit))
     2785    if  isempty(TimeUnit)
    27592786        set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  10^(-3)'] )
    27602787    else
    2761         set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  m' UvData.TimeUnit] )
     2788        set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  m' TimeUnit] )
    27622789    end
    27632790end
Note: See TracChangeset for help on using the changeset viewer.