Changeset 429 for trunk/src/view_field.m


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

improvements in object drawing and projection on points

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.