Changeset 428


Ignore:
Timestamp:
May 19, 2012, 12:38:14 PM (9 years ago)
Author:
sommeria
Message:

bugs fixed. Introduction of transparency and axis aspect ratio in uvmat

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r426 r428  
    4747%     .Coordinates: coordinate parameters:
    4848%           .CheckFixLimits:=0 (default) adjust axes limit to the X,Y data, =1: preserves the previous axes limits
    49 %     .Coordinates.CheckFixEqual: =0 (default):automatic adjustment of the graph, keep 1 to 1 aspect ratio for x and y scales.
     49%     .Coordinates.CheckFixAspectRatio: =0 (default):automatic adjustment of the graph, keep 1 to 1 aspect ratio for x and y scales.
    5050%            --scalars--
    5151%    .Scalar.MaxA: upper bound (saturation color) for the scalar representation, max(field) by default
     
    200200        set(haxes,'YLimMode', 'auto')
    201201    end
    202     if ~isfield(PlotParam.Coordinates,'CheckFixEqual')&& isfield(Data,'CoordUnit')
    203         PlotParam.Coordinates.CheckFixEqual=1;% if CoordUnit is defined, the two coordiantes should be plotted with equal scale by default
    204     end
    205     if isfield(PlotParam.Coordinates,'CheckFixEqual') && isequal(PlotParam.Coordinates.CheckFixEqual,1)
    206         set(haxes,'DataAspectRatioMode','manual')
    207         set(haxes,'DataAspectRatio',[1 1 1])
    208     else
    209         set(haxes,'DataAspectRatioMode','auto')%automatic aspect ratio
    210     end
     202    if ~isfield(PlotParam.Coordinates,'CheckFixAspectRatio')&& isfield(Data,'CoordUnit')
     203        PlotParam.Coordinates.CheckFixAspectRatio=1;% if CoordUnit is defined, the two coordiantes should be plotted with equal scale by default
     204    end
     205%     if isfield(PlotParam.Coordinates,'CheckFixAspectRatio') && isequal(PlotParam.Coordinates.CheckFixAspectRatio,1)
     206%         set(haxes,'DataAspectRatioMode','manual')
     207%         set(haxes,'DataAspectRatio',[1 1 1])
     208%     else
     209%         set(haxes,'DataAspectRatioMode','auto')%automatic aspect ratio
     210%     end
    211211    errormsg='';
    212212   
     
    471471    end
    472472    htitle=title(title_str);
    473     txt=ver('MATLAB');
    474     Release=txt.Release;
    475     relnumb=str2double(Release(3:4));
    476     if relnumb >= 14
    477         set(htitle,'Interpreter','none')% desable tex interpreter
    478     end
     473%     txt=ver('MATLAB');
     474%     Release=txt.Release;
     475%     relnumb=str2double(Release(3:4));
     476%     if relnumb >= 14
     477    set(htitle,'Interpreter','none')% desable tex interpreter
     478%     end
    479479end
    480480
     
    496496    CoordinatesOut.MinY=min(YMin_cell);
    497497    CoordinatesOut.MaxY=max(YMax_cell);
     498end
     499
     500%% determine plot aspect ratio
     501if isequal(Coordinates.CheckFixAspectRatio,1)&&isfield(Coordinates,'AspectRatio')
     502    set(haxes,'DataAspectRatioMode','manual')
     503    set(haxes,'DataAspectRatio',[Coordinates.AspectRatio 1 1])
     504else
     505    set(haxes,'DataAspectRatioMode','auto')%automatic aspect ratio
     506    AspectRatio=get(haxes,'DataAspectRatio')
     507    CoordinatesOut.AspectRatio=AspectRatio(1)/AspectRatio(2);
    498508end
    499509
     
    705715    siz=numel(np);
    706716    if siz>3
    707        errormsg=['unrecognized scalar type: ' num2str(siz) ' dimensions'];
    708             return
     717        errormsg=['unrecognized scalar type: ' num2str(siz) ' dimensions'];
     718        return
    709719    end
    710720    if siz==3
     
    725735        BW=(siz==2) && (isa(A,'uint8')|| isa(A,'uint16'));% non color images represented in gray scale by default
    726736        PlotParamOut.Scalar.CheckBW=BW;
    727     end 
     737    end
    728738    %case of grey level images or contour plot
    729     if siz==2 
     739    if siz==2
    730740        if ~isfield(PlotParam.Scalar,'CheckFixScalar')
    731741            PlotParam.Scalar.CheckFixScalar=0;%default
     
    742752            Aline=Aline(~isnan(A));
    743753            if isempty(Aline)
    744                  errormsg='NaN input scalar or image in plot_field';
     754                errormsg='NaN input scalar or image in plot_field';
    745755                return
    746756            end
     
    748758        else
    749759            MinA=PlotParam.Scalar.MinA;
    750         end; 
     760        end;
    751761        if ~PlotParam.Scalar.CheckFixScalar||isempty(PlotParam.Scalar.MaxA)||~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box
    752762            if isempty(Aline)
    753                Aline=reshape(A,1,[]);
    754                Aline=Aline(~isnan(A));
    755                if isempty(Aline)
    756                  errormsg='NaN input scalar or image in plot_field';
    757                 return
    758                end
     763                Aline=reshape(A,1,[]);
     764                Aline=Aline(~isnan(A));
     765                if isempty(Aline)
     766                    errormsg='NaN input scalar or image in plot_field';
     767                    return
     768                end
    759769            end
    760770            MaxA=double(max(Aline));
    761771        else
    762             MaxA=PlotParam.Scalar.MaxA; 
    763         end; 
     772            MaxA=PlotParam.Scalar.MaxA;
     773        end;
    764774        PlotParamOut.Scalar.MinA=MinA;
    765775        PlotParamOut.Scalar.MaxA=MaxA;
     
    777787                PlotParamOut.Scalar.IncrA=intercont;
    778788            else
    779                intercont=PlotParam.Scalar.IncrA;
    780             end
    781             B=A;           
     789                intercont=PlotParam.Scalar.IncrA;
     790            end
     791            B=A;
    782792            abscontmin=intercont*floor(MinA/intercont);
    783793            abscontmax=intercont*ceil(MaxA/intercont);
     
    789799            sizpx=(AX(end)-AX(1))/(np(2)-1);
    790800            sizpy=(AY(1)-AY(end))/(np(1)-1);
    791             x_cont=AX(1):sizpx:AX(end); % pixel x coordinates for image display 
     801            x_cont=AX(1):sizpx:AX(end); % pixel x coordinates for image display
    792802            y_cont=AY(1):-sizpy:AY(end); % pixel x coordinates for image display
    793            % axes(haxes)% set the input axes handle as current axis
    794     txt=ver('MATLAB');
    795     Release=txt.Release;
     803            % axes(haxes)% set the input axes handle as current axis
     804            txt=ver('MATLAB');
     805            Release=txt.Release;
    796806            relnumb=str2double(Release(3:4));
    797807            if relnumb >= 14
    798                     vec=linspace(0,1,(abscontmax-abscontmin)/intercont);%define a greyscale colormap with steps intercont
     808                vec=linspace(0,1,(abscontmax-abscontmin)/intercont);%define a greyscale colormap with steps intercont
    799809                map=[vec' vec' vec'];
    800810                colormap(map);
    801                 [var,hcontour]=contour(x_cont,y_cont,B,cont_pos);       
     811                [var,hcontour]=contour(x_cont,y_cont,B,cont_pos);
    802812                set(hcontour,'Fill','on')
    803813                set(hcontour,'LineStyle','none')
     
    809819            set(hcontour_m,'LineColor',[1 1 1])
    810820            hold off
    811             caxis([abscontmin abscontmax]) 
     821            caxis([abscontmin abscontmax])
    812822            colormap(map);
    813                        if isfield(PlotParam.Coordinates,'CheckFixEqual') && isequal(PlotParam.Coordinates.CheckFixEqual,1)
     823            if isfield(PlotParam.Coordinates,'CheckFixAspectRatio') && isequal(PlotParam.Coordinates.CheckFixAspectRatio,1)
    814824                set(haxes,'DataAspectRatioMode','manual')
    815                 set(haxes,'DataAspectRatio',[1 1 1])
    816            end
     825                if isfield(PlotParam.Coordinates,'AspectRatio')
     826                    set(haxes,'DataAspectRatio',[PlotParam.Coordinates.AspectRatio PlotParam.Coordinates.AspectRatio PlotParam.Coordinates.AspectRatio])
     827                else
     828                    set(haxes,'DataAspectRatio',[1 1 1])
     829                end
     830            end
    817831        end
    818832       
     
    824838                vec=linspace(0,1,255);%define a linear greyscale colormap
    825839                map=[vec' vec' vec'];
    826                 colormap(map);  %grey scale color map 
     840                colormap(map);  %grey scale color map
    827841            else
    828                 colormap('default'); % standard faulse colors for div, vort , scalar fields 
     842                colormap('default'); % standard faulse colors for div, vort , scalar fields
    829843            end
    830844        end
    831845       
    832     % case of color images
    833     else 
     846        % case of color images
     847    else
    834848        if BW
    835849            B=uint16(sum(A,3));
     
    842856   
    843857    % display usual image
    844     if ~CheckContour     
     858    if ~CheckContour
    845859        % interpolate field to increase resolution of image display
    846860        test_interp=1;
    847         if max(np) <= 64 
     861        if max(np) <= 64
    848862            npxy=8*np;% increase the resolution 8 times
    849         elseif max(np) <= 128 
     863        elseif max(np) <= 128
    850864            npxy=4*np;% increase the resolution 4 times
    851         elseif max(np) <= 256 
     865        elseif max(np) <= 256
    852866            npxy=2*np;% increase the resolution 2 times
    853867        else
     
    855869            test_interp=0; % no interpolation done
    856870        end
    857         if test_interp==1%if we interpolate   
     871        if test_interp==1%if we interpolate
    858872            x=linspace(AX(1),AX(2),np(2));
    859873            y=linspace(AY(1),AY(2),np(1));
     
    862876            yi=linspace(AY(1),AY(2),npxy(1));
    863877            B = interp2(X,Y,double(B),xi,yi');
    864         end           
     878        end
    865879        % create new image if there  no image handle is found
    866         if isempty(hima) 
     880        if isempty(hima)
    867881            tag=get(haxes,'Tag');
    868882            if MinA<MaxA
     
    871885                hima=imagesc(AX,AY,B,[MaxA-1 MaxA]);
    872886            end
    873             % the function imagesc reset the axes 'DataAspectRatioMode'='auto', change if .CheckFixEqual is
     887            % the function imagesc reset the axes 'DataAspectRatioMode'='auto', change if .CheckFixAspectRatio is
    874888            % requested:
    875            if isfield(PlotParam.Coordinates,'CheckFixEqual') && isequal(PlotParam.Coordinates.CheckFixEqual,1)
     889            if isfield(PlotParam.Coordinates,'CheckFixAspectRatio') && isequal(PlotParam.Coordinates.CheckFixAspectRatio,1)
    876890                set(haxes,'DataAspectRatioMode','manual')
    877891                set(haxes,'DataAspectRatio',[1 1 1])
    878            end
     892            end
    879893            set(hima,'Tag','ima')
    880894            set(hima,'HitTest','off')
    881             set(haxes,'Tag',tag);%preserve the axes tag (removed by image fct !!!)     
     895            set(haxes,'Tag',tag);%preserve the axes tag (removed by image fct !!!)
    882896            uistack(hima, 'bottom')
    883         % update an existing image
     897            % update an existing image
    884898        else
    885899            set(hima,'CData',B);
     
    893907        end
    894908        % set the transparency to 0.5 if vectors are also plotted
    895         if test_vec
    896             set(hima,'AlphaData',0.5)
    897         else
    898             set(hima,'AlphaData',1)
     909        if isfield(PlotParam.Scalar,'Opacity')&& ~isempty(PlotParam.Scalar.Opacity)
     910            set(hima,'AlphaData',PlotParam.Scalar.Opacity)
     911        else
     912            if test_vec
     913                set(hima,'AlphaData',0.5)%set opacity to 0.5 by default in the presence of vectors
     914                PlotParamOut.Scalar.Opacity=0.5;
     915            else
     916                set(hima,'AlphaData',1)% full opacity (no transparency) by default
     917            end
    899918        end
    900919    end
     
    904923    if siz==2 && exist('PosColorbar','var')&& ~isempty(PosColorbar)
    905924        if isempty(hcol)||~ishandle(hcol)
    906              hcol=colorbar;%create new colorbar
     925            hcol=colorbar;%create new colorbar
    907926        end
    908927        if length(PosColorbar)==4
    909                  set(hcol,'Position',PosColorbar)           
    910         end 
     928            set(hcol,'Position',PosColorbar)
     929        end
    911930        %YTick=0;%default
    912931        if MaxA>MinA
    913932            if CheckContour
    914933                colbarlim=get(hcol,'YLim');
    915                 scale_bar=(colbarlim(2)-colbarlim(1))/(abscontmax-abscontmin);               
     934                scale_bar=(colbarlim(2)-colbarlim(1))/(abscontmax-abscontmin);
    916935                YTick=cont_pos(2:end-1);
    917936                YTick_scaled=colbarlim(1)+scale_bar*(YTick-abscontmin);
     
    926945                set(hcol,'YLim',[MinA MaxA])
    927946                YTick=colbartick(MinA,MaxA);
    928                 set(hcol,'YTick',YTick)               
     947                set(hcol,'YTick',YTick)
    929948            else
    930949                hi=get(hcol,'children');
     
    934953                set(hi,'YData',[MinA MaxA])
    935954                set(hi,'CData',(1:64)')
    936                 YTick=colbartick(MinA,MaxA); 
     955                YTick=colbartick(MinA,MaxA);
    937956                set(hcol,'YLim',[MinA MaxA])
    938957                set(hcol,'YTick',YTick)
     
    941960        end
    942961    elseif ishandle(hcol)
    943         delete(hcol); %erase existing colorbar if not needed 
     962        delete(hcol); %erase existing colorbar if not needed
    944963    end
    945964else%no scalar plot
    946     if ~isempty(hima) && ishandle(hima) 
     965    if ~isempty(hima) && ishandle(hima)
    947966        delete(hima)
    948967    end
    949968    if ~isempty(hcol)&& ishandle(hcol)
    950        delete(hcol)
     969        delete(hcol)
    951970    end
    952971    PlotParamOut=rmfield(PlotParamOut,'Scalar');
  • trunk/src/series.m

    r427 r428  
    19541954         delete(hget_field)%delete opened versions of get_field
    19551955     end
    1956      SeriesData=get(handles.series,'UserData');
    1957      filename=SeriesData.CurrentInputFile;
    1958      if exist(filename,'file')
    1959         get_field(filename)
     1956     [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(read_GUI(handles.series));
     1957     if exist(filecell{1,1},'file')
     1958        get_field(filecell{1,1})
    19601959     end
    19611960elseif isequal(field,'more...')
  • trunk/src/sub_field.m

    r405 r428  
    300300        end
    301301    end     
    302     if ~testX_1
    303           DimCell=[{XName_1_1} {YName_1_1}];
     302    if ~testX_1% if the second field has structured coordinates
     303          DimCell={XName_1_1,YName_1_1, {YName_1_1,XName_1_1}};
     304    else
     305        DimCell=[DimCell Field_1.VarDimName(ivar_C_1)];
    304306    end
    305307    SubData.ListVarName=[SubData.ListVarName {XName_1_1} {YName_1_1} {AName_1_1}];
    306     DimCell=[DimCell Field_1.VarDimName(ivar_C_1)]; %(TODO: check for dimension names)
    307     if testX_1
     308    % check that a  different dimension name is used for the two fields
     309     if testX_1% if the second field has unstructured coordinates
    308310        for icell=1:numel(DimCell)
    309311            if isequal(DimCell{icell}{1},SubData.VarDimName{1}{1})
     
    311313            end
    312314        end
    313     end
     315     end
    314316    SubData.VarDimName=[SubData.VarDimName DimCell];
    315317    if isfield(Field_1,'VarAttribute')
  • trunk/src/uvmat.m

    r427 r428  
    16111611sub_value= get(handles.SubField,'Value');
    16121612if sub_value % a second input file has been entered
    1613     [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    1614     [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndices_1);
    1615     NomType_1=get(handles.NomType_1,'String');
     1613     [InputFile.RootPath_1,InputFile.SubDir_1,InputFile.RootFile_1,InputFile.FileIndex_1,InputFile.FileExt_1,InputFile.NomType_1]=read_file_boxes_1(handles);   
     1614    [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(InputFile.FileIndex_1);
     1615%     InputFile.NomType_1=get(handles.NomType_1,'String');
    16161616else
    16171617    filename_1=[];
     
    17421742filename=fullfile_uvmat(InputFile.RootPath,InputFile.SubDir,InputFile.RootFile,FileExt,NomType,i1,i2,j1,j2);
    17431743if sub_value
    1744     filename_1=fullfile_uvmat(InputFile.RootPath_1,InputFile.SubDir_1,InputFile.RootFile_1,FileExt_1,NomType_1,i1_1,i2_1,j1_1,j2_1);
     1744    filename_1=fullfile_uvmat(InputFile.RootPath_1,InputFile.SubDir_1,InputFile.RootFile_1,InputFile.FileExt_1,InputFile.NomType_1,i1_1,i2_1,j1_1,j2_1);
    17451745end
    17461746
     
    17621762        set(handles.j2,'String',num2stra(j2,NomType,2));
    17631763    end
    1764    % [indices]=name_generator('',i1,j1,'',NomType,1,i2,j2,'');
    17651764    indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2);
    17661765    set(handles.FileIndex,'String',indices);
    17671766    if ~isempty(filename_1)
    1768         indices_1=fullfile_uvmat('','','','',NomType_1,i1_1,i2_1,j1_1,j2_1);
    1769         %indices_1=name_generator('',i1_1,j1_1,'',NomType_1,1,i2_1,j2_1,'');
     1767        indices_1=fullfile_uvmat('','','','',InputFile.NomType_1,i1_1,i2_1,j1_1,j2_1);
    17701768        set(handles.FileIndex_1,'String',indices_1);
    17711769    end
     
    21052103            end
    21062104    end
     2105    if isequal(get(handles.NomType_1,'Visible'),'on')
    21072106    NomType_1=get(handles.NomType_1,'String');
     2107    else
     2108        NomType_1=get(handles.NomType,'String');
     2109    end
    21082110    test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
    21092111    if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie)
     
    26382640        PlotParam{imap}.Scalar.CheckBW=[]; %B/W option depends on the input field (image or scalar)
    26392641        if isfield(ObjectData,'CoordUnit')
    2640         PlotParam{imap}.Coordinates.CheckFixEqual=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y)
     2642        PlotParam{imap}.Coordinates.CheckFixAspectRatio=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y)
     2643        PlotParam{imap}.Coordinates.AspectRatio=1; %set aspect ratio to 1
    26412644        end
    26422645    end
     
    28832886indy=1+round((nxy(1)-1)*(y12-rangy0(1))/(rangy0(2)-rangy0(1)));% index y of pixel
    28842887
     2888
     2889%-------------------------------------------------------------------
     2890% --- Executes on button press in 'CheckZoom'.
     2891%-------------------------------------------------------------------
     2892function CheckZoom_Callback(hObject, eventdata, handles)
     2893
     2894if (get(handles.CheckZoom,'Value') == 1);
     2895    set(handles.CheckZoom,'BackgroundColor',[1 1 0])
     2896    set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes
     2897    set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
     2898else
     2899    set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
     2900end
     2901
    28852902%-------------------------------------------------------------------
    28862903% --- Executes on button press in 'CheckFixLimits'.
     
    28962913
    28972914%-------------------------------------------------------------------
    2898 % --- Executes on button press in CheckFixEqual.
    2899 function CheckFixEqual_Callback(hObject, eventdata, handles)
    2900 if get(handles.CheckFixEqual,'Value')
    2901     set(handles.CheckFixEqual,'BackgroundColor',[1 1 0])
     2915% --- Executes on button press in CheckFixAspectRatio.
     2916function CheckFixAspectRatio_Callback(hObject, eventdata, handles)
     2917%-------------------------------------------------------------------
     2918if get(handles.CheckFixAspectRatio,'Value')
     2919    set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])
    29022920    update_plot(handles);
    29032921else
    2904     set(handles.CheckFixEqual,'BackgroundColor',[0.7 0.7 0.7])
     2922    set(handles.CheckFixAspectRatio,'BackgroundColor',[0.7 0.7 0.7])
    29052923    update_plot(handles);
    29062924end
    29072925
    29082926%-------------------------------------------------------------------
    2909 
     2927function num_AspectRatio_Callback(hObject, eventdata, handles)
    29102928%-------------------------------------------------------------------
    2911 % --- Executes on button press in 'CheckZoom'.
     2929set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button
     2930set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])% mark in yellow
     2931update_plot(handles);
    29122932%-------------------------------------------------------------------
    2913 function CheckZoom_Callback(hObject, eventdata, handles)
    2914 
    2915 if (get(handles.CheckZoom,'Value') == 1);
    2916     set(handles.CheckZoom,'BackgroundColor',[1 1 0])
    2917     set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes
    2918     set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
    2919 else
    2920     set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    2921 end
     2933
     2934%-------------------------------------------------------------------
     2935
     2936
    29222937
    29232938%-------------------------------------------------------------------
     
    29822997fin=close(nc);
    29832998
    2984 %---------------------------------------------------
     2999%-------------------------------------------------------------------
    29853000% --- Executes on button press in SubField
    29863001function SubField_Callback(hObject, eventdata, handles)
    2987 % huvmat=get(handles.run0,'parent');
     3002%-------------------------------------------------------------------
    29883003UvData=get(handles.uvmat,'UserData');
    29893004if get(handles.SubField,'Value')==0% if the subfield button is desactivated   
     
    30023017    set(handles.Fields_1,'Value',1);%set to blank state
    30033018    set(handles.VelType_1,'Value',1);%set to blank state
     3019    set(handles.num_Opacity,'String','')% desactivate opacity setting
    30043020    if ~strcmp(get(handles.VelType,'Visible'),'on')
    30053021        set(handles.VelType_1,'Visible','off')
     
    31723188if isempty(field_1)%||(numel(UvData.FileType)>=2 && strcmp(UvData.FileType{2},'image'))
    31733189    set(handles.SubField,'Value',0)
    3174 %     check_new=1;
    31753190    SubField_Callback(hObject, eventdata, handles)
    3176 %     if isempty(field_1)%remove second field if 'blank' field is selected
    3177         return
    3178 %     end
     3191    return
    31793192else
    31803193    set(handles.SubField,'Value',1)%state that a second field is now entered
     
    32013214        set(handles.transform_fct,'Value',1)% no transform by default
    32023215        set(handles.path_transform,'String','')
     3216        if check_new
     3217            UvData.FileType{2}=UvData.FileType{1};
     3218            set(handles.FileIndex_1,'String',get(handles.FileIndex,'String'))
     3219%             set(handles.FileExt_1,'String',get(handles.FileExt,'String'))
     3220              set(handles.uvmat,'UserData',UvData)
     3221        end
    32033222    case 'image'
    32043223        % guess the image name corresponding to the current netcdf name (no unique correspondance)
     
    37083727%-------------------------------------------------------------------
    37093728update_plot(handles);
     3729
     3730%-------------------------------------------------------------------
     3731function num_Opacity_Callback(hObject, eventdata, handles)
     3732update_plot(handles);
     3733%-------------------------------------------------------------------
    37103734
    37113735%-------------------------------------------------------------------
     
    47864810    web(helpfile);
    47874811end
    4788 
    4789 
    4790 % --- Executes on slider movement.
    4791 function slider7_Callback(hObject, eventdata, handles)
    4792 % hObject    handle to slider7 (see GCBO)
    4793 % eventdata  reserved - to be defined in a future version of MATLAB
    4794 % handles    structure with handles and user data (see GUIDATA)
    4795 
    4796 % Hints: get(hObject,'Value') returns position of slider
    4797 %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  • trunk/src/view_field.m

    r425 r428  
    308308
    309309%-------------------------------------------------------------------
    310 % --- Executes on button press in 'FixLimits'.
    311 %-------------------------------------------------------------------
    312 function CheckFixLimits_Callback(hObject, eventdata, handles)
    313 test=get(handles.CheckFixLimits,'Value');
    314 if test
    315     set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
    316 else
    317     set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
    318 end
    319 update_plot(handles)
    320 
    321 %-------------------------------------------------------------------
    322 % --- Executes on button press in FixEqual.
    323 function CheckFixEqual_Callback(hObject, eventdata, handles)
    324 test=get(handles.CheckFixEqual,'Value');
    325 if test
    326     set(handles.CheckFixEqual,'BackgroundColor',[1 1 0])
    327 else
    328     set(handles.CheckFixEqual,'BackgroundColor',[0.7 0.7 0.7])
    329 end
    330  update_plot(handles)
    331 
    332 %-------------------------------------------------------------------
    333 
    334 %-------------------------------------------------------------------
    335310% --- Executes on button press in 'zoom'.
    336311%-------------------------------------------------------------------
     
    343318    set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    344319end
     320
     321%-------------------------------------------------------------------
     322% --- Executes on button press in 'FixLimits'.
     323%-------------------------------------------------------------------
     324function CheckFixLimits_Callback(hObject, eventdata, handles)
     325test=get(handles.CheckFixLimits,'Value');
     326if test
     327    set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
     328else
     329    set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
     330end
     331update_plot(handles)
     332 
     333 %-------------------------------------------------------------------
     334% --- Executes on button press in CheckFixAspectRatio.
     335function CheckFixAspectRatio_Callback(hObject, eventdata, handles)
     336%-------------------------------------------------------------------
     337if get(handles.CheckFixAspectRatio,'Value')
     338    set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])
     339    update_plot(handles);
     340else
     341    set(handles.CheckFixAspectRatio,'BackgroundColor',[0.7 0.7 0.7])
     342    update_plot(handles);
     343end
     344
     345%-------------------------------------------------------------------
     346function num_AspectRatio_Callback(hObject, eventdata, handles)
     347%-------------------------------------------------------------------
     348set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button
     349set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])% mark in yellow
     350update_plot(handles);
     351
     352%-------------------------------------------------------------------
    345353
    346354% %-------------------------------------------------------------------
     
    746754% --- Executes on selection change in ColorCode.
    747755function ColorCode_Callback(hObject, eventdata, handles)
    748 % hObject    handle to ColorCode (see GCBO)
    749 % eventdata  reserved - to be defined in a future version of MATLAB
    750 % handles    structure with handles and user data (see GUIDATA)
    751 
    752 % Hints: contents = cellstr(get(hObject,'String')) returns ColorCode contents as cell array
    753 %        contents{get(hObject,'Value')} returns selected item from ColorCode
    754756
    755757
    756758% --- Executes on selection change in ColorScalar.
    757759function ColorScalar_Callback(hObject, eventdata, handles)
    758 % hObject    handle to ColorScalar (see GCBO)
    759 % eventdata  reserved - to be defined in a future version of MATLAB
    760 % handles    structure with handles and user data (see GUIDATA)
    761 
    762 % Hints: contents = cellstr(get(hObject,'String')) returns ColorScalar contents as cell array
    763 %        contents{get(hObject,'Value')} returns selected item from ColorScalar
    764 
    765760
    766761
    767762function num_ColCode2_Callback(hObject, eventdata, handles)
    768 % hObject    handle to num_colcode2 (see GCBO)
    769 % eventdata  reserved - to be defined in a future version of MATLAB
    770 % handles    structure with handles and user data (see GUIDATA)
    771 
    772 % Hints: get(hObject,'String') returns contents of num_colcode2 as text
    773 %        str2double(get(hObject,'String')) returns contents of num_colcode2 as a double
     763
     764
     765
  • trunk/src/write_plot_param.m

    r421 r428  
    44if isfield(PlotParam,'Coordinates')
    55    Coordinates=PlotParam.Coordinates;
    6     if isfield(Coordinates,'CheckFixEqual')
    7         if Coordinates.CheckFixEqual
    8             set(handles.CheckFixEqual,'Value',1)
    9             set(handles.CheckFixEqual,'BackgroundColor',[1 1 0])
     6    if isfield(Coordinates,'CheckFixAspectRatio')
     7        if Coordinates.CheckFixAspectRatio
     8            set(handles.CheckFixAspectRatio,'Value',1)
     9            set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])
    1010        else
    11             set(handles.CheckFixEqual,'Value',0)
    12             set(handles.CheckFixEqual,'BackgroundColor',[0.7 0.7 0.7])
     11            set(handles.CheckFixAspectRatio,'Value',0)
     12            set(handles.CheckFixAspectRatio,'BackgroundColor',[0.7 0.7 0.7])
    1313        end
    1414    end
     15    if isfield(Coordinates,'AspectRatio')
     16        set(handles.num_AspectRatio,'String',num2str(Coordinates.AspectRatio))
     17    end   
    1518    if isfield(Coordinates,'MinX')
    1619        set(handles.num_MinX,'String',num2str(Coordinates.MinX,4));
     
    3437    if isfield(PlotParam.Scalar,'MinA')
    3538        set(handles.num_MinA,'String',num2str(PlotParam.Scalar.MinA,3));
    36     end
    37    
     39    end   
    3840    if isfield(PlotParam.Scalar,'IncrA')
    3941        set(handles.num_IncrA,'String',num2str(PlotParam.Scalar.IncrA,3))
    4042    end
    4143    set(handles.CheckBW,'Value',PlotParam.Scalar.CheckBW)
     44    if isfield(PlotParam.Scalar,'Opacity')&&isfield(handles,'num_Opacity')
     45        set(handles.num_Opacity,'String',num2str(PlotParam.Scalar.Opacity))
     46    end
    4247else
    4348    set(handles.Scalar,'Visible','off')
Note: See TracChangeset for help on using the changeset viewer.