Changeset 192


Ignore:
Timestamp:
Feb 14, 2011, 7:03:10 PM (13 years ago)
Author:
sommeria
Message:

civ: version working for all systems: windows, linux, mac
plots: introduction of axes limits , bug repairs (still further work needed)

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r188 r192  
    16721672        return
    16731673    end
    1674 else
    1675     if isunix
    1676         [xx,w]=unix('ps faux |grep civ|wc -l');
    1677         w(end)=[];
    1678         if str2double(w)+numel(num1_civ1)> 50
    1679             msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'})
    1680             return
    1681         end
    1682     end
     1674% else
     1675%     if isunix
     1676%         [xx,w]=unix('ps faux |grep civ|wc -l');
     1677%         w(end)=[];
     1678%         if str2double(w)+numel(num1_civ1)> 50
     1679%             msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'})
     1680%             return
     1681%         end
     1682%     end
    16831683end
    16841684
     
    22532253    fprintf(fid,super_cmd');
    22542254    fclose(fid);
    2255     if(isunix)
    2256         eval(['!. ' filename_superbat ' &']);
    2257     else
    2258         eval(['!' filename_superbat ' &']);
    2259     end
     2255%     if(isunix)
     2256        %system(['chmod +x ' filename_superbat])
     2257     system([filename_superbat ' &'])% execute main commmand
     2258%     else
     2259%         eval(['!' filename_superbat ' &']);
     2260%     end
    22602261end
    22612262
  • trunk/src/keyboard_callback.m

    r71 r192  
    22%-----------------------------------
    33function keyboard_callback(hObject,eventdata,handleshaxes)
     4cur_axes=get(hObject,'CurrentAxes');%current plotting axes of the figure with handle hObject
    45xx=double(get(hObject,'CurrentCharacter')); %get the keyboard character
    5 cur_axes=get(gcbf,'CurrentAxes');
    6 if ~isempty(cur_axes)
    7     xlimit=get(cur_axes,'XLim');
    8     ylimit=get(cur_axes,'Ylim');
    9     dx=(xlimit(2)-xlimit(1))/10;
    10     dy=(ylimit(2)-ylimit(1))/10;
    11    
    12     if isequal(xx,29)%move arrow right
    13         xlimit=xlimit+dx;
    14     elseif isequal(xx,28)%move arrow left
    15         xlimit=xlimit-dx;
    16     elseif isequal(xx,30)%move arrow up
    17         ylimit=ylimit+dy;
    18     elseif isequal(xx,31)%move arrow down
    19         ylimit=ylimit-dy;
    20     end
    21     set(cur_axes,'XLim',xlimit)
    22     set(cur_axes,'YLim',ylimit)
    23 end
    24 if ismember(xx,[8 127]) %if the delete or suppr key is pressed, delete the current object
    25     currentobject=gco;
    26     huvmat=findobj(allchild(0),'tag','uvmat');
    27 %     UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    28     hlist_object=findobj(huvmat,'Tag','list_object_1');
    29     ObjIndex=get(hlist_object,'Value')
    30     if ObjIndex>1
    31         delete_object(ObjIndex)
    32     end
    33     if ishandle(currentobject)
    34         tag=get(currentobject,'Tag');%tag of the current selected object
    35         if isequal(tag,'proj_object')
    36             delete_object(currentobject)
     6switch xx
     7    case {29,28,30,31}    %arrows for displacement
     8        if ~isempty(cur_axes)
     9            xlimit=get(cur_axes,'XLim');
     10            ylimit=get(cur_axes,'Ylim');
     11            dx=(xlimit(2)-xlimit(1))/10;
     12            dy=(ylimit(2)-ylimit(1))/10;
     13            if isequal(xx,29)%move arrow right
     14                xlimit=xlimit+dx;
     15            elseif isequal(xx,28)%move arrow left
     16                xlimit=xlimit-dx;
     17            elseif isequal(xx,30)%move arrow up
     18                ylimit=ylimit+dy;
     19            elseif isequal(xx,31)%move arrow down
     20                ylimit=ylimit-dy;
     21            end
     22            set(cur_axes,'XLim',xlimit)
     23            set(cur_axes,'YLim',ylimit)
     24            hfig=hObject; %master figure
     25            AxeData=get(cur_axes,'UserData');
     26            if isfield(AxeData,'ParentRect')% update the position of the parent rectangle representing the field
     27                hparentrect=AxeData.ParentRect;
     28                rect([1 2])=[xlimit(1) ylimit(1)];
     29                rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)];
     30                set(hparentrect,'Position',rect)
     31                hfig=get(hparentrect,'parent');
     32                hfig=get(hfig,'parent');
     33            elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field)
     34                hh=guidata(hfig);
     35                if isfield(hh,'MinX')
     36                    set(hh.MinX,'String',num2str(xlimit(1)))
     37                    set(hh.MaxX,'String',num2str(xlimit(2)))
     38                    set(hh.MinY,'String',num2str(ylimit(1)))
     39                    set(hh.MaxY,'String',num2str(ylimit(2)))
     40                end
     41            end
    3742        end
    38     end
    39 elseif isequal(xx,112)%  key 'p'
    40     uvmat('runplus_Callback',hObject,eventdata,handleshaxes)
    41 elseif isequal(xx,109)%  key 'm'
    42     uvmat('runmin_Callback',hObject,eventdata,handleshaxes)
     43    case {8, 127} %if the delete or suppr key is pressed, delete the current object
     44        currentobject=gco;
     45        huvmat=findobj(allchild(0),'tag','uvmat');
     46        hlist_object=findobj(huvmat,'Tag','list_object_1');
     47        ObjIndex=get(hlist_object,'Value');
     48        if ObjIndex>1
     49            delete_object(ObjIndex)
     50        end
     51        if ishandle(currentobject)
     52            tag=get(currentobject,'Tag');%tag of the current selected object
     53            if isequal(tag,'proj_object')
     54                delete_object(currentobject)
     55            end
     56        end
     57    case 112%  key 'p'
     58        uvmat('runplus_Callback',hObject,eventdata,handleshaxes)
     59    case 109%  key 'm'
     60        uvmat('runmin_Callback',hObject,eventdata,handleshaxes)
    4361end
    4462
    45 AxeData=get(cur_axes,'UserData');
    46 if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field
    47     hparentrect=AxeData.ParentRect;
    48     rect([1 2])=[xlimit(1) ylimit(1)];
    49     rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)];
    50     set(hparentrect,'Position',rect)
    51 end
  • trunk/src/mouse_up.m

    r183 r192  
    2828currentfig=hObject;
    2929tagfig=get(currentfig,'tag');
    30 hhcurrentfig=guidata(currentfig);
     30currentaxes=gca; %store the current axes handle
     31AxeData=get(currentaxes,'UserData');
     32if isfield(AxeData,'CurrentOrigin')
     33    CurrentOrigin=AxeData.CurrentOrigin;
     34end
     35if isfield(AxeData,'ParentRect')% case of a zoom plot as current axis
     36    parentaxes=get(AxeData.ParentRect,'parent');
     37    AxeData=get(parentaxes,'UserData');
     38    controlGUI=get(parentaxes,'parent');%handles of the GUI parent of the zoom plot
     39    hhcurrentfig=guidata(controlGUI);
     40    testsubplot=1;
     41else
     42    hhcurrentfig=guidata(currentfig);%the current figure is a GUI (uvmat or view_field)
     43    testsubplot=0;
     44end
    3145test_zoom=get(hhcurrentfig.zoom,'Value');
    3246
    33 % if ~exist('handles','var')
    34 %    handles=get(gcbo,'UserData');
    35 % end
    3647huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle
    3748if ~isempty(huvmat)
    3849    hhuvmat=guidata(huvmat);
    3950    UvData=get(huvmat,'UserData');
    40 %     if isfield(UvData,'MouseAction')
    41 %         MouseAction=UvData.MouseAction;% set the mouse action (edit, create objects...)
    42 %     end
    4351   test_ruler=~test_zoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority
    4452end
    45 currentfig=hObject;
    46 currentaxes=gca; %store the current axes handle
    47 AxeData=get(currentaxes,'UserData');
    48 
    4953test_drawing=0;%default
    5054
     
    161165                    ViewFieldData.axes3=ProjData;
    162166                    set(hview_field,'UserData',ViewFieldData)
    163                     PlotHandles=guidata(hview_field);
     167%                     PlotHandles=guidata(hview_field);
    164168                else
    165169                    UvData.axes3=ProjData;
    166                     PlotHandles=hhuvmat;
     170%                     PlotHandles=hhuvmat;
    167171                end
    168                 [PlotType,PlotParam]=plot_field(ProjData,PlotHandles.axes3,PlotHandles);%update an existing field plot
    169                 write_plot_param(PlotHandles,PlotParam); %update the display of plotting parameters for the current object
     172                [PlotType,PlotParam]=plot_field(ProjData,hhcurrentfig.axes3,hhcurrentfig);%update an existing field plot
     173                write_plot_param(hhcurrentfig,PlotParam); %update the display of plotting parameters for the current object
    170174            end
    171175            %             if  isfield(UvData.Object{IndexObj},'PlotParam')
     
    190194
    191195%% creation of a new zoom plot
    192 test_replot=0;
    193196if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed
    194 %         FigData=get(currentfig,'UserData');
    195         hparentfig=currentfig;
    196         %open or update a new zoom figure if a rectangle has been drawn
    197         if ishandle(currentaxes);
    198             if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom)
    199                 PosRect=get(AxeData.CurrentRectZoom,'Position');
    200                 if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec)
    201                     delete(AxeData.CurrentVec)
    202                 end
     197    hparentfig=currentfig;
     198    %open or update a new zoom figure if a rectangle has been drawn
     199    if ishandle(currentaxes);
     200        if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom)
     201            PosRect=get(AxeData.CurrentRectZoom,'Position');
     202            if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec)
     203                delete(AxeData.CurrentVec)
     204            end
     205            if ~testsubplot
    203206                hfig2=figure;%create new figure
    204207                set(hfig2,'name','zoom')
     
    207210                map=colormap(currentaxes);
    208211                colormap(map);%transmit the current colormap to the zoom fig
    209                 set(hfig2,'Position',[0.2 0.33 0.6 0.6]);
    210                 if test_replot==0
    211                     set(hfig2,'Unit','normalized')
    212                     set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
    213                     set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function
    214                     set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function
    215                     set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles}) 
    216                     set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'})
    217                     set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig
    218                     AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure
    219                     figure(hfig2)
    220                     set(AxeData.ZoomAxes,'Position',[0.1300    0.1100    0.7750    0.8150])% standard axes position on a figure
    221                     hcol=findobj(hparentfig,'Tag','Colorbar'); %look for colorbar axes
    222                     if ~isempty(hcol)             
    223                         hcol_new=colorbar;
    224                         YTick=get(hcol,'YTick');
    225                         YTicklabel=get(hcol,'Yticklabel'); 
    226                         colbarlim=get(hcol,'YLim');
    227                         newcolbarlim=get(hcol_new,'YLim');
    228                         scale_bar=(newcolbarlim(2)-newcolbarlim(1))/(colbarlim(2)-colbarlim(1));               
    229                         YTick_rescaled=newcolbarlim(1)+scale_bar*(YTick-colbarlim(1));
    230                         set(hcol_new,'YTick',YTick_rescaled);
    231                         set(hcol_new,'Yticklabel',YTicklabel);
    232                     end
     212                set(hfig2,'Position',[0.2 0.33 0.6 0.6]);         
     213                set(hfig2,'Unit','normalized')
     214                set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
     215                set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function
     216                set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function
     217                set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles})
     218                set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'})
     219                set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig
     220                AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure
     221                ChildAxeData=get(AxeData.ZoomAxes,'UserData');
     222                if isfield(ChildAxeData,'ParentGUI')
     223                    ChildAxeData=rmfield(ChildAxeData,'ParentGUI');%no parent GUI, e.g. uvmat,  for the new plot
    233224                end
    234                 if ishandle(AxeData.ZoomAxes)
    235                     hnew_rect=findobj(AxeData.ZoomAxes,'Tag','rect_zoom');
    236                     if ~isempty(hnew_rect)
    237                         delete(hnew_rect);
    238                         ChildAxeData=get(AxeData.ZoomAxes,'UserData');
    239                         ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window
    240                         ChildAxeData.Drawing='off';
    241                         ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axes
    242                         set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes
    243                         set(AxeData.ZoomAxes,'Xlim',[PosRect(1) PosRect(1)+PosRect(3)])
    244                         set(AxeData.ZoomAxes,'Ylim',[PosRect(2) PosRect(2)+PosRect(4)])
    245                     end
     225                %figure(hfig2)
     226                %set(0,'CurrentFigure',hfig2)% the zoom figure becomes the current figure
     227                set(AxeData.ZoomAxes,'Position',[0.1300    0.1100    0.7750    0.8150])% standard axes position on a figure
     228                hcol=findobj(hparentfig,'Tag','Colorbar'); %look for colorbar axes
     229                if ~isempty(hcol)
     230                    hcol_new=colorbar;
     231                    YTick=get(hcol,'YTick');
     232                    YTicklabel=get(hcol,'Yticklabel');
     233                    colbarlim=get(hcol,'YLim');
     234                    newcolbarlim=get(hcol_new,'YLim');
     235                    scale_bar=(newcolbarlim(2)-newcolbarlim(1))/(colbarlim(2)-colbarlim(1));
     236                    YTick_rescaled=newcolbarlim(1)+scale_bar*(YTick-colbarlim(1));
     237                    set(hcol_new,'YTick',YTick_rescaled);
     238                    set(hcol_new,'Yticklabel',YTicklabel);
    246239                end
    247240            end
    248         end
     241    %             if ishandle(AxeData.ZoomAxes)
     242%             hnew_rect=findobj(AxeData.ZoomAxes,'Tag','rect_zoom');
     243%             if ~isempty(hnew_rect)
     244%                 delete(hnew_rect);
     245
     246                ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window
     247                ChildAxeData.Drawing='off';
     248                ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe
     249                PosRect=CurrentOrigin;
     250                xy=get(currentaxes,'CurrentPoint')%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     251                set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)])
     252                set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)])
     253%             end
     254            set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes
     255        end
     256    end
    249257end
    250258
     
    252260if test_zoom
    253261    xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    254      if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed
    255         xlim=get(currentaxes,'XLim');
    256         xlim_new(2)=0.5*xy(1,1)+0.5*xlim(2);
    257         xlim_new(1)=0.5*xy(1,1)+0.5*xlim(1);
    258         set(currentaxes,'XLim',xlim_new)
    259         ylim=get(currentaxes,'YLim');
    260         ylim_new(2)=0.5*xy(1,2)+0.5*ylim(2);
    261         ylim_new(1)=0.5*xy(1,2)+0.5*ylim(1);
    262         set(currentaxes,'YLim',ylim_new)
    263         if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field
    264             hparentrect=AxeData.ParentRect;
    265             xlim=get(currentaxes,'XLim');
    266             ylim=get(currentaxes,'YLim');
    267             rect([1 2])=[xlim(1) ylim(1)];
    268             rect([3 4])=[xlim(2)-xlim(1) ylim(2)-ylim(1)];
    269             set(hparentrect,'Position',rect)
    270         end
    271      %zoom out by a factor of 2 out when the right mouse button has been used
    272      elseif isequal(get(currentfig,'SelectionType'),'alt'); %if right button has been pressed
    273 %             alpha=2; %zoom factor (zoom out by a factor 2)
    274             xlim=get(currentaxes,'XLim');
    275             xlim_new(1)=2*xlim(1)-xy(1,1);
    276             xlim_new(2)=2*xlim(2)-xy(1,1);
    277 %             xlim_new(1)=(1+alpha)*xlim(1)/2+(1-alpha)*xlim(2)/2;
    278 %             xlim_new(2)=(1-alpha)*xlim(1)/2+(1+alpha)*xlim(2)/2;
    279             ylim=get(currentaxes,'YLim');
    280             ylim_new(1)=2*ylim(1)-xy(1,2);
    281             ylim_new(2)=2*ylim(2)-xy(1,2);
    282 %             ylim_new(1)=(1+alpha)*ylim(1)/2+(1-alpha)*ylim(2)/2;
    283 %             ylim_new(2)=(1-alpha)*ylim(1)/2+(1+alpha)*ylim(2)/2;
    284             if isfield(AxeData,'RangeX') && isfield(AxeData,'RangeY')
    285                 xlim_new(1)=max(AxeData.RangeX(1),xlim_new(1));
    286                 xlim_new(2)=min(AxeData.RangeX(2),xlim_new(2));
    287                 ylim_new(1)=max(AxeData.RangeY(1),ylim_new(1));
    288                 ylim_new(2)=min(AxeData.RangeY(2),ylim_new(2));
    289                 if isequal(xlim_new,AxeData.RangeX) && isequal(ylim_new,AxeData.RangeY)
    290                     set(hhuvmat.zoom,'Value',0)
    291                     set(hhuvmat.zoom,'BackgroundColor',[0.7 0.7 0.7])
    292                     set(hhuvmat.FixedLimits,'Value',0)
    293                     set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
    294                 end
    295             end
    296             set(currentaxes,'XLim',xlim_new)
    297             set(currentaxes,'YLim',ylim_new)
    298             %test whther zoom out is operating (to inactivate AxedAta
    299             if ~isfield(AxeData,'CurrentXLim')|| ~isequal(xlim,AxeData.CurrentXLim)
    300                 AxeData.CurrentXLim=xlim;%
    301             end
    302             if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field
    303                 hparentrect=AxeData.ParentRect;
    304                 xlim=get(currentaxes,'XLim');
    305                 ylim=get(currentaxes,'YLim');
    306                 rect([1 2])=[xlim(1) ylim(1)];
    307                 rect([3 4])=[xlim(2)-xlim(1) ylim(2)-ylim(1)];
    308                 set(hparentrect,'Position',rect)
    309             end
    310       end
     262    xlim=get(currentaxes,'XLim');
     263    ylim=get(currentaxes,'YLim');
     264    if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed
     265        xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
     266        xlim(2)=0.5*xy(1,1)+0.5*xlim(2);
     267        set(currentaxes,'XLim',xlim)
     268        ylim(2)=0.5*xy(1,2)+0.5*ylim(2);
     269        ylim(1)=0.5*xy(1,2)+0.5*ylim(1);
     270        set(currentaxes,'YLim',ylim)
     271        %zoom out by a factor of 2 out when the right mouse button has been used
     272    else%if isequal(get(currentfig,'SelectionType'),'alt'); %if right button has been pressed
     273        xlim(1)=2*xlim(1)-xy(1,1);
     274        xlim(2)=2*xlim(2)-xy(1,1);
     275        ylim(1)=2*ylim(1)-xy(1,2);
     276        ylim(2)=2*ylim(2)-xy(1,2);
     277        %             ylim_new(1)=(1+alpha)*ylim(1)/2+(1-alpha)*ylim(2)/2;
     278        %             ylim_new(2)=(1-alpha)*ylim(1)/2+(1+alpha)*ylim(2)/2;
     279        if isfield(AxeData,'RangeX') && isfield(AxeData,'RangeY')
     280            xlim(1)=max(AxeData.RangeX(1),xlim(1));
     281            xlim(2)=min(AxeData.RangeX(2),xlim(2));
     282            ylim(1)=max(AxeData.RangeY(1),ylim(1));
     283            ylim(2)=min(AxeData.RangeY(2),ylim(2));
     284            if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
     285                set(hhuvmat.zoom,'Value',0)
     286                set(hhuvmat.zoom,'BackgroundColor',[0.7 0.7 0.7])
     287                set(hhuvmat.FixedLimits,'Value',0)
     288                set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
     289            end
     290        end
     291        set(currentaxes,'XLim',xlim)
     292        set(currentaxes,'YLim',ylim)
     293        %test whther zoom out is operating (to inactivate AxedAta
     294        if ~isfield(AxeData,'CurrentXLim')|| ~isequal(xlim,AxeData.CurrentXLim)
     295            AxeData.CurrentXLim=xlim;%
     296        end
     297    end
     298%     if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field
     299%         hparentrect=AxeData.ParentRect;
     300%         xlim=get(currentaxes,'XLim');
     301%         ylim=get(currentaxes,'YLim');
     302%         rect([1 2])=[xlim(1) ylim(1)];
     303%         rect([3 4])=[xlim(2)-xlim(1) ylim(2)-ylim(1)];
     304%         set(hparentrect,'Position',rect)
     305    if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field)
     306        set(hhcurrentfig.MinX,'String',num2str(xlim(1)))
     307        set(hhcurrentfig.MaxX,'String',num2str(xlim(2)))
     308        set(hhcurrentfig.MinY,'String',num2str(ylim(1)))
     309        set(hhcurrentfig.MaxY,'String',num2str(ylim(2)))
     310    end
    311311end
    312312
  • trunk/src/plot_field.m

    r191 r192  
    128128    end
    129129end
    130 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)
    131     PlotParam=read_plot_param(PlotParam);   
    132 end
     130% if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)
     131%     PlotParam=read_plot_param(PlotParam);   
     132% end
    133133% create a new figure and axes if the plotting axes does not exist
    134134if testnewfig
    135135    hfig=figure;
    136     if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)
    137         set(hfig,'UserData',PlotParam)
    138     end
     136%     if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)
     137%         set(hfig,'UserData',PlotParam)
     138%     end
    139139    set(hfig,'Units','normalized')
    140     set(hfig,'WindowButtonDownFcn','mouse_down')
    141     set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function
    142     set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function
     140%     set(hfig,'WindowButtonDownFcn','mouse_down')
     141%     set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function
     142%     set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function
    143143    haxes=axes;
    144144    set(haxes,'position',[0.13,0.2,0.775,0.73])
     
    146146else
    147147    hfig=get(haxes,'parent');
    148     set(0,'CurrentFigure',hfig)
    149     set(hfig,'CurrentAxes',haxes)
     148    set(0,'CurrentFigure',hfig)% the parent of haxes becomes the current figure
     149    set(hfig,'CurrentAxes',haxes)%  haxes becomes the current axes of the parent figure
    150150end
    151151
     
    153153if ~isempty(Data)
    154154    [Data,errormsg]=check_field_structure(Data);
    155 
    156155    if ~isempty(errormsg)
    157156        msgbox_uvmat('ERROR',['input of plot_field/check_field_structure: ' errormsg])
     
    213212        PlotType='line';
    214213end
     214
    215215if isempty(index_2D)
    216216    plot_plane([],[],[],haxes);%removes images or vector plots if any
     
    330330function PlotParamOut=plot_profile(data,CellVarIndex,VarType,haxes,PlotParam)
    331331%-------------------------------------------------------------------
     332if ~exist('PlotParam','var')
     333    PlotParam=[];
     334end
    332335PlotParamOut=PlotParam; %default
    333336hfig=get(haxes,'parent');
     
    10301033
    10311034%store the coordinate extrema occupied by the field
     1035Data
    10321036if ~isempty(Data)
    1033     test_lim=0;
    1034     if test_vec
    1035         Xlim=[min(vec_X) max(vec_X)];
    1036         Ylim=[min(vec_Y) max(vec_Y)];
    1037         test_lim=1;
     1037    fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits;
     1038    if fix_lim
     1039        if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY')
     1040            fix_lim=0; %free limits if lits are not set,
     1041        end  %else PlotParamOut.XMin =PlotParam.XMin...
     1042    end
     1043    'TESTfix'
     1044    fix_lim
     1045    if ~fix_lim
     1046        XMin=[];
     1047        XMax=[];
     1048        YMin=[];
     1049        YMax=[];
    10381050        if test_ima%both background image and vectors coexist, take the wider bound
    1039             Xlim(1)=min(AX(1),Xlim(1));
    1040             Xlim(2)=max(AX(end),Xlim(2));
    1041             Ylim(1)=min(AY(end),Ylim(1));
    1042             Ylim(2)=max(AY(1),Ylim(2));
    1043         end
    1044     elseif test_ima %only image plot
    1045         Xlim(1)=min(AX(1),AX(end));
    1046         Xlim(2)=max(AX(1),AX(end));
    1047         Ylim(1)=min(AY(1),AY(end));
    1048         Ylim(2)=max(AY(1),AY(end));
    1049         test_lim=1;
    1050     end
    1051     AxeData.RangeX=Xlim;
    1052     AxeData.RangeY=Ylim;
    1053 
    1054 %    adjust the size of the plot to include the whole field, except if PlotParam.FixedLimits=1
    1055     if ~(isfield(PlotParam,'FixLimits') && PlotParam.FixLimits) && test_lim
    1056         PlotParamOut.MinX=Xlim(1);
    1057         PlotParamOut.MaxX=Xlim(2);
    1058         PlotParamOut.MinY=Ylim(1);
    1059         PlotParamOut.MaxY=Ylim(2);
    1060         if Xlim(2)>Xlim(1)
    1061             set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates
    1062         end
    1063         if Ylim(2)>Ylim(1)
    1064             set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate
    1065         end
    1066     end
    1067 
    1068     set(haxes,'YDir','normal')
     1051            XMin=min(AX);
     1052            XMax=max(AX);
     1053            YMin=min(AY);
     1054            YMax=max(AY);
     1055        end
     1056        if test_vec
     1057            XMin=[XMin min(vec_X)];
     1058            XMax=[XMax max(vec_X)];
     1059            YMin=[YMin min(vec_Y)];
     1060            YMax=[YMax max(vec_Y)];
     1061        end
     1062        PlotParamOut.MinX=min(XMin);
     1063        PlotParamOut.MaxX=max(XMax);
     1064        PlotParamOut.MinY=min(YMin);
     1065        PlotParamOut.MaxY=max(YMax);
     1066        if XMax>XMin
     1067            set(haxes,'XLim',[XMin XMax]);% set x limits of frame in axes coordinates
     1068        end
     1069        if YMax>YMin
     1070            set(haxes,'YLim',[YMin YMax]);% set x limits of frame in axes coordinates
     1071        end
     1072    end
     1073%     if Ylim(2)>Ylim(1)
     1074%         set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate
     1075%     end
     1076%     end
     1077    %    adjust the size of the plot to include the whole field, except if PlotParam.FixLimits=1
     1078    %     if ~(isfield(PlotParam,'FixLimits') && PlotParam.FixLimits) && test_lim
     1079    %         PlotParamOut.MinX=Xlim(1);
     1080    %         PlotParamOut.MaxX=Xlim(2);
     1081    %         PlotParamOut.MinY=Ylim(1);
     1082    %         PlotParamOut.MaxY=Ylim(2);
     1083%     if Xlim(2)>Xlim(1)
     1084%         set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates
     1085%     end
     1086%     if Ylim(2)>Ylim(1)
     1087%         set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate
     1088%     end
     1089    %     end
     1090
     1091    set(haxes,'YDir','normal')
    10691092    set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']);
    10701093    set(get(haxes,'YLabel'),'String',[YName ' (' y_units ')']);
  • trunk/src/uvmat.m

    r191 r192  
    220220UvData.axes2=[];
    221221UvData.axes1=[];
     222AxeData.LimEditBox=1; %initialise AxeData
     223set(handles.axes3,'UserData',AxeData)
    222224
    223225%functions for the mouse and keyboard
     
    42014203UvData=get(handles.uvmat,'UserData');
    42024204AxeData=UvData.axes3;
    4203 PlotParam=read_plot_param(handles);
    4204 PlotParam.Scalar
     4205'TESTupdateplot'
     4206PlotParam=read_plot_param(handles)
     4207PlotParam.Vectors
    42054208[PP,PlotParamOut]= plot_field(AxeData,haxes,PlotParam);
     4209'TESTOUT'
     4210PlotParamOut
    42064211write_plot_param(handles,PlotParamOut); %update the auto plot parameters
    42074212
     
    49474952    delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered
    49484953end
    4949 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
    4950 set_object(data,PlotHandles);% call the set_object interface
     4954%PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4955set_object(data,handles);% call the set_object interface
    49514956set(handles.MenuObject,'checked','on')
    49524957set(handles.uvmat,'UserData',UvData)
  • trunk/src/view_field.m

    r187 r192  
    9292ViewFieldData.axes3=[];%initiates the record of the current field (will be updated by plot_field)
    9393set(handles.view_field,'UserData',ViewFieldData);%store the current field
     94AxeData.LimEditBox=1; %initialise AxeData, the parent figure sets plot parameters
     95set(handles.axes3,'UserData',AxeData)
    9496if ~exist('Field','var')
    9597    return
    9698end
    97 'TESviewfield'
    9899[PlotType,PlotParamOut]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar)
    99100
  • trunk/src/write_plot_param.m

    r191 r192  
    11%'write_plot_param': update the plotting parameters on the uvmat interface after a plotting operation
    22function write_plot_param(handles,PlotParam)
    3 
     3'TESTwrite'
     4PlotParam
    45%coordinates
    56if isfield(PlotParam,'FixEqual')
Note: See TracChangeset for help on using the changeset viewer.