Changeset 429


Ignore:
Timestamp:
May 22, 2012, 1:07:40 AM (9 years ago)
Author:
sommeria
Message:

improvements in object drawing and projection on points

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_down.m

    r427 r429  
    2323
    2424function xy=mouse_down(hObject,eventdata)
    25 
    2625AxeData=[];%default
    2726FigData=get(hObject,'UserData');
     
    5756    test_create=0;
    5857    hset_object=findobj(allchild(0),'tag','set_object');
     58
    5959    if ~isempty(hset_object)
    6060        hPLOT=findobj(hset_object,'tag','PLOT');
    61         test_create=strcmp(get(hPLOT,'enable'),'on') &&~test_edit;
    62     end
    63     %         test_create=~isempty(hset_object)&&~test_edit;
     61        test_create=strcmp(get(hPLOT,'enable'),'on') &&~test_edit;% create new object if set_object is in mode enable and uvmat not in mode 'edit_object'
     62    end
    6463   
    6564    test_cal=isequal(get(hhuvmat.MenuCalib,'checked'),'on');% test for calibration
     
    304303end
    305304
    306 %%  create new projection  object
    307 if  test_create && ~isempty(xy) && ~(isfield(AxeData,'Drawing')&& isequal(AxeData.Drawing,'create'))
     305%%  create projection  object
     306if  test_create && ~isempty(xy) %&& ~(isfield(AxeData,'Drawing')&& isequal(AxeData.Drawing,'create'))
    308307    hset_object=findobj(allchild(0),'tag','set_object');
    309308    % activate this option if the GUI set_object is opened
    310309    if ~isempty(hset_object)
    311         sethandles=guidata(hset_object);% handles of the elements in set_object
     310        sethandles=guidata(hset_object);% handles of the elements in the GUI set_object
    312311        ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object
    313         ObjectData.Coord=[]; %reset previous object coordinates
    314         ObjectData.Coord(1,1)=xy(1,1); % the object first coordinate is set by the mouse position
    315         ObjectData.Coord(1,2)=xy(1,2);
    316         if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
    317             ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle
    318         end
     312        IndexObj=length(UvData.Object);
     313        %initiate a new object
     314        if isempty(UvData.Object{IndexObj});
     315            ObjectData.Coord=[];
     316            ObjectNameNew=ObjectData.Name;
     317            if isempty(ObjectNameNew)
     318                ObjectNameNew=ObjectData.Type;
     319            end
     320            % add an index to the object name if the proposed name already exists
     321           
     322           
     323            vers=0;% index of the name
     324            ListObject=get(hhuvmat.ListObject,'String');
     325            detectname=1;
     326            while ~isempty(detectname)
     327                detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list
     328                if detectname% if the object name already exists
     329                    indstr=regexp(ObjectNameNew,'\D');
     330                    if indstr(end)<length(ObjectNameNew) %object name ends by a number
     331                        vers=str2double(ObjectNameNew(indstr(end)+1:end))+1;
     332                        ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)];
     333                    else
     334                        vers=vers+1;
     335                        ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)];
     336                    end
     337                end
     338            end
     339            ObjectName=ObjectNameNew;
     340            set(sethandles.Name,'String',ObjectName)% display the default name in set_object
     341            ListObject{end}=ObjectName;
     342            set(hhuvmat.ListObject,'String',ListObject);%complement the object list
     343            set(hhuvmat.ListObject_1,'String',ListObject);%complement the object list
     344            set(hhuvmat.ListObject,'Value',IndexObj)
     345            set(hhuvmat.ViewObject,'Value',1)
     346        end
     347        % ObjectData.Coord=[]; %reset previous object coordinates
     348        %         ObjectData.Coord(1,1)=xy(1,1); % the object first coordinate is set by the mouse position
     349        %         ObjectData.Coord(1,2)=xy(1,2);
     350        %         if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
     351        %             ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle
     352        %         end
     353        ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
     354        %                 if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
     355        %                     xy(1,3)=AxeData.ObjectCoord(1,3); % z coordinate of the mouse: to generalise ...
     356        %                 else
     357        %                     xy(1,3)=0; % z coordinate set to 0 by default
     358        %                 end
     359        %                 if ~isequal(ObjectData.Coord,xy(1,:))
     360        %                     ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
     361        %                 end
     362       
    319363        AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject
    320         if isfield(UvData,'Object')
    321             IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface
    322         else
    323             IndexObj=2;% the first object is used for uvmat display or blank
    324         end
    325         UvData.Object{IndexObj}=ObjectData;
    326         ListObject=get(hhuvmat.ListObject,'String');
    327         UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject;
    328         ObjectNameNew=ObjectData.Name;
    329         if isempty(ObjectNameNew)
    330              ObjectNameNew=ObjectData.Type;
    331         end
    332         % add an index to the object name if the proposed name already exists
    333         vers=0;% index of the name
    334         detectname=1;
    335         while ~isempty(detectname)
    336             detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list
    337             if detectname% if the object name already exists
    338                 indstr=regexp(ObjectNameNew,'\D');
    339                 if indstr(end)<length(ObjectNameNew) %object name ends by a number
    340                     vers=str2double(ObjectNameNew(indstr(end)+1:end))+1;
    341                     ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)];
    342                 else
    343                     vers=vers+1;
    344                     ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)];
    345                 end
    346             end
    347         end
    348         ObjectName=ObjectNameNew;
    349         set(sethandles.Name,'String',ObjectName)% display the default name in set_object
    350         set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
    351         set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list
    352         set(hhuvmat.ListObject,'Value',IndexObj)
    353         set(hhuvmat.ViewObject,'Value',1)
     364        %         if isfield(UvData,'Object')
     365        %             IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface
     366        %         else
     367        %             IndexObj=2;% the first object is used for uvmat display or blank
     368        %         end
     369        UvData.Object{IndexObj}=ObjectData;     
     370        UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject;     
    354371        UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject;
    355372        set(huvmat,'UserData',UvData)
     
    358375        set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
    359376        AxeData.Drawing='create';% flag for mouse motion
    360     end
    361 end
    362 
    363 % create calibration points if the GUI geometry_calib is opened, if the main axes axes3 of uvmat has ben selected
     377        %show object coordinates in the GUI set_object
     378        h_set_object=findobj(allchild(0),'Tag','set_object');
     379        hh_set_object=guidata(h_set_object);
     380        set(hh_set_object.Coord,'Data',ObjectData.Coord);
     381    end
     382end
     383
     384%% create calibration points if the GUI geometry_calib is opened, if the main axes axes3 of uvmat has ben selected
    364385if ~test_zoom && test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'axes3')
    365386    h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
     
    426447end
    427448
    428 % edit vectors
     449%% edit vectors
    429450if test_edit_vect && ~isempty(ivec)
    430451    %create the error flag FF if it does not exist
     
    445466    eval(['FigData.' tagaxes '=Field;'])%record the modified field in FigData
    446467    set(hcurrentfig,'UserData',FigData);
    447 end   
     468end 
    448469set(haxes,'UserData',AxeData);
    449470
  • trunk/src/mouse_up.m

    r425 r429  
    6060    IndexObj=PlotData.IndexObj;
    6161    ObjectData=UvData.Object{IndexObj};   
    62     ObjectData.enable_plot=1;
    63    
     62%     ObjectData.enable_plot=1;
     63    if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
     64        NbDefPoint=1; 
     65    elseif strcmp(ObjectData.Type,'line')|| strcmp(ObjectData.Type,'plane');
     66        NbDefPoint=2;
     67    else
     68         NbDefPoint=3;
     69    end
    6470    % ending translation
    6571    if isequal(AxeData.Drawing,'translate')
     
    7884    %creating object   
    7985    else   
    80         if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||...
    81                 strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points')
    82             if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
    83               xy(1,3)=AxeData.ObjectCoord(1,3); % z coordinate of the mouse: to generalise ...
    84             else
    85                  xy(1,3)=0; % z coordinate set to 0 by default
    86             end
    87             if ~isequal(ObjectData.Coord,xy(1,:))
    88                 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordiantes marked by the mouse to the eobject
    89             end
    90         elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse')||isequal(ObjectData.Type,'volume')
    91             XYData=AxeData.CurrentOrigin;
    92             ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
    93             ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
    94             ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
    95             ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
    96         elseif isequal(ObjectData.Type,'plane') %case of 'plane'
    97             DX=(xy(1,1)-ObjectData.Coord(1,1));
    98             DY=(xy(1,2)-ObjectData.Coord(1,2));
    99             ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width
    100             if isfield(ObjectData,'RangeX')
    101                 XMax=sqrt(DX*DX+DY*DY);
    102                 if XMax>max(ObjectData.RangeX)
    103                     ObjectData.RangeX=[min(ObjectData.RangeX) XMax];
    104                 end
    105             end
    106         end
    107     end
    108     if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
    109         NbDefPoint=1; 
    110     elseif strcmp(ObjectData.Type,'line')|| strcmp(ObjectData.Type,'plane');
    111         NbDefPoint=2;
    112     else
    113          NbDefPoint=3;
     86        switch ObjectData.Type
     87            case {'line'}
     88                if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
     89                    xy(1,3)=AxeData.ObjectCoord(1,3); % z coordinate of the mouse: to generalise ...
     90                else
     91                    xy(1,3)=0; % z coordinate set to 0 by default
     92                end
     93%                 if ~isequal(ObjectData.Coord,xy(1,:))
     94                     if ~isequal(ObjectData.Coord(end,1:2),xy(1,1:2))
     95                    ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the second point of the line if different from the first one
     96                     end
     97%                 end
     98            case {'rectangle','ellipse','volume'}
     99                XYData=AxeData.CurrentOrigin;
     100                ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
     101                ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
     102                ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
     103                ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
     104            case 'plane' %case of 'plane'
     105                DX=(xy(1,1)-ObjectData.Coord(1,1));
     106                DY=(xy(1,2)-ObjectData.Coord(1,2));
     107                ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width
     108                if isfield(ObjectData,'RangeX')
     109                    XMax=sqrt(DX*DX+DY*DY);
     110                    if XMax>max(ObjectData.RangeX)
     111                        ObjectData.RangeX=[min(ObjectData.RangeX) XMax];
     112                    end
     113                end
     114        end
    114115    end
    115116   
     
    118119    hh_set_object=guidata(h_set_object);
    119120    set(hh_set_object.Coord,'Data',ObjectData.Coord);
    120 %     set(hh_set_object.XObject,'String',num2str(ObjectData.Coord(:,1),4));
    121 %     set(hh_set_object.YObject,'String',num2str(ObjectData.Coord(:,2),4));
    122 %     set(hh_set_object.ZObject,'String',num2str(ObjectData.Coord(:,3),4));
    123121    if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
    124122        set(hh_set_object.num_RangeX_2,'String',num2str(ObjectData.RangeX,4));
     
    128126              strcmp(AxeData.Drawing,'translate') || strcmp(AxeData.Drawing,'deform');%stop drawing
    129127        AxeData.CurrentOrigin=[]; %suppress the current origin
    130        if isequal(ObjectData.Type,'line') && size(ObjectData.Coord,1)<=1
     128       if isequal(ObjectData.Type,'line') && size(ObjectData.Coord,1)>=2
    131129           AxeData.Drawing='off';
    132130           set(currentaxes,'UserData',AxeData);
    133             return % line needs at leqst two points
     131%             return % line needs at leqst two points
    134132       end
    135133       if  ~isempty(ObjectData)
     
    153151            if ~isempty(ProjData)
    154152                if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen in view_field
    155                     hview_field=findobj(allchild(0),'tag','view_field');
     153                     hview_field=findobj(allchild(0),'tag','view_field');
    156154                    if isempty(hview_field)
    157                         hview_field=view_field(ProjData);
     155                        hview_field=view_field(ProjData); %open the view_field GUI for plot
    158156                    else
    159                        hhview_field=guidata(hview_field);
    160                        [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing field plot
     157                        hhview_field=guidata(hview_field);
     158                        [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing  plot in view_field
    161159                        write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
    162160                    end
    163161                    ViewFieldData=get(hview_field,'UserData');
    164                     ViewFieldData.axes3=ProjData;
    165                     set(hview_field,'UserData',ViewFieldData)
    166  
     162%                     ViewFieldData.axes3=ProjData;
     163                    haxes=findobj(hview_field,'tag','axes3');
     164                    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     165                        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
     166                        pos_table=get(h_TableDisplay,'Position');
     167                        pos=get(hview_field,'Position');
     168                        set(hview_field,'Position',[pos(1)+pos(3)-pos_table(3) pos(2)+pos(4)-pos_table(4) pos_table(3) pos_table(4)])
     169                        drawnow
     170                        set(hview_field,'UserData',ViewFieldData);% restore the previously stored GUI position after GUI resizing
     171                    else
     172                        set(hview_field,'Position',ViewFieldData.GUISize)
     173                    end
     174                   
     175%                     Data=get(hview_field,'UserData');
     176%                     if isempty(hview_field)
     177%                         hview_field=view_field(ProjData);
     178%                     else
     179%                        hhview_field=guidata(hview_field);
     180%                        [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing field plot
     181%                         write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
     182%                     end
     183%                     ViewFieldData=get(hview_field,'UserData');
     184%                     ViewFieldData.axes3=ProjData;
     185%                     set(hview_field,'UserData',ViewFieldData)
    167186                else
    168187                    UvData.axes3=ProjData;
  • trunk/src/plot_field.m

    r428 r429  
    4848%           .CheckFixLimits:=0 (default) adjust axes limit to the X,Y data, =1: preserves the previous axes limits
    4949%     .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
    5051%            --scalars--
    5152%    .Scalar.MaxA: upper bound (saturation color) for the scalar representation, max(field) by default
     
    143144end
    144145
    145 %% pure text display
    146 if isempty(index_2D) && isempty(index_1D)% no plot
    147     hfig=findobj(allchild(0),'Tag','fig_text_display');
    148     if isempty(hfig)
    149         hfig=figure('name','text_display','Tag','fig_text_display');
    150     end
     146%% test axes and figure
     147testnewfig=1;%test to create a new figure (default)
     148testzoomaxes=0;%test for the existence of a zoom secondary figure attached to the plotting axes
     149if exist('haxes','var')
     150    if ishandle(haxes)
     151        if isequal(get(haxes,'Type'),'axes')
     152            testnewfig=0;
     153            AxeData=get(haxes,'UserData');
     154            if isfield(AxeData,'ZoomAxes')&& ishandle(AxeData.ZoomAxes)
     155                if isequal(get(AxeData.ZoomAxes,'Type'),'axes')
     156                    testzoomaxes=1;
     157                    zoomaxes=AxeData.ZoomAxes;
     158                end
     159            end
     160        end
     161    end
     162end
     163
     164%% create a new figure and axes if the plotting axes does not exist
     165if testnewfig
     166    hfig=figure;
     167    set(hfig,'Units','normalized')
     168    haxes=axes;
     169    set(haxes,'position',[0.13,0.2,0.775,0.73])
     170    PlotParam.NextPlot='add'; %parameter for plot_profile and plot_his
     171else
     172    hfig=get(haxes,'parent');
     173    set(0,'CurrentFigure',hfig)% the parent of haxes becomes the current figure
     174    set(hfig,'CurrentAxes',haxes)%  haxes becomes the current axes of the parent figure
     175end
     176
     177%% set axes properties
     178if isfield(PlotParam.Coordinates,'CheckFixLimits') && isequal(PlotParam.Coordinates.CheckFixLimits,1)  %adjust the graph limits
     179    set(haxes,'XLimMode', 'manual')
     180    set(haxes,'YLimMode', 'manual')
     181else
     182    set(haxes,'XLimMode', 'auto')
     183    set(haxes,'YLimMode', 'auto')
     184end
     185% if ~isfield(PlotParam.Coordinates,'CheckFixAspectRatio')&& isfield(Data,'CoordUnit')
     186%     PlotParam.Coordinates.CheckFixAspectRatio=1;% if CoordUnit is defined, the two coordiantes should be plotted with equal scale by default
     187% end
     188errormsg='';
     189PlotParamOut.Coordinates=[]; %default output
     190AxeData=get(haxes,'UserData');
     191
     192%% 2D plots
     193if isempty(index_2D)
     194    plot_plane([],[],[],haxes);%removes images or vector plots in the absence of 2D field plot
     195else  %plot 2D field
     196    [tild,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),haxes,PlotParam,PosColorbar);
     197    AxeData.NbDim=2;
     198    if testzoomaxes && isempty(errormsg)
     199        [zoomaxes,PlotParamOut,tild,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),zoomaxes,PlotParam,PosColorbar);
     200        AxeData.ZoomAxes=zoomaxes;
     201    end
     202end
     203
     204%% 1D plot (usual graph y vs x)
     205if isempty(index_1D)
     206    if ~isempty(haxes)
     207        plot_profile([],[],[],haxes);%removes usual praphs y vs x in the absence of 1D field plot
     208    end
     209else %plot 1D field (usual graph y vs x)
     210    Coordinates=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes,PlotParam.Coordinates);%
     211    if testzoomaxes
     212        [zoomaxes,Coordinates]=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),zoomaxes,PlotParam.Coordinates);
     213        AxeData.ZoomAxes=zoomaxes;
     214    end
     215    if ~isempty(Coordinates)
     216        PlotParamOut.Coordinates=Coordinates;
     217    end
     218    PlotType='line';
     219end
     220
     221%% text display
     222if isempty(index_2D) && isempty(index_1D)%text display alone
     223    htext=findobj(hfig,'Tag','TableDisplay');
     224else  %text display added to plot
    151225    htext=findobj(hfig,'Tag','text_display');
    152     if isempty(htext)
    153         htext=uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71],'Tag','text_display');
    154     end
     226end
     227if ~isempty(htext)
    155228    if isempty(index_0D)
    156229        set(htext,'String',{''})
     
    158231        [errormsg]=plot_text(Data,CellVarIndex(index_0D),VarType(index_0D),htext);
    159232    end
    160     haxes=[];
    161 end
    162 
    163 %% test axes and figure
    164 if ~isempty(index_2D)|| ~isempty(index_1D)%  plot
    165     testnewfig=1;%test to create a new figure (default)
    166     testzoomaxes=0;%test for the existence of a zoom secondary figure attached to the plotting axes
    167     if exist('haxes','var')
    168         if ishandle(haxes)
    169             if isequal(get(haxes,'Type'),'axes')
    170                 testnewfig=0;
    171                 AxeData=get(haxes,'UserData');
    172                 if isfield(AxeData,'ZoomAxes')&& ishandle(AxeData.ZoomAxes)
    173                     if isequal(get(AxeData.ZoomAxes,'Type'),'axes')
    174                         testzoomaxes=1;
    175                         zoomaxes=AxeData.ZoomAxes;
    176                     end
    177                 end
    178             end
    179         end
    180     end
    181     % create a new figure and axes if the plotting axes does not exist
    182     if testnewfig
    183         hfig=figure;
    184         set(hfig,'Units','normalized')
    185         haxes=axes;
    186         set(haxes,'position',[0.13,0.2,0.775,0.73])
    187         PlotParam.NextPlot='add'; %parameter for plot_profile and plot_his
    188     else
    189         hfig=get(haxes,'parent');
    190         set(0,'CurrentFigure',hfig)% the parent of haxes becomes the current figure
    191         set(hfig,'CurrentAxes',haxes)%  haxes becomes the current axes of the parent figure
    192     end
    193    
    194     %% set axes properties
    195     if isfield(PlotParam.Coordinates,'CheckFixLimits') && isequal(PlotParam.Coordinates.CheckFixLimits,1)  %adjust the graph limits
    196         set(haxes,'XLimMode', 'manual')
    197         set(haxes,'YLimMode', 'manual')
    198     else
    199         set(haxes,'XLimMode', 'auto')
    200         set(haxes,'YLimMode', 'auto')
    201     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
    211     errormsg='';
    212    
    213     %% plot if the input field is valid
    214     AxeData=get(haxes,'UserData');
    215     if isempty(index_2D)
    216         plot_plane([],[],[],haxes);%removes images or vector plots if any
    217     else  %plot 2D field
    218         [tild,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),haxes,PlotParam,PosColorbar);
    219         AxeData.NbDim=2;
    220         if testzoomaxes && isempty(errormsg)
    221             [zoomaxes,PlotParamOut,tild,errormsg]=plot_plane(Data,CellVarIndex(index_2D),VarType(index_2D),zoomaxes,PlotParam,PosColorbar);
    222             AxeData.ZoomAxes=zoomaxes;
    223         end
    224     end
    225     if isempty(index_1D)
    226         if ~isempty(haxes)
    227             plot_profile([],[],[],haxes);%
    228         end
    229     else %plot 1D field (usual graph y vs x)
    230         Coordinates=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes,PlotParam.Coordinates);%
    231         if testzoomaxes
    232             [zoomaxes,Coordinates]=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),zoomaxes,PlotParam.Coordinates);
    233             AxeData.ZoomAxes=zoomaxes;
    234         end
    235         if ~isempty(Coordinates)
    236             PlotParamOut.Coordinates=Coordinates;
    237         end
    238         PlotType='line';
    239     end
    240     % text display
    241     htext=findobj(hfig,'Tag','text_display');
    242     if ~isempty(htext)
    243         if isempty(index_0D)
    244             set(htext,'String',{''})
    245         else
    246             [errormsg]=plot_text(Data,CellVarIndex(index_0D),VarType(index_0D),htext);
    247         end
    248     end
    249233end
    250234
     
    255239
    256240%% update the parameters stored in AxeData
    257 if ishandle(haxes)
     241if ishandle(haxes)&&( ~isempty(index_2D)|| ~isempty(index_1D))
     242%     AxeData=[];
    258243    if isfield(PlotParamOut,'MinX')
    259244        AxeData.RangeX=[PlotParamOut.MinX PlotParamOut.MaxX];%'[PlotParamOut.MinX PlotParamOut.MaxX];
     
    264249
    265250%% update the plotted field stored in parent figure
    266 
    267 FigData=get(hfig,'UserData');
    268 if strcmp(get(hfig,'tag'),'view_field')
    269     set(hfig,'UserData',[]); % refresh user data in view_field (set by civ/TestCiv )
    270 end
    271 tagaxes=get(haxes,'tag');% tag of the current plot axis
    272 if isfield(FigData,tagaxes)
    273     FigData.(tagaxes)=Data;
    274     set(hfig,'UserData',FigData)
     251if ~isempty(index_2D)|| ~isempty(index_1D)
     252    FigData=get(hfig,'UserData');
     253%     if strcmp(get(hfig,'tag'),'view_field')
     254%         set(hfig,'UserData',[]); % refresh user data in view_field (set by civ/TestCiv )
     255%     end
     256    tagaxes=get(haxes,'tag');% tag of the current plot axis
     257    if isfield(FigData,tagaxes)
     258        FigData.(tagaxes)=Data;
     259        set(hfig,'UserData',FigData)
     260    end
    275261end
    276262
     
    280266errormsg=[];
    281267txt_cell={};
     268Data={};
    282269for icell=1:length(CellVarIndex)
    283270    VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list data.ListVarName
     
    294281            VarName=FieldData.ListVarName{VarIndex(ivar)};
    295282            VarValue=FieldData.(VarName);
     283            Data =[Data [{VarName}; num2cell(VarValue)]];
    296284            if size(VarValue,1)~=1
    297                 VarValue=VarValue';
     285                VarValue=VarValue';% put the different values on a line
    298286            end
    299287            if size(VarValue,1)==1
     
    304292    end
    305293end
    306 set(htext,'String',txt_cell)
    307 set(htext,'UserData',txt_cell)% for storage during mouse display
     294if strcmp(get(htext,'Type'),'uitable')
     295    get(htext,'ColumnName')
     296    set(htext,'ColumnName',Data(1,:))
     297    set(htext,'Data',Data(2:end,:))
     298else
     299    set(htext,'String',txt_cell)
     300    set(htext,'UserData',txt_cell)% for storage during mouse display
     301end
     302
    308303
    309304%-------------------------------------------------------------------
     
    499494
    500495%% determine plot aspect ratio
    501 if isequal(Coordinates.CheckFixAspectRatio,1)&&isfield(Coordinates,'AspectRatio')
     496if isfield(Coordinates,'CheckFixAspectRatio') && isequal(Coordinates.CheckFixAspectRatio,1)&&isfield(Coordinates,'AspectRatio')
    502497    set(haxes,'DataAspectRatioMode','manual')
    503498    set(haxes,'DataAspectRatio',[Coordinates.AspectRatio 1 1])
    504499else
    505500    set(haxes,'DataAspectRatioMode','auto')%automatic aspect ratio
    506     AspectRatio=get(haxes,'DataAspectRatio')
     501    AspectRatio=get(haxes,'DataAspectRatio');
    507502    CoordinatesOut.AspectRatio=AspectRatio(1)/AspectRatio(2);
    508503end
     
    824819                set(haxes,'DataAspectRatioMode','manual')
    825820                if isfield(PlotParam.Coordinates,'AspectRatio')
    826                     set(haxes,'DataAspectRatio',[PlotParam.Coordinates.AspectRatio PlotParam.Coordinates.AspectRatio PlotParam.Coordinates.AspectRatio])
     821                    set(haxes,'DataAspectRatio',[PlotParam.Coordinates.AspectRatio 1 1])
    827822                else
    828823                    set(haxes,'DataAspectRatio',[1 1 1])
     
    887882            % the function imagesc reset the axes 'DataAspectRatioMode'='auto', change if .CheckFixAspectRatio is
    888883            % requested:
    889             if isfield(PlotParam.Coordinates,'CheckFixAspectRatio') && isequal(PlotParam.Coordinates.CheckFixAspectRatio,1)
    890                 set(haxes,'DataAspectRatioMode','manual')
    891                 set(haxes,'DataAspectRatio',[1 1 1])
    892             end
    893884            set(hima,'Tag','ima')
    894885            set(hima,'HitTest','off')
     
    906897            set(hima,'YData',AY);
    907898        end
     899
    908900        % set the transparency to 0.5 if vectors are also plotted
    909901        if isfield(PlotParam.Scalar,'Opacity')&& ~isempty(PlotParam.Scalar.Opacity)
     
    11291121    PlotParamOut.Coordinates.y_units=y_units;
    11301122end
     1123        if isfield(PlotParam,'Coordinates') && isfield(PlotParam.Coordinates,'CheckFixAspectRatio') && isequal(PlotParam.Coordinates.CheckFixAspectRatio,1)
     1124            set(haxes,'DataAspectRatioMode','manual')
     1125            if isfield(PlotParam.Coordinates,'AspectRatio')
     1126                set(haxes,'DataAspectRatio',[PlotParam.Coordinates.AspectRatio 1 1])
     1127            end
     1128        else
     1129            set(haxes,'DataAspectRatioMode','auto')
     1130        end
    11311131%-------------------------------------------------------------------
    11321132% --- function for plotting vectors
  • trunk/src/set_object.m

    r427 r429  
    501501    end   
    502502    if numel(IndexObj)==1   % if only one object is selected, the projection is in uvmat
    503 %         plotaxes=hhuvmat.axes3;%handle of axes3 in view_field
    504503        PlotType=plot_field(ProjData,hhuvmat.axes3,read_GUI(get(hhuvmat.axes3,'parent')));%update the current uvmat plot
    505504    else  % if a second object is selected, the projection is in view_field, and this second object is selected
    506505        hview_field=findobj(allchild(0),'tag','view_field');
    507506        if isempty(hview_field)
    508             PlotType=view_field(ProjData); %open the view_field GUI for plot
    509           %  hview_field=view_field;%open the GUI view_field if it is not found
     507            hview_field=view_field(ProjData); %open the view_field GUI for plot
    510508        else
    511509            hhview_field=guidata(hview_field);
     
    513511            write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
    514512        end
    515 %         PlotHandles=guidata(hview_field);
    516 %         plotaxes=PlotHandles.axes3;%handle of axes3 in view_field
    517     end
    518 %     fighandle=get(plotaxes,'parent');
    519 %     PlotParam=read_GUI(fighandle);
    520    % PlotType=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot
    521 end
    522 if strcmp(PlotType,'text')
    523     hview_field=findobj(allchild(0),'tag','view_field'); %case of no projection (pure object display)
    524     if ~isempty(hview_field)
    525         delete(hview_field)
    526     end
    527 end
    528    
     513        haxes=findobj(hview_field,'tag','axes3');
     514        Data=get(hview_field,'UserData');
     515        if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     516            h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
     517            pos_table=get(h_TableDisplay,'Position');
     518            pos=get(hview_field,'Position');
     519            set(hview_field,'Position',[pos(1)+pos(3)-pos_table(3) pos(2)+pos(4)-pos_table(4) pos_table(3) pos_table(4)])
     520            drawnow
     521            set(hview_field,'UserData',Data);% restore the previously stored GUI position after GUI resizing
     522        else
     523            set(hview_field,'Position',Data.GUISize)
     524        end
     525    end
     526end
     527
    529528%% update the GUI uvmat
    530529hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI
  • trunk/src/uvmat.m

    r428 r429  
    239239UvData.Object{1}.ProjMode='projection';%main plotting plane
    240240set(handles.ListObject,'Value',1)% default: empty projection objectproj_field
    241 set(handles.ListObject,'String',{'plane_0'})
     241set(handles.ListObject,'String',{'plane'})
    242242set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field
    243 set(handles.ListObject_1,'String',{'plane_0'})
     243set(handles.ListObject_1,'String',{'plane'})
    244244set(handles.Fields,'Value',1)
    245245set(handles.Fields,'string',{''})
     
    35463546
    35473547%------------------------------------------------------------------
    3548 
    3549 
    3550 
    35513548%-------------------------------------------------------------
    35523549% --- Executes on selection change in transform_fct.
     
    36003597end
    36013598
    3602 %check the current path to the selected function
     3599%% check the current path to the selected function
    36033600if isa(list_transform{ind_coord},'function_handle')
    36043601    func=functions(list_transform{ind_coord});
     
    36113608set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
    36123609
    3613 %delete drawn objects
     3610%% delete drawn objects
    36143611hother=findobj('Tag','proj_object');%find all the proj objects
    36153612for iobj=1:length(hother)
     
    36323629end
    36333630set(handles.ListObject,'Value',1)
    3634 set(handles.ListObject,'String',{''})
     3631set(handles.ListObject,'String',{'plane'})
     3632set(handles.ListObject_1,'Value',1)
     3633set(handles.ListObject_1,'String',{'plane'})
    36353634
    36363635%delete mask if it is displayed
     
    40314030    set(handles.ViewField,'Value',1)% show that the selected object in ListObject is currently visualised
    40324031end
    4033 %  desactivate the edit object mode
     4032
     4033%%  desactivate the edit object mode
    40344034set(handles.edit_object,'Value',0)
    40354035set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])
    40364036
    4037 %% update the second plot (on view_field) if view_field is already openened
    4038 axes_view_field=[];%default
    4039 if length(IndexObj)==2 && (length(IndexObj_old)==1 || ~isequal(IndexObj(2),IndexObj_old(2)))
    4040     hview_field=findobj(allchild(0),'tag','view_field');
    4041     if ~isempty(hview_field)
    4042         PlotHandles=guidata(hview_field);     
    4043         ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    4044         axes_view_field=PlotHandles.axes3;
    4045         plot_field(ProjData,axes_view_field,read_GUI(hview_field));%read plotting parameters on the uvmat interfacPlotHandles);
     4037%% update the  plot on view_field if view_field is already openened
     4038hview_field=findobj(allchild(0),'tag','view_field');
     4039if isempty(hview_field)
     4040    hhview_field.axes3=[];
     4041else
     4042    Data=get(hview_field,'UserData');
     4043    hhview_field=guidata(hview_field);
     4044    ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
     4045    [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%read plotting parameters on the uvmat interfachhview_fiel
     4046    write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
     4047    haxes=findobj(hview_field,'tag','axes3');
     4048    pos=get(hview_field,'Position'); 
     4049    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     4050        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
     4051        pos_table=get(h_TableDisplay,'Position');
     4052        set(hview_field,'Position',[pos(1)+pos(3)-pos_table(3) pos(2)+pos(4)-pos_table(4) pos_table(3) pos_table(4)])
     4053        drawnow% needed to change position before the next command
     4054        set(hview_field,'UserData',Data);% restore the previously stored GUI position after GUI resizing
     4055    else
     4056        set(hview_field,'Position',Data.GUISize)% return to the previously stored GUI position and size
    40464057    end
    40474058end
    40484059
    40494060%% update the color of the graphic object representation: the selected object in magenta, others in blue
    4050 update_object_color(handles.axes3,axes_view_field,UvData.Object{IndexObj(end)}.DisplayHandle_uvmat)
     4061update_object_color(handles.axes3,hhview_field.axes3,UvData.Object{IndexObj(end)}.DisplayHandle_uvmat)
     4062hview_field=findobj(allchild(0),'tag','view_field');
    40514063
    40524064%------------------------------------------------------------------------
     
    42284240    UvData.Object{IndexObj(end)}.Name=list_object{IndexObj(end)};
    42294241   
    4230     %% show the second plot (on view_field)
    4231         ProjData= proj_field(UvData.Field,UvData.Object{IndexObj});%project the current field on ObjectData
     4242    %% show the projection of the selected object on view_field
     4243    ProjData= proj_field(UvData.Field,UvData.Object{IndexObj});%project the current field on ObjectData
    42324244    hview_field=findobj(allchild(0),'tag','view_field');
    42334245    if isempty(hview_field)
    42344246        hview_field=view_field;
    42354247    end
    4236     PlotHandles=guidata(hview_field);
    4237     plot_field(ProjData,PlotHandles.axes3,read_GUI(hview_field));%read plotting parameters on the uvmat interfacPlotHandles);
     4248    hhview_field=guidata(hview_field);
     4249    [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%read plotting parameters on the GUI view_field);
     4250    write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
     4251    haxes=findobj(hview_field,'tag','axes3');
     4252    pos=get(hview_field,'Position');
     4253    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     4254        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
     4255        pos_table=get(h_TableDisplay,'Position');
     4256        set(hview_field,'Position',[pos(1)+pos(3)-pos_table(3) pos(2)+pos(4)-pos_table(4) pos_table(3) pos_table(4)])
     4257    else
     4258        Data=get(hview_field,'UserData');
     4259        set(hview_field,'Position',Data.GUISize)
     4260    end
    42384261else
    42394262    hview_field=findobj(allchild(0),'tag','view_field');
     
    44814504set(handles.edit_object,'Value',0); %suppress the object edit mode
    44824505set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 
     4506ListObject=get(handles.ListObject,'String');
     4507if ~strcmp(ListObject{end},'')
     4508    ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object
     4509    set(handles.ListObject,'String',ListObject)
     4510end
     4511IndexObj=length(ListObject);
     4512set(handles.ListObject,'Value',IndexObj)
    44834513UvData=get(handles.uvmat,'UserData');
     4514UvData.Object{IndexObj}=[]; %create a new empty object
    44844515data.Name=data.Type;% default name=type
    44854516data.Coord=[0 0]; %default
     
    45064537    delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered
    45074538end
    4508 
    4509 %set(handles.ViewField,'Value',1) % indicate that the object selected in ListObject (projection oin view_field) is visualised
    4510 %set(handles.ViewObject,'Value',1)% then the object selected in ListObject_1 is not visualised
    45114539hset_object=set_object(data,handles);% call the set_object interface
    45124540hhset_object=guidata(hset_object);
    45134541hchild=get(hset_object,'children');
    45144542set(hchild,'enable','on')
    4515 %set(hhset_object.PLOT,'enable','on')% activate the refresh button
    4516 %set(handles.MenuObject,'checked','on')
    45174543set(handles.uvmat,'UserData',UvData)
    45184544set(handles.CheckZoom,'Value',0) %desactivate the zoom for object creation by the mouse
    45194545CheckZoom_Callback(handles.uvmat, [], handles)
    45204546set(handles.delete_object,'Visible','on')
    4521 
    45224547
    45234548%------------------------------------------------------------------------
     
    45364561%read the file
    45374562data=xml2struct(fileinput);
    4538 % data.enable_plot=1;
     4563
    45394564[tild,data.Name]=fileparts(FileName);% object name set as file name
    4540 % hset_object=findobj(allchild(0),'tag','set_object');
    4541 % if ~isempty(hset_object)
    4542 %     delete(hset_object)% delete existing version of set_object
    4543 % end
     4565ListObject=get(handles.ListObject,'String');
     4566if ~strcmp(ListObject{end},'')
     4567    ListObject=[ListObject;{''}]; %append a blank to the list (if not already done) to indicate the creation of a new object
     4568    set(handles.ListObject,'String',ListObject)
     4569end
     4570set(handles.ListObject,'Value',length(ListObject))
    45444571hset_object=set_object(data);% call the set_object interface
    45454572set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object
  • trunk/src/view_field.m

    r428 r429  
    8888set(hObject,'WindowButtonUpFcn',{'mouse_up',handles_mouse})
    8989set(hObject,'DeleteFcn',{@closefcn})%
     90set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
    9091ViewFieldData.axes3=[];%initiates the record of the current field (will be updated by plot_field)
    91 set(handles.view_field,'UserData',ViewFieldData);%store the current field
     92set(handles.view_field,'Units','pixels')
     93ViewFieldData.GUISize=get(handles.view_field,'Position');
     94set(handles.view_field,'UserData',ViewFieldData);%store the initial fig size in UserData
    9295AxeData.LimEditBox=1; %initialise AxeData, the parent figure sets plot parameters
    9396set(handles.axes3,'UserData',AxeData)
     
    100103    write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
    101104end
     105
     106%------------------------------------------------------------------------
     107%--- activated when resizing the GUI view_field
     108 function ResizeFcn(gcbo,eventdata,handles)
     109%------------------------------------------------------------------------     
     110set(handles.view_field,'Units','pixels')
     111size_fig=get(handles.view_field,'Position');
     112Data=get(handles.view_field,'UserData');
     113Data.GUISize=size_fig;
     114set(handles.view_field,'UserData',Data)
     115
     116%% reset position of text_display or TableDisplay
     117if strcmp(get(handles.TableDisplay,'Visible'),'off')
     118    pos_1=get(handles.text_display,'Position');
     119    pos_1(1)=size_fig(3)-pos_1(3);
     120    pos_1(2)=size_fig(4)-pos_1(4);
     121    set(handles.text_display,'Position',pos_1)
     122    % reset position of TableDisplay
     123else
     124    pos_1=get(handles.TableDisplay,'Position');
     125    pos_1(1)=size_fig(3)-pos_1(3);
     126    pos_1(2)=size_fig(4)-pos_1(4);
     127    set(handles.TableDisplay,'Position',pos_1)
     128end
     129
     130%% reset position of Coordinates
     131pos_2=get(handles.Coordinates,'Position');
     132pos_2(1)=size_fig(3)-pos_1(3);
     133pos_2(2)=pos_1(2)-pos_2(4);
     134set(handles.Coordinates,'Position',pos_2)
     135
     136%% reset position of  Scalar
     137pos_3=get(handles.Scalar,'Position');
     138pos_3(1)=size_fig(3)-pos_3(3);
     139if strcmp(get(handles.Scalar,'visible'),'on')
     140    pos_3(2)=pos_2(2)-pos_3(4);
     141else
     142    pos_3(2)=pos_2(2);
     143end
     144set(handles.Scalar,'Position',pos_3)
     145
     146%% reset position of  Vectors
     147pos_4=get(handles.Vectors,'Position');
     148pos_4(1)=size_fig(3)-pos_4(3);
     149if strcmp(get(handles.Vectors,'visible'),'on')
     150    pos_4(2)=pos_3(2)-pos_4(4);
     151else
     152    pos_4(2)=pos_3(2);
     153end
     154set(handles.Vectors,'Position',pos_4)
     155
     156%% reset position and scale of axis
     157bord=[50 40 30 60]; %bordure left,inf, right,sup
     158pos(1)=bord(1);
     159pos(2)=bord(2);
     160pos(3)=max(1,pos_1(1)-pos(1)-bord(3));
     161pos(4)=max(1,size_fig(4)-bord(4));
     162set(handles.axes3,'Position',pos)
     163
     164%------------------------------------------------------------------------
    102165%------------------------------------------------------------------------
    103166% --- Outputs from this function are returned to the command menuline.
     
    105168%------------------------------------------------------------------------
    106169varargout{1} = handles.output;% the only output argument is the handle to the GUI figure
     170varargout{2} = strcmp(get(handles.axes3,'Visible'),'on');% check active plot axis
    107171
    108172%------------------------------------------------------------------------
     
    271335runpm(hObject,eventdata,handles,increment)
    272336
    273 %-------------------------------------------------------------------
    274 %Executes on button press in runmin: make one step backward and call
    275 %run0. The step backward is along the fields series 1 or 2 depending on
    276 %the scan_i and scan_j check box (exclusive each other)
    277 %-------------------------------------------------------------------
    278 function RunMovie_Callback(hObject, eventdata, handles)
    279 %------------------------------------------------------------------
    280 set(handles.RunMovie,'BackgroundColor',[1 1 0])%paint the command button in yellow
    281 drawnow
    282 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
    283 set(handles.STOP,'Visible','on')
    284 set(handles.speed,'Visible','on')
    285 set(handles.speed_txt,'Visible','on')
    286 set(handles.RunMovie,'BusyAction','queue')
    287 testavi=0;
    288 UvData=get(handles.view_field,'UserData');
    289 
    290 while get(handles.speed,'Value')~=0 & isequal(get(handles.RunMovie,'BusyAction'),'queue') % enable STOP command
    291         runpm(hObject,eventdata,handles,increment)
    292         pause(1.02-get(handles.speed,'Value'))% wait for next image
    293 end
    294 if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj),
    295     UvData.aviobj=close(UvData.aviobj);
    296    set(handles.view_field,'UserData',UvData);
    297 end
    298 set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
    299 
     337% %-------------------------------------------------------------------
     338% %Executes on button press in runmin: make one step backward and call
     339% %run0. The step backward is along the fields series 1 or 2 depending on
     340% %the scan_i and scan_j check box (exclusive each other)
     341% %-------------------------------------------------------------------
     342% function RunMovie_Callback(hObject, eventdata, handles)
     343% %------------------------------------------------------------------
     344% set(handles.RunMovie,'BackgroundColor',[1 1 0])%paint the command button in yellow
     345% drawnow
     346% increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
     347% set(handles.STOP,'Visible','on')
     348% set(handles.speed,'Visible','on')
     349% set(handles.speed_txt,'Visible','on')
     350% set(handles.RunMovie,'BusyAction','queue')
     351% testavi=0;
     352% UvData=get(handles.view_field,'UserData');
     353%
     354% while get(handles.speed,'Value')~=0 & isequal(get(handles.RunMovie,'BusyAction'),'queue') % enable STOP command
     355%         runpm(hObject,eventdata,handles,increment)
     356%         pause(1.02-get(handles.speed,'Value'))% wait for next image
     357% end
     358% if isfield(UvData,'aviobj') && ~isempty( UvData.aviobj),
     359%     UvData.aviobj=close(UvData.aviobj);
     360%    set(handles.view_field,'UserData',UvData);
     361% end
     362% set(handles.RunMovie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
    300363
    301364
  • trunk/src/write_plot_param.m

    r428 r429  
    1 %'write_plot_param': update the plotting parameters on the uvmat interface after a plotting operation
     1%'write_plot_param': update the plotting parameters on the uvmat or view_field interface after a plotting operation
    22function write_plot_param(handles,PlotParam)
    33%% coordinates
    4 if isfield(PlotParam,'Coordinates')
     4if isempty(PlotParam.Coordinates)
     5    set(handles.Coordinates,'Visible','off')
     6    set(handles.axes3,'Visible','off')
     7    set(handles.text_display,'Visible','off')
     8    set(handles.TableDisplay,'Visible','on')
     9else
     10    set(handles.Coordinates,'Visible','on')
     11    set(handles.axes3,'Visible','on')
     12    set(handles.text_display,'Visible','on')
     13    if isfield(handles,'TableDisplay')
     14    set(handles.TableDisplay,'Visible','off')
     15    end
    516    Coordinates=PlotParam.Coordinates;
    617    if isfield(Coordinates,'CheckFixAspectRatio')
     
    1526    if isfield(Coordinates,'AspectRatio')
    1627        set(handles.num_AspectRatio,'String',num2str(Coordinates.AspectRatio))
    17     end   
     28    end
    1829    if isfield(Coordinates,'MinX')
    1930        set(handles.num_MinX,'String',num2str(Coordinates.MinX,4));
Note: See TracChangeset for help on using the changeset viewer.