Changeset 748


Ignore:
Timestamp:
Apr 23, 2014, 4:57:58 PM (7 years ago)
Author:
sommeria
Message:

update for 3D plots, panel Coordiantes introduces, while coordiantes now called Axes

Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_field.m

    r747 r748  
    159159set(handles.vector_x,'String',Field.Display.ListVarName)% fill the menu of x vector components
    160160set(handles.vector_y,'String',Field.Display.ListVarName)% fill the menu of y vector components
    161 set(handles.vector_z,'String',Field.Display.ListVarName)% fill the menu of y vector components
     161set(handles.vector_z,'String',[{''} Field.Display.ListVarName])% fill the menu of y vector components
    162162set(handles.vec_color,'String',[{''} Field.Display.ListVarName])% fill the menu of y vector components
    163163set(handles.scalar,'Value',1)% fill the menu of y vector components
     
    165165set(handles.ordinate,'Value',1)% fill the menu of y vector components
    166166set(handles.ordinate,'String',Field.Display.ListVarName)% fill the menu of y coordinate for 1D plots
    167 if isfield(Field,'Conventions')&& strcmp(Field.Conventions,'uvmat/civdata')
     167checkseries=0;
     168if isfield(ParamIn,'SeriesInput') && ParamIn.SeriesInput
     169    set(handles.FieldOption,'value',1)
     170    set(handles.FieldOption,'String',{'scalar'})% case of call by series, only scalar
     171    checkseries=1;
     172    set(handles.scalar,'Max',2)
     173elseif isfield(Field,'Conventions')&& strcmp(Field.Conventions,'uvmat/civdata')
    168174    set(handles.FieldOption,'String',{'1D plot';'scalar';'vectors';'civdata...'})% provides the possibility to come back to civdata
     175    set(handles.scalar,'Max',1)
    169176else
    170177    set(handles.FieldOption,'String',{'1D plot';'scalar';'vectors'})
    171 end
    172 if Field.MaxDim>=2 % case of 2D (or 3D) fields
     178    set(handles.scalar,'Max',1)
     179end
     180if Field.MaxDim>=2 && ~checkseries% case of 2D (or 3D) fields
    173181    check_vec_input=0;
    174182    if isfield(ParamIn,'vector_x')&& isfield(ParamIn,'vector_y')
     
    204212    set(handles.dimensions,'String',Tabchar)
    205213end
    206 set(handles.variables,'Value',1)
    207 set(handles.variables,'String',[{'*'} Field.ListVarName])
    208 variables_Callback(handles.variables,[], handles)% list the global attributes
    209214
    210215%% fill menus for coordinates and time
     
    246251end
    247252Check3D_Callback(hObject, eventdata, handles)
     253set(handles.variables,'Value',1)
     254set(handles.variables,'String',[{'*'} Field.ListVarName])
     255variables_Callback(handles.variables,[], handles)% list the global attributes
    248256drawnow
    249257uiwait(handles.get_field);
     
    311319else
    312320    list_var=get(handles.variables,'String');
     321    if index>numel(list_var)
     322        return
     323    end
    313324    var_select=list_var{index};
    314325    set(handles.attributes_txt,'String', ['attributes of ' var_select])
     
    329340        end
    330341    end
    331    
    332342end
    333343if ~isempty(Tabcell)
  • trunk/src/nc2struct.m

    r747 r748  
    183183        end
    184184        ListVarName=ListVarName(:,logical(check_keep));
    185         sizvar=size(ListVarName);
    186         var_index=zeros(1,sizvar(2));%default
    187         if sizvar(1)>1 %multiple choice of variable ranked by order of priority
    188             for iline=1:sizvar(1)
     185        if size(ListVarName,1)>1 %multiple choice of variable ranked by order of priority
     186            for iline=1:size(ListVarName,1)
    189187                search_index=find(strcmp(ListVarName{iline,1},ListVarNameNetcdf),1);%look for the first variable name in the list of netcdf variables
    190188                if ~isempty(search_index)
     
    206204            ListVarName=[ListVarName {TimeVarName}];
    207205        end
     206        var_index=zeros(1,size(ListVarName,2));%default list of variable indices
    208207        for ivar=1:size(ListVarName,2)
    209208            search_index=find(strcmp(ListVarName{iline,ivar},ListVarNameNetcdf),1);%look for the variable name in the list of netcdf file
  • trunk/src/plot_field.m

    r735 r748  
    4545%   PlotParam: structure containing the parameters for plotting, as read on the uvmat or view_field GUI (by function 'read_GUI.m').
    4646%      Contains three substructures:
    47 %     .Coordinates: coordinate parameters:
     47%     .Axes: coordinate parameters:
    4848%           .CheckFixLimits:=0 (default) adjust axes limit to the X,Y data, =1: preserves the previous axes limits
    49 %     .Coordinates.CheckFixAspectRatio: =0 (default):automatic adjustment of the graph, keep 1 to 1 aspect ratio for x and y scales.
    50 %     .Coordinates.AspectRatio: imposed aspect ratio y/x of axis unit plots
     49%     .Axes.CheckFixAspectRatio: =0 (default):automatic adjustment of the graph, keep 1 to 1 aspect ratio for x and y scales.
     50%     .Axes.AspectRatio: imposed aspect ratio y/x of axis unit plots
    5151%            --scalars--
    5252%    .Scalar.MaxA: upper bound (saturation color) for the scalar representation, max(field) by default
     
    103103PlotType='text'; %default
    104104if ~isfield(PlotParam,'Coordinates')
    105     PlotParam.Coordinates=[];
     105    PlotParam.Axes=[];
    106106    if isfield(Data,'CoordUnit')
    107         PlotParam.Coordinates.CheckFixAspectRatio=1;
    108         PlotParam.Coordinates.AspectRatio=1; %set axes equal by default if CoordUnit is defined
     107        PlotParam.Axes.CheckFixAspectRatio=1;
     108        PlotParam.Axes.AspectRatio=1; %set axes equal by default if CoordUnit is defined
    109109    end
    110110end
     
    160160
    161161%% set axes properties
    162 if isfield(PlotParamOut.Coordinates,'CheckFixLimits') && isequal(PlotParamOut.Coordinates.CheckFixLimits,1)  %adjust the graph limits
     162if isfield(PlotParamOut.Axes,'CheckFixLimits') && isequal(PlotParamOut.Axes.CheckFixLimits,1)  %adjust the graph limits
    163163    set(haxes,'XLimMode', 'manual')
    164164    set(haxes,'YLimMode', 'manual')
     
    193193        CheckHold= PlotParam.CheckHold;
    194194    end       
    195     PlotParamOut.Coordinates=plot_profile(Data,CellInfo(index_1D),haxes,PlotParamOut.Coordinates,CheckHold);%
     195    PlotParamOut.Axes=plot_profile(Data,CellInfo(index_1D),haxes,PlotParamOut.Axes,CheckHold);%
    196196    if testzoomaxes
    197         [zoomaxes,PlotParamOut.Coordinates]=plot_profile(Data,CellInfo(index_1D),zoomaxes,PlotParamOut.Coordinates,CheckHold);
     197        [zoomaxes,PlotParamOut.Axes]=plot_profile(Data,CellInfo(index_1D),zoomaxes,PlotParamOut.Axes,CheckHold);
    198198        AxeData.ZoomAxes=zoomaxes;
    199199    end
     
    897897            end
    898898           
    899             if isfield(PlotParam.Coordinates,'CheckFixAspectRatio') && isequal(PlotParam.Coordinates.CheckFixAspectRatio,1)
     899            if isfield(PlotParam.Axes,'CheckFixAspectRatio') && isequal(PlotParam.Axes.CheckFixAspectRatio,1)
    900900                set(haxes,'DataAspectRatioMode','manual')
    901                 if isfield(PlotParam.Coordinates,'AspectRatio')
    902                     set(haxes,'DataAspectRatio',[PlotParam.Coordinates.AspectRatio 1 1])
     901                if isfield(PlotParam.Axes,'AspectRatio')
     902                    set(haxes,'DataAspectRatio',[PlotParam.Axes.AspectRatio 1 1])
    903903                else
    904904                    set(haxes,'DataAspectRatio',[1 1 1])
     
    11671167    MinY=[];
    11681168    MaxY=[];
    1169     fix_lim=isfield(PlotParam.Coordinates,'CheckFixLimits') && PlotParam.Coordinates.CheckFixLimits;
     1169    fix_lim=isfield(PlotParam.Axes,'CheckFixLimits') && PlotParam.Axes.CheckFixLimits;
    11701170    if fix_lim
    1171         if isfield(PlotParam.Coordinates,'MinX')&&isfield(PlotParam.Coordinates,'MaxX')&&isfield(PlotParam.Coordinates,'MinY')&&isfield(PlotParam.Coordinates,'MaxY')
    1172             MinX=PlotParam.Coordinates.MinX;
    1173             MaxX=PlotParam.Coordinates.MaxX;
    1174             MinY=PlotParam.Coordinates.MinY;
    1175             MaxY=PlotParam.Coordinates.MaxY;
     1171        if isfield(PlotParam.Axes,'MinX')&&isfield(PlotParam.Axes,'MaxX')&&isfield(PlotParam.Axes,'MinY')&&isfield(PlotParam.Axes,'MaxY')
     1172            MinX=PlotParam.Axes.MinX;
     1173            MaxX=PlotParam.Axes.MaxX;
     1174            MinY=PlotParam.Axes.MinY;
     1175            MaxY=PlotParam.Axes.MaxY;
    11761176        end  %else PlotParamOut.MinX =PlotParam.MinX...
    11771177    else
     
    11941194        end
    11951195    end
    1196     PlotParamOut.Coordinates.MinX=MinX;
    1197     PlotParamOut.Coordinates.MaxX=MaxX;
    1198     PlotParamOut.Coordinates.MinY=MinY;
    1199     PlotParamOut.Coordinates.MaxY=MaxY;
     1196    PlotParamOut.Axes.MinX=MinX;
     1197    PlotParamOut.Axes.MaxX=MaxX;
     1198    PlotParamOut.Axes.MinY=MinY;
     1199    PlotParamOut.Axes.MaxY=MaxY;
    12001200    if MaxX>MinX
    12011201        set(haxes,'XLim',[MinX MaxX]);% set x limits of frame in axes coordinates
     
    12071207    set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']);
    12081208    set(get(haxes,'YLabel'),'String',[YName ' (' y_units ')']);
    1209     PlotParamOut.Coordinates.x_units=x_units;
    1210     PlotParamOut.Coordinates.y_units=y_units;
    1211 end
    1212 if isfield(PlotParam,'Coordinates') && isfield(PlotParam.Coordinates,'CheckFixAspectRatio') && isequal(PlotParam.Coordinates.CheckFixAspectRatio,1)
     1209    PlotParamOut.Axes.x_units=x_units;
     1210    PlotParamOut.Axes.y_units=y_units;
     1211end
     1212if isfield(PlotParam,'Coordinates') && isfield(PlotParam.Axes,'CheckFixAspectRatio') && isequal(PlotParam.Axes.CheckFixAspectRatio,1)
    12131213    set(haxes,'DataAspectRatioMode','manual')
    1214     if isfield(PlotParam.Coordinates,'AspectRatio')
    1215         set(haxes,'DataAspectRatio',[PlotParam.Coordinates.AspectRatio 1 1])
     1214    if isfield(PlotParam.Axes,'AspectRatio')
     1215        set(haxes,'DataAspectRatio',[PlotParam.Axes.AspectRatio 1 1])
    12161216    end
    12171217else
  • trunk/src/proj_field.m

    r747 r748  
    13601360                            VarDimName=[VarDimName {DimCell}];
    13611361                            VarAttribute{length(ListVarName)}=FieldData.VarAttribute{ivar}; %reproduce the variable attributes
    1362                             eval(['ProjData.' VarName '=permute(FieldData.' VarName ',ind_new);'])% permute x and z indices for 90 degree rotation
    1363                             eval(['ProjData.' VarName '=squeeze(ProjData.' VarName '(iz,:,:));'])% select the z index iz
     1362                            ProjData.(VarName)=permute(FieldData.(VarName),ind_new);% permute x and z indices for 90 degree rotation
     1363                            ProjData.(VarName)=squeeze(ProjData.(VarName)(iz,:,:));% select the z index iz
    13641364                        end
    13651365                        ProjData.(AYName)=[Ybound(1) Ybound(2)]; %record the new (projected ) y coordinates
     
    13901390                            end
    13911391                        end
    1392                         ProjData.(AYName)=Coord{NbDim-1}(1)+DY*(YIndexRange-1); %record the new (projected ) y coordinates
    1393                         ProjData.(AXName)=Coord{NbDim}(1)+DX*(XIndexRange-1); %record the new (projected ) x coordinates
     1392                        if testXMax
     1393                         ProjData.(AXName)=Coord{NbDim}(1)+DX*(XIndexRange-1); %record the new (projected ) x coordinates
     1394                        else
     1395                          ProjData.(AXName)=FieldData.(AXName);
     1396                        end
     1397                        if testYMax
     1398                            ProjData.(AYName)=Coord{NbDim-1}(1)+DY*(YIndexRange-1); %record the new (projected ) x coordinates
     1399                        else
     1400                          ProjData.(AYName)=FieldData.(AYName);
     1401                        end                           
    13941402                    end
    13951403                end
  • trunk/src/read_field.m

    r747 r748  
    2626
    2727function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,num)
     28%% default output and check input
    2829Field=[];
    2930if ~exist('num','var')
     
    5960%% distingush different input file types
    6061switch FileType
    61     case 'civdata'
     62    case 'civdata'% new format for civ results
    6263        [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType);
    6364        if ~isempty(errormsg),errormsg=['read_civdata / ' errormsg];return,end
    6465        ParamOut.CivStage=Field.CivStage;
    65     case 'civx'
     66    case 'civx'% old (obsolete) format for civ results
    6667        ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
    6768        [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType);
    6869        if ~isempty(errormsg),errormsg=['read_civxdata / ' errormsg];return,end
    6970        ParamOut.CivStage=Field.CivStage;
    70     case 'netcdf'
     71    case 'netcdf'% general netcdf file (not recognized as civ)
    7172        ListVar={};
    7273        Role={};
     
    7778        checkV=0;
    7879        for ilist=1:numel(InputField)
     80            % look for input variables to read
    7981            r=regexp(InputField{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names');
    8082            if isempty(r)%  no operator used
     
    119121            end
    120122        end
     123        if ~isfield(ParamIn,'Coord_z')
     124            ParamIn.Coord_z=[];
     125        end
     126        NbCoord=~isempty(ParamIn.Coord_x)+~isempty(ParamIn.Coord_y)+~isempty(ParamIn.Coord_z);
    121127        if isfield(ParamIn,'TimeDimName')% case of reading of a single time index in a multidimensional array
    122             [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeDimName',ParamIn.TimeDimName,num,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]);
     128            [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeDimName',ParamIn.TimeDimName,num,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVar]);
    123129        elseif isfield(ParamIn,'TimeVarName')% case of reading of a single time  in a multidimensional array
    124             [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeVarName',ParamIn.TimeVarName,num,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]);
    125         else
    126             [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,[ParamIn.Coord_x (ParamIn.Coord_y) (ParamIn.Coord_z) ListVar]);
     130            [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeVarName',ParamIn.TimeVarName,num,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVar]);
     131            NbCoord=NbCoord+1;% adds time coordinate
     132        else
     133            [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVar]);
    127134        end
    128135        if ~isempty(errormsg)
    129136            return
    130137        end
    131         for ilist=3:numel(Field.VarDimName)
    132             if isequal(Field.VarDimName{1},Field.VarDimName{ilist})
     138        %scan all the variables beyond the two first ones, ParamIn.Coord_x and ParamIn.Coord_y.
     139        for ilist=NbCoord+1:numel(Field.VarDimName)
     140            if isequal(Field.VarDimName{1},Field.VarDimName{ilist}) % if a variable has the same dimension as the coordinate, it denotes a field with unstructured coordinates
    133141                Field.VarAttribute{1}.Role='coord_x';%unstructured coordinates
    134142                Field.VarAttribute{2}.Role='coord_y';
     143                if NbCoord>=3
     144                    Field.VarAttribute{3}.Role='coord_z';
     145                end
    135146                break
    136147            end
     
    140151        VName='';
    141152        for ilist=1:numel(ListVar)
    142             Field.VarAttribute{ilist+2}.Role=Role{ilist};
    143             Field.VarAttribute{ilist+2}.ProjModeRequest=ProjModeRequest{ilist};
     153            Field.VarAttribute{ilist+NbCoord}.Role=Role{ilist};
     154            Field.VarAttribute{ilist+NbCoord}.ProjModeRequest=ProjModeRequest{ilist};
    144155            if isfield(ParamIn,'FieldName')
    145                 Field.VarAttribute{ilist+2}.FieldName=ListInputField{ilist};
     156                Field.VarAttribute{ilist+NbCoord}.FieldName=ListInputField{ilist};
    146157            end
    147158            r=regexp(ListInputField{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names');
  • trunk/src/series.m

    r735 r748  
    22412241    Param=read_GUI(handles.series);
    22422242    Param.InputTable=Param.InputTable(1,:);
    2243     filecell=get_file_series(Param);
    2244    
    2245     if exist(filecell{1,1},'file')
    2246         GetFieldData=get_field(filecell{1,1});
     2243     % check the existence of the first file in the series
     2244    first_j=[];
     2245    if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
     2246    last_j=[];
     2247    if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
     2248    PairString='';
     2249    if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end
     2250    [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString);
     2251    FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
     2252        Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
     2253%     filecell=get_file_series(Param);
     2254%     
     2255    if exist(FirstFileName,'file')
     2256        ParamIn.SeriesInput=1;
     2257        GetFieldData=get_field(FirstFileName,ParamIn);
    22472258        FieldList={};
    22482259        switch GetFieldData.FieldOption
     
    22612272                end
    22622273            case 'scalar'
    2263                 AName=GetFieldData.PanelScalar.scalar;
     2274                FieldList=GetFieldData.PanelScalar.scalar;
    22642275                YName={GetFieldData.Coordinates.Coord_y};
    2265                 FieldList={AName};
     2276                if ischar(FieldList)
     2277                FieldList={FieldList};
     2278                end
    22662279            case '1D plot'
    22672280                YName=GetFieldData.PanelOrdinate.ordinate;
  • trunk/src/uvmat.m

    r747 r748  
    8383% velocity vectors. The scalar values in the first case is represented by
    8484% UvData.Field.A, and by UvData.Field.C in the second case. The corresponding set of X
    85 % and Y coordinates are represented by UvData.Field.AX and UvData.Field.AY, and .X and
     85% and Y axes are represented by UvData.Field.AX and UvData.Field.AY, and .X and
    8686% .Y for C (the same as velocity vectors). If A is a nxxny matrix (scalar
    8787% on a regtular grid), then .AX andf.AY contains only two elements, represneting the
    88 % coordinates of the four image corners. The scalar name is represented by
     88% axes of the four image corners. The scalar name is represented by
    8989% the strings .AName and/or .CName.
    9090% If the scalar exists in an input open (image or scalar stored under its
     
    9595% Properties attached to plotting figures (standard Matlab properties):
    9696%    'CurrentAxes'= gca or get(gcf,'CurrentAxes');
    97 %    'CurrentPoint'=get(gcf,'CurrentPoint'): figure coordinates of the point over which the mouse is positioned
     97%    'CurrentPoint'=get(gcf,'CurrentPoint'): figure axes of the point over which the mouse is positioned
    9898%    'CurrentCharacter'=get(gcf,'CurrentCharacter'): last character typed  over the figure where the mouse is positioned
    9999%    'WindowButtonMotionFcn': function permanently called by mouse motion over the figure
     
    103103
    104104% Properties attached to plotting axes:
    105 %    'CurrentPoint'=get(gca,'CurrentPoint'); (standard Matlab) same as for the figure, but position in plot coordinates.
     105%    'CurrentPoint'=get(gca,'CurrentPoint'); (standard Matlab) same as for the figure, but position in plot axes.
    106106%     AxeData:=get(gca,'UserData');
    107107%     AxeData.Drawing  = create: create a new object
     
    120120%    ObjectData.Type=...: style of projection object:
    121121%              .ProjMode
    122 %              .Coord: defines the position of the object
     122%              .Coordinates: defines the position of the object
    123123%              .XMin,YMin....
    124124%              .XMax,YMax....
     
    191191set(hObject,'Position',[LeftX LowY Width Height])
    192192UvData.OpenParam.PosColorbar=[0.80 0.02 0.018 0.445];
    193 % UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib
    194193AxeData.LimEditBox=1; %initialise AxeData
    195194set(handles.PlotAxes,'UserData',AxeData)
     
    396395% set(handles.CheckHold,'Position',pos_CheckHold)
    397396
    398 %% reset position of Coordinates
     397%% reset position of Coordinates panel
    399398set(handles.Coordinates,'Units','pixels')
    400399pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates'
     
    404403set(handles.Coordinates,'Position',pos_2)
    405404
     405%% reset position of Axes panel
     406set(handles.Axes,'Units','pixels')
     407pos_3=get(handles.Axes,'Position');% [lower x lower y width height] for frame 'Coordinates'
     408pos_3(3)=ColumnWidth;
     409pos_3(1)=size_fig(3)-pos_3(3);       % set 'Coordinates' to the right of the fig
     410pos_3(2)=pos_2(2)-pos_3(4);          % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
     411set(handles.Axes,'Position',pos_3)
     412
    406413%% reset position of  Scalar
    407414set(handles.Scalar,'Units','pixels')
    408 pos_3=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
    409 pos_3(3)=ColumnWidth;
    410 pos_3(1)=size_fig(3)-pos_3(3);         % set 'Scalar' to the right of the fig
     415pos_4=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
     416pos_4(3)=ColumnWidth;
     417pos_4(1)=size_fig(3)-pos_4(3);         % set 'Scalar' to the right of the fig
    411418if strcmp(get(handles.Scalar,'Visible'),'on')
    412     pos_3(2)=pos_2(2)-pos_3(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
    413 else
    414     pos_3(2)=pos_2(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
    415 end
    416 set(handles.Scalar,'Position',pos_3)
     419    pos_4(2)=pos_3(2)-pos_4(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
     420else
     421    pos_4(2)=pos_3(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
     422end
     423set(handles.Scalar,'Position',pos_4)
    417424
    418425%% reset position of  Vectors
    419426set(handles.Vectors,'Units','pixels')
    420 pos_4=get(handles.Vectors,'Position');
    421 pos_4(3)=ColumnWidth;
    422 pos_4(1)=size_fig(3)-pos_4(3);
     427pos_5=get(handles.Vectors,'Position');
     428pos_5(3)=ColumnWidth;
     429pos_5(1)=size_fig(3)-pos_5(3);
    423430if strcmp(get(handles.Vectors,'visible'),'on')
    424     pos_4(2)=pos_3(2)-pos_4(4);
    425 else
    426     pos_4(2)=pos_3(2);
    427 end
    428 set(handles.Vectors,'Position',pos_4)
     431    pos_5(2)=pos_4(2)-pos_5(4);
     432else
     433    pos_5(2)=pos_4(2);
     434end
     435set(handles.Vectors,'Position',pos_5)
    429436
    430437%% reset position and scale of axis
     
    26262633            break
    26272634        end
    2628         if UvData.Field.NbDim==3% TO GENERALISE
     2635        if UvData.Field.NbDim==3
    26292636            UvData.ProjObject{iobj}.NbDim=3;%test for 3D objects
     2637            if ~isfield(UvData.ProjObject{iobj},'RangeZ')
    26302638            UvData.ProjObject{iobj}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
    2631             UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
    2632             UvData.ProjObject{iobj}.Angle=[0 0 0];
     2639            end
     2640            if ~(isfield(UvData.ProjObject{iobj},'Coord') && UvData.ProjObject{iobj}.Coord(1,3)<UvData.Field.ZMax && UvData.ProjObject{iobj}.Coord(1,3)>UvData.Field.ZMin)
     2641                 UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
     2642            end         
    26332643        end
    26342644        [ObjectData,errormsg]=proj_field(UvData.Field,UvData.ProjObject{iobj});% project field on the object
     
    26392649            PlotParam{imap}.Scalar.CheckBW=[]; %B/W option depends on the input field (image or scalar)
    26402650            if isfield(ObjectData,'CoordUnit')
    2641                 PlotParam{imap}.Coordinates.CheckFixAspectRatio=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y)
    2642                 PlotParam{imap}.Coordinates.AspectRatio=1; %set aspect ratio to 1
     2651                PlotParam{imap}.Axes.CheckFixAspectRatio=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y)
     2652                PlotParam{imap}.Axes.AspectRatio=1; %set aspect ratio to 1
    26432653            end
    26442654        end
     
    27062716    Ustring='';
    27072717    Vstring='';
    2708     % suppress coordinates from the histogram menu
     2718    % suppress axes from the histogram menu
    27092719    for ivar=1:numel(menu_histo)%l loop on field variables:
    27102720        if isfield(UvData.Field,'VarAttribute') && numel(UvData.Field.VarAttribute)>=ivar && isfield(UvData.Field.VarAttribute{ivar},'Role')
     
    27482758
    27492759if UvData.Field.NbDim==3
     2760    set(handles.CheckEditObject,'Value',1)
    27502761    CheckEditObject_Callback(handles.uvmat, [], handles)
    27512762end   
     
    28092820else
    28102821    nxy=size(FieldHisto);
    2811     Amin=double(min(min(min(FieldHisto))));%min of field value
    2812     Amax=double(max(max(max(FieldHisto))));%max of field value
     2822    Amin=double(min(min(min(min(FieldHisto)))));%min of field value
     2823    Amax=double(max(max(max(max(FieldHisto)))));%max of field value
    28132824    if isequal(Amin,Amax)
    28142825        cla(handles.HistoAxes)
     
    31103121switch field 
    31113122    case 'get_field...'
    3112         %% fill the coordinates and variables from selections in get_field
     3123        %% fill the axes and variables from selections in get_field
    31133124        ParamIn=[];
    31143125        % in case of civ data, we use the civ choice as default input for the GUI get_field
     
    32743285switch field_1
    32753286    case 'get_field...'
    3276          %% fill the coordinates and variables from selections in get_field
     3287         %% fill the axes and variables from selections in get_field
    32773288        ParamIn=[];
    32783289        % in case of civ data, we use the civ choice as default input for the GUI get_field
     
    38673878%-------------------------------------------------
    38683879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    3869 % Plot coordinates
     3880% Plot axes
    38703881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    38713882%------------------------------------------------------------------------
     
    43034314    haxes=findobj(hview_field,'tag','axes3');
    43044315    pos=get(hview_field,'Position'); 
    4305     if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     4316    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Axes)% case of no plot display (pure text table)
    43064317        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
    43074318        pos_table=get(h_TableDisplay,'Position');
     
    44804491    haxes=findobj(hview_field,'tag','axes3');
    44814492    pos=get(hview_field,'Position');
    4482     if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     4493    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Axes)% case of no plot display (pure text table)
    44834494        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
    44844495        pos_table=get(h_TableDisplay,'Position');
     
    52325243XmlData.PolarCentre=[x0 y0];
    52335244
    5234 %% display the current image in polar coordinates with origin at the  illumination source
     5245%% display the current image in polar axes with origin at the  illumination source
    52355246currentdir=pwd; 
    52365247uvmatpath=fileparts(which('uvmat'));
     
    55585569%'write_plot_param': update the plotting parameters on the uvmat or view_field interface after a plotting operation
    55595570function write_plot_param(handles,PlotParam)
    5560 %% coordinates
    5561 if isempty(PlotParam.Coordinates)
    5562     set(handles.Coordinates,'Visible','off')
     5571%% axes
     5572if isempty(PlotParam.Axes)
     5573    set(handles.Axes,'Visible','off')
    55635574    set(handles.PlotAxes,'Visible','off')
    55645575    set(handles.text_display,'Visible','off')
    55655576    set(handles.TableDisplay,'Visible','on')
    55665577else
    5567     set(handles.Coordinates,'Visible','on')
     5578    set(handles.Axes,'Visible','on')
    55685579    set(handles.PlotAxes,'Visible','on')
    55695580    set(handles.text_display,'Visible','on')
     
    55715582    set(handles.TableDisplay,'Visible','off')
    55725583    end
    5573     Coordinates=PlotParam.Coordinates;
     5584    Coordinates=PlotParam.Axes;
    55745585    if isfield(Coordinates,'CheckFixAspectRatio')
    55755586        if Coordinates.CheckFixAspectRatio
     
    56665677
    56675678
    5668 
    5669 function Coord_z_Callback(hObject, eventdata, handles)
    5670 % hObject    handle to Coord_z (see GCBO)
     5679% --- Executes on selection change in SwitchCoordIndex.
     5680function SwitchCoordIndex_Callback(hObject, eventdata, handles)
     5681% hObject    handle to SwitchCoordIndex (see GCBO)
    56715682% eventdata  reserved - to be defined in a future version of MATLAB
    56725683% handles    structure with handles and user data (see GUIDATA)
    56735684
    5674 % Hints: get(hObject,'String') returns contents of Coord_z as text
    5675 %        str2double(get(hObject,'String')) returns contents of Coord_z as a double
    5676 
    5677 
    5678 % --- Executes during object creation, after setting all properties.
    5679 function Coord_z_CreateFcn(hObject, eventdata, handles)
    5680 % hObject    handle to Coord_z (see GCBO)
    5681 % eventdata  reserved - to be defined in a future version of MATLAB
    5682 % handles    empty - handles not created until after all CreateFcns called
    5683 
    5684 % Hint: edit controls usually have a white background on Windows.
    5685 %       See ISPC and COMPUTER.
    5686 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    5687     set(hObject,'BackgroundColor','white');
    5688 end
     5685% Hints: contents = cellstr(get(hObject,'String')) returns SwitchCoordIndex contents as cell array
     5686%        contents{get(hObject,'Value')} returns selected item from SwitchCoordIndex
  • trunk/src/view_field.m

    r726 r748  
    7979if exist('Field','var')
    8080    [PlotType,PlotParamOut]= plot_field(Field,handles.PlotAxes);%,PlotParam,KeepLim,PosColorbar)
    81     set(handles.Coordinates,'Visible','on')
     81    set(handles.Axes,'Visible','on')
    8282    if isfield(PlotParamOut,'Vectors')
    8383        set(handles.Vectors,'Visible','on')
     
    138138set(handles.CheckHold,'Position',pos_CheckHold)
    139139
    140 %% reset position of Coordinates
    141 pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates'
     140%% reset position of Axes
     141pos_2=get(handles.Axes,'Position');% [lower x lower y width height] for frame 'Coordinates'
    142142pos_2(1)=size_fig(3)-pos_2(3);       % set 'Coordinates' to the right of the fig
    143143pos_2(2)=pos_CheckHold(2)-pos_2(4);          % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
    144 set(handles.Coordinates,'Position',pos_2)
     144set(handles.Axes,'Position',pos_2)
    145145
    146146%% reset position of  Scalar
Note: See TracChangeset for help on using the changeset viewer.