Changeset 432
- Timestamp:
- May 25, 2012, 8:59:59 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_files.m
r380 r432 108 108 'translate_points.fig';... 109 109 'update_imadoc';... %update the ImaDoc xml file 110 'update_obj';... update the object representation graph and its projection field, record it in the uvmat interface111 110 'update_waitbar';... update the waitbar display, used for ACTION functions in the GUI 'series' 112 111 'uvmat';...% master function for file scanning and visualisation of 2D fields -
trunk/src/mouse_down.m
r429 r432 311 311 ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object 312 312 IndexObj=length(UvData.Object); 313 %initiate a new object 314 if isempty(UvData.Object{IndexObj});313 %initiate a new object (no data .Coord yet recorded) 314 if ~isfield(UvData.Object{IndexObj},'Coord'); 315 315 ObjectData.Coord=[]; 316 316 ObjectNameNew=ObjectData.Name; … … 318 318 ObjectNameNew=ObjectData.Type; 319 319 end 320 % add an index to the object name if the proposed name already exists 321 322 320 % add an index to the object name if the proposed name already exists 323 321 vers=0;% index of the name 324 322 ListObject=get(hhuvmat.ListObject,'String'); … … 345 343 set(hhuvmat.ViewObject,'Value',1) 346 344 end 347 % ObjectData.Coord=[]; %reset previous object coordinates348 % ObjectData.Coord(1,1)=xy(1,1); % the object first coordinate is set by the mouse position349 % ObjectData.Coord(1,2)=xy(1,2);350 % if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3351 % ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle352 % end353 345 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 363 AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject 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 346 hobject=UvData.Object{IndexObj}.DisplayHandle.(fig_tag); 347 if isempty(hobject) 348 hobject=haxes; 349 end 350 ProjObject=UvData.Object{get(hhuvmat.ListObject_1,'Value')}; 351 AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject 369 352 UvData.Object{IndexObj}=ObjectData; 370 UvData.Object{IndexObj}.DisplayHandle _uvmat=AxeData.CurrentObject;371 UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject;353 UvData.Object{IndexObj}.DisplayHandle.(fig_tag)=AxeData.CurrentObject;% attribute the current plot object handle to the Object 354 %UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject; 372 355 set(huvmat,'UserData',UvData) 373 356 PlotData=get(AxeData.CurrentObject,'UserData'); -
trunk/src/mouse_motion.m
r413 r432 29 29 end 30 30 FigData=get(hObject,'UserData'); 31 32 31 if ishandle(FigData)% case of a zoom plot, the handle of the parent rectangle is stored in UserData, its parent is the plotting axes of the rectangle 33 currentfig=get(get(FigData,'parent'),'parent');32 CurrentFig=get(get(FigData,'parent'),'parent'); 34 33 else 35 currentfig=hObject;%usual plot36 end 37 hh currentfig=guidata(currentfig);38 test_zoom=get(hh currentfig.CheckZoom,'Value');%test for zoom activated on the current figure34 CurrentFig=hObject;%usual plot 35 end 36 hhCurrentFig=guidata(CurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field) 37 test_zoom=get(hhCurrentFig.CheckZoom,'Value');%test for zoom activated on the current figure 39 38 test_draw=0;%test for mouse drawing of object, =0 by default 40 39 test_object=0; %test for object editing or creation … … 42 41 test_zoom_draw=0; % test for zoom drawing 43 42 test_ruler=0;%test for active ruler 44 % test_piv=0;% test for PIV correlation display45 43 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle 46 44 if ~isempty(huvmat) 47 hhuvmat=guidata(huvmat); 45 hhuvmat=guidata(huvmat);%handles of the elements in uvma 48 46 test_edit_object=get(hhuvmat.edit_object,'Value'); 49 47 test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on'); … … 59 57 end 60 58 61 %find the current axe ' haxes' and display the current mouse position or uicontrol tag59 %find the current axe 'CurrentAxes' and display the current mouse position or uicontrol tag 62 60 text_displ_1=''; 63 61 text_displ_2=''; … … 74 72 hchild=get(hObject,'Children');%handles of all objects in the current figure 75 73 76 %% loop on all the objects in the current figure anddetect whether the mouse is over a plot axes77 haxes=[];74 %% loop on all the objects in the current figure, detect whether the mouse is over a plot axes 75 CurrentAxes=[]; 78 76 for ichild=1:length(hchild) 79 77 obj_pos=get(hchild(ichild),'Position'); … … 85 83 %if the mouse is over an axis, look at the data 86 84 if strcmp(htype,'axes') 87 haxes=hchild(ichild);88 xy=get( haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates89 AxeData=get( haxes,'UserData');% data attached to the axis85 CurrentAxes=hchild(ichild); 86 xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 87 AxeData=get(CurrentAxes,'UserData');% data attached to the axis 90 88 if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing) 91 89 test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active … … 96 94 pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis) 97 95 end 98 FigData=get( currentfig,'UserData');99 tagaxes=get( haxes,'tag');96 FigData=get(CurrentFig,'UserData'); 97 tagaxes=get(CurrentAxes,'tag'); 100 98 if isfield(FigData,tagaxes) 101 99 eval(['Field=FigData.' tagaxes ';']) … … 117 115 (Y<(xy(1,2)+Field.Mesh/3) & Y>(xy(1,2)-Field.Mesh/3));%f 118 116 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 119 hhh=findobj( haxes,'Tag','vector_marker');117 hhh=findobj(CurrentAxes,'Tag','vector_marker'); 120 118 if ~isempty(ivec) 121 119 % mark the vectors with a circle in the absence of other operations … … 123 121 pointershape='arrow'; %mouse indicates the detection of a vector 124 122 if isempty(hhh) 125 set(0,'CurrentFigure', currentfig)126 set( currentfig,'CurrentAxes',haxes)123 set(0,'CurrentFigure',CurrentFig) 124 set(CurrentFig,'CurrentAxes',CurrentAxes) 127 125 rectangle('Curvature',[1 1],... 128 126 'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh],'EdgeColor','m',... … … 226 224 shiftx=par.Shiftx; 227 225 shifty=par.Shifty; 228 hhh=findobj( haxes,'Tag','PIV_box_marker');229 hhhh=findobj( haxes,'Tag','PIV_search_marker');226 hhh=findobj(CurrentAxes,'Tag','PIV_box_marker'); 227 hhhh=findobj(CurrentAxes,'Tag','PIV_search_marker'); 230 228 if isempty(hhh) 231 set(0,'CurrentFigure', currentfig)232 set( currentfig,'CurrentAxes',haxes)229 set(0,'CurrentFigure',CurrentFig) 230 set(CurrentFig,'CurrentAxes',CurrentAxes) 233 231 rectangle('Curvature',[0 0],... 234 232 'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2],'EdgeColor','m',... … … 264 262 AxeData.TitleHandle=title(num2str(par.Grid)); 265 263 colorbar 266 set( haxes,'UserData',AxeData)264 set(CurrentAxes,'UserData',AxeData) 267 265 set(get(AxeData.CurrentCorrImage,'parent'),'YDir','normal') 268 266 end … … 301 299 else 302 300 AxeData.CurrentRectZoom=rectangle('Position',rect,'LineStyle',':','Tag','rect_zoom'); 303 set( haxes,'UserData',AxeData)301 set(CurrentAxes,'UserData',AxeData) 304 302 end 305 303 end … … 311 309 %% create or modify an object 312 310 if ~isempty(huvmat) && test_object 311 UvData=get(huvmat,'UserData'); 313 312 PlotData=get(AxeData.CurrentObject,'UserData'); 314 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle 315 if ~isempty(huvmat) 316 UvData=get(huvmat,'UserData'); 317 if ~isfield(PlotData,'IndexObj') 318 return 313 if ~isfield(PlotData,'IndexObj') 314 return 315 end 316 ObjectData=UvData.Object{PlotData.IndexObj}; 317 ProjObject=[];% object (plane) whose projection is represented on the current axes 318 if isequal(hObject,huvmat)% if the mouse ifs over the GUI uvmat 319 ProjObject=UvData.Object{get(hhuvmat.ListObject_1,'Value')}; 320 else 321 ProjObject=UvData.Object{get(hhuvmat.ListObject,'Value')}; 322 end 323 XYData=AxeData.CurrentOrigin; 324 if isequal(AxeData.Drawing,'create') && isfield(AxeData,'CurrentOrigin') && ~isempty(AxeData.CurrentOrigin) 325 if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points') 326 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)]; 327 % ObjectData.Coord(end,:)=xy(1,:); 328 elseif strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')||strcmp(ObjectData.Type,'volume') 329 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate 330 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2; 331 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width 332 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height 333 elseif isequal(ObjectData.Type,'plane') %case of 'plane' 334 DX=(xy(1,1)-ObjectData.Coord(1,1)); 335 DY=(xy(1,2)-ObjectData.Coord(1,2)); 336 ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle widt 337 if isfield(ObjectData,'RangeX') 338 XMax=sqrt(DX*DX+DY*DY); 339 if XMax>max(ObjectData.RangeX) 340 ObjectData.RangeX=[min(ObjectData.RangeX) XMax]; 341 end 342 end 319 343 end 320 ObjectData=UvData.Object{PlotData.IndexObj}; 321 XYData=AxeData.CurrentOrigin; 322 if isequal(AxeData.Drawing,'create') && isfield(AxeData,'CurrentOrigin') && ~isempty(AxeData.CurrentOrigin) 323 if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points') 324 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)]; 325 % ObjectData.Coord(end,:)=xy(1,:); 326 elseif strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')||strcmp(ObjectData.Type,'volume') 327 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate 328 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2; 329 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width 330 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height 331 elseif isequal(ObjectData.Type,'plane') %case of 'plane' 332 DX=(xy(1,1)-ObjectData.Coord(1,1)); 333 DY=(xy(1,2)-ObjectData.Coord(1,2)); 334 ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle widt 335 if isfield(ObjectData,'RangeX') 336 XMax=sqrt(DX*DX+DY*DY); 337 if XMax>max(ObjectData.RangeX) 338 ObjectData.RangeX=[min(ObjectData.RangeX) XMax]; 339 end 340 end 341 end 342 plot_object(ObjectData,[],AxeData.CurrentObject,'m'); 343 pointershape='crosshair'; 344 elseif isequal(AxeData.Drawing,'translate') 345 DX=xy(1,1)-XYData(1);%translation from initial position 346 DY=xy(1,2)-XYData(2); 347 ObjectData.Coord(:,1)=ObjectData.Coord(:,1)+DX; 348 ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY; 349 plot_object(ObjectData,[],AxeData.CurrentObject,'m'); 350 pointershape='fleur'; 351 elseif isequal(AxeData.Drawing,'deform') 352 ind_move=AxeData.CurrentIndex; 353 ObjectData.Coord(ind_move,1)=xy(1,1); 354 ObjectData.Coord(ind_move,2)=xy(1,2); 355 plot_object(ObjectData,[],AxeData.CurrentObject,'m'); 356 pointershape='circle'; 357 end 358 end 359 end 344 plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m'); 345 pointershape='crosshair'; 346 elseif isequal(AxeData.Drawing,'translate') 347 DX=xy(1,1)-XYData(1);%translation from initial position 348 DY=xy(1,2)-XYData(2); 349 ObjectData.Coord(:,1)=ObjectData.Coord(:,1)+DX; 350 ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY; 351 plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m'); 352 pointershape='fleur'; 353 elseif isequal(AxeData.Drawing,'deform') 354 ind_move=AxeData.CurrentIndex; 355 ObjectData.Coord(ind_move,1)=xy(1,1); 356 ObjectData.Coord(ind_move,2)=xy(1,2); 357 plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m'); 358 pointershape='circle'; 359 end 360 end 360 361 361 362 %% detect calibration points if the GUI geometry_calib is opened … … 371 372 XCoord=(data.Coord(:,4)); 372 373 YCoord=(data.Coord(:,5)); 373 xy=get( haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates374 xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 374 375 if ~isempty(xy) 375 xlim=get( haxes,'XLim');376 xlim=get(CurrentAxes,'XLim'); 376 377 ind_range_x=abs((xlim(2)-xlim(1))/50); 377 ylim=get( haxes,'YLim');378 ylim=get(CurrentAxes,'YLim'); 378 379 ind_range_y=abs((ylim(2)-ylim(1))/50); 379 380 ind_range=sqrt(ind_range_x*ind_range_y); … … 414 415 415 416 %% update the mouse pointer 416 set( currentfig,'Pointer',pointershape);417 set(CurrentFig,'Pointer',pointershape); -
trunk/src/mouse_up.m
r429 r432 59 59 PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object 60 60 IndexObj=PlotData.IndexObj; 61 ObjectData=UvData.Object{IndexObj}; 61 ObjectData=UvData.Object{IndexObj}; 62 62 % ObjectData.enable_plot=1; 63 63 if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse') … … 139 139 140 140 %% update the object representation 141 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat;142 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field;143 UvData.Object{IndexObj}=ObjectData;%update the current object properties144 hhuvmat=guidata(huvmat);145 IndexObj_1=get(hhuvmat.ListObject_1,'Value');146 IndexObj_2=get(hhuvmat.ListObject,'Value');147 UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2);141 % ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat; 142 % ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field; 143 % UvData.Object{IndexObj}=ObjectData;%update the current object properties 144 % hhuvmat=guidata(huvmat); 145 % IndexObj_1=get(hhuvmat.ListObject_1,'Value'); 146 % IndexObj_2=get(hhuvmat.ListObject,'Value'); 147 % UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2); 148 148 149 149 %% plot the field projected on the object … … 199 199 set(hhuvmat.MenuEdit,'Enable','on');% 200 200 end 201 e lse201 end 202 202 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the new current origin 203 203 test_drawing=1;%allow continuation of drawing object 204 204 UvData.Object{IndexObj}=ObjectData; 205 end205 % end 206 206 hother=findobj('Tag','deformpoint');%find all the deformpoints 207 207 set(hother,'Color','b');%reset all the deformpoints in 'blue' -
trunk/src/plot_object.m
r397 r432 1 1 %'plot_object': draws a projection object (points, line, plane...) 2 2 %------------------------------------------------------------------- 3 % function [ObjectData_out,hh]=plot_object(ObjectData,hplot,col)3 % function hh=plot_object(ObjectData,ProjObject,hplot,col) 4 4 % 5 5 %OUTPUT … … 8 8 %INPUT: 9 9 % 10 % ObjectData In: structure representing the object properties:10 % ObjectData: structure representing the object properties: 11 11 % .Type : style of projection object 12 12 % .Coord: set of coordinates defining the object position; … … 36 36 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 37 37 38 function [hh]=plot_object(ObjectDataIn,ProjObject,hplot,col) 38 function [hh]=plot_object(ObjectData,ProjObject,hplot,col) 39 39 40 %% default output 40 41 hh=[];%default output 41 if ~isfield(ObjectDataIn,'Type')|| isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot 42 return 43 end 44 if ~isfield(ProjObject,'Type') 45 ObjectData=ObjectDataIn; 46 elseif isequal(ProjObject.Type,'plane') 47 ObjectData=ObjectDataIn;% TODO: modify take into account rotation of axis 48 else 49 return % object representation only available in a plane 50 end 51 if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type) 52 msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m') 53 return 54 end 55 if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type) 56 msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m') 57 return 42 % object representation is canceled if the field is not projected on a plane or is the same as the represented object 43 if ~isfield(ObjectData,'Type')|| isequal(ProjObject,ObjectData)|| ~strcmp(ProjObject.Type,'plane') 44 if ~isempty(hplot) && ishandle(hplot) && ~strcmp(get(hplot,'Type'),'axes') 45 ObjectPlotData=get(hplot,'UserData'); 46 if isfield(ObjectPlotData,'SubObject') & ishandle(ObjectPlotData.SubObject) 47 delete(ObjectPlotData.SubObject); 48 end 49 if isfield(ObjectPlotData,'DeformPoint') & ishandle(ObjectPlotData.DeformPoint) 50 delete(ObjectPlotData.DeformPoint); 51 end 52 delete(hplot) 53 end 54 return 58 55 end 59 56 XMin=0;%default … … 74 71 haxes=hplot; 75 72 currentfig=get(hplot,'parent'); 76 % set(0,'CurrentFigure',currentfig)77 78 % set(currentfig,'CurrentAxes',haxes);79 73 elseif isequal(get(hplot,'Type'),'figure')% hplot is the handle of a figure 80 74 set(0,'CurrentFigure',hplot);%set the input figure as the current one … … 82 76 haxes=haxes(1); 83 77 currentfig=hplot; 84 % set(hplot,'CurrentAxes',haxes);%set the first found axis as the current one85 78 else 86 79 currentfig=figure; %create new figure … … 103 96 ObjectData.Coord=[0 0 0];%default 104 97 end 105 % if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi)106 % ObjectData.Phi=0;%default107 % end108 % if ~isfield(ObjectData,'Range')109 % ObjectData.Range(1,1)=0; %edfault110 % end111 % if size(ObjectData.Range,2)>=2112 % YMax=ObjectData.Range(1,2);%default113 % end114 % if size(ObjectData.Range,2)>=2 & size(ObjectData.Range,1)>=2115 % YMin=ObjectData.Range(2,2);116 % else117 % YMin=0;118 % end119 98 if isfield(ObjectData,'RangeX') && ~isempty(ObjectData.RangeX) 120 99 XMax=max(ObjectData.RangeX); -
trunk/src/set_object.m
r429 r432 414 414 415 415 %------------------------------------------------------------------------ 416 % --- Executes on button press in PLOT: PLOT the definedobject and its projected field416 % --- Executes on button press in PLOT: refresh the current object , plot the object and its projected field 417 417 function PLOT_Callback(hObject, eventdata, handles) 418 418 … … 430 430 ObjectName=ObjectData.Name;%name of the current object defined in set_object 431 431 if isempty(ObjectName) 432 ObjectName=ObjectData.Type; 433 end 434 435 %% read the object selection in the GUI uvmat432 ObjectName=ObjectData.Type;% name the object by the object type type by default 433 end 434 435 %% read the current object selection in the GUI uvmat 436 436 huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle 437 437 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 438 438 hhuvmat=guidata(huvmat);%handles of the objects children of the GUI uvmat 439 ListObject=get(hhuvmat.ListObject_1,'String');% list of objects displayed in uvmat 440 IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat 441 if get(hhuvmat.ViewObject,'Value') && get(hhuvmat.edit_object,'Value') 442 IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field 443 end 439 ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat 440 IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat 444 441 if ~get(hhuvmat.edit_object,'Value') %new object is being created 445 442 detectname=1; … … 461 458 ObjectName=ObjectNameNew; 462 459 set(handles.Name,'String',ObjectName)% display the default name in set_object 463 IndexObj (2)=numel(ListObject)+1;% append an object to the list in uvmat460 IndexObj=numel(ListObject)+1;% append an object to the list in uvmat 464 461 set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list 465 462 set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list 466 set(hhuvmat.ListObject,'Value',IndexObj (2))463 set(hhuvmat.ListObject,'Value',IndexObj) 467 464 set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object 468 UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet) 469 end 470 471 %% naming the object 472 % ListObject{IndexObj(end),1}=ObjectName; 473 % set(hhuvmat.ListObject,'String',ListObject) 474 % set(hhuvmat.ListObject_1,'String',ListObject) 475 476 %% update the object plot 477 if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles 478 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat; 479 else 480 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input 481 end 482 if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles 483 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field; 484 else 485 ObjectData.DisplayHandle_view_field=[]; 486 end 487 UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties 488 if numel(IndexObj)==2 489 UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2)); 490 end 491 set(huvmat,'UserData',UvData) 465 UvData.Object{IndexObj}=[];%initiate a new object (empty yet) 466 UvData.Object{IndexObj}.DisplayHandle.uvmat=hhuvmat.axes3; %axes taken as object display handle by defualt 467 end 492 468 493 469 %% plot the field projected on the object 470 hview_field=[];%default 494 471 if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none') 495 472 PlotType='text'; … … 500 477 return 501 478 end 502 if numel(IndexObj)==1 % if only one object is selected, the projection is in uvmat 479 IndexObj_1=get(hhuvmat.ListObject_1,'Value') 480 if isequal(IndexObj_1,IndexObj) % if only one object is selected, the projection is in uvmat 503 481 PlotType=plot_field(ProjData,hhuvmat.axes3,read_GUI(get(hhuvmat.axes3,'parent')));%update the current uvmat plot 504 482 else % if a second object is selected, the projection is in view_field, and this second object is selected … … 525 503 end 526 504 end 505 506 %% update the object plot 507 % if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle')% save the previous object graph handles 508 % ObjectData.DisplayHandle.uvmat=UvData.Object{IndexObj(end)}.DisplayHandle.uvmat; 509 % else 510 % ObjectData.DisplayHandle.uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input 511 % end 512 % if isfield(UvData.Object{IndexObj},'DisplayHandle')% save the previous object graph handles 513 % ObjectData.DisplayHandle.view_field=UvData.Object{IndexObj(end)}.DisplayHandle.view_field; 514 % else 515 % ObjectData.DisplayHandle.view_field=[]; 516 % end 517 % UvData.Object{IndexObj}=ObjectData;%update the current object properties 518 % if numel(IndexObj)==2 519 hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat; 520 if isempty(hobject) 521 hobject=hhuvmat.axes3; 522 end 523 UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(ObjectData,[],hobject,'m');%draw the object in uvmat 524 if ~isempty(hview_field) 525 if isfield(UvData.Object{IndexObj}.DisplayHandle,'view_field') 526 hobject=UvData.Object{IndexObj}.DisplayHandle.view_field; 527 end 528 if isempty(hobject) 529 hobject=haxes; 530 end 531 UvData.Object{IndexObj}.DisplayHandle.view_field=plot_object(ObjectData,[],hobject,'m');%draw the object in view_field 532 % UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2)); 533 end 534 set(huvmat,'UserData',UvData) 527 535 528 536 %% update the GUI uvmat -
trunk/src/uvmat.m
r429 r432 237 237 238 238 %% refresh projection plane 239 UvData.Object{1}.ProjMode='projection';%main plotting plane 239 % UvData.Object{1}.ProjMode='projection';%main plotting plane 240 % UvData.Object{1}.DisplayHandle.uvmat=handles.axes3; 241 % UvData.Object{1}.DisplayHandle.view_field=[]; 240 242 set(handles.ListObject,'Value',1)% default: empty projection objectproj_field 241 243 set(handles.ListObject,'String',{'plane'}) … … 2510 2512 UvData.Field.Mesh=ord; 2511 2513 end 2512 2514 UvData.Object{1}.Type='plane';%main plotting plane 2515 UvData.Object{1}.ProjMode='projection';%main plotting plane 2516 UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat 2517 UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat 2513 2518 2514 2519 %% 3D case (menuvolume) … … 2523 2528 if test_set_object% reinitiate the GUI set_object 2524 2529 delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.ListObject and 2 2525 UvData.Object{1}.Type='plane';%main plotting plane 2526 UvData.Object{1}.ProjMode='projection';%main plotting plane 2527 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2530 % UvData.Object{1}.Type='plane';%main plotting plane 2531 % UvData.Object{1}.ProjMode='projection';%main plotting plane 2532 % UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat 2533 % UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat 2528 2534 UvData.Object{1}.NbDim=NbDim;%test for 3D objects 2529 2535 UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane … … 3985 3991 % --- Executes on selection change in ListObject_1. 3986 3992 function ListObject_1_Callback(hObject, eventdata, handles) 3987 list_str=get(handles.ListObject _1,'String');3993 list_str=get(handles.ListObject,'String'); 3988 3994 UvData=get(handles.uvmat,'UserData'); 3989 3995 ObjectData=UvData.Object{get(handles.ListObject_1,'Value')}; 3990 3996 3991 3997 %% update the projection plot on uvmat 3992 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on UvData.Object{IndexObj(1)} 3993 plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));%read plotting parameters on the uvmat interfacPlotHandles); 3994 Object_out=update_obj(UvData,get(handles.ListObject_1,'Value'),[]); 3998 ProjData= proj_field(UvData.Field,ObjectData);%project the current input field on object ObjectData 3999 plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));% plot the projected field; 4000 %replot all the objects within the new projected field 4001 for IndexObj=1:numel(list_str) 4002 IndexObj 4003 hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat 4004 if isempty(hobject) || ~ishandle(hobject) 4005 hobject=handles.axes3 4006 end 4007 if isequal(IndexObj,get(handles.ListObject,'Value')) 4008 objectcolor='m'; %paint in magenta the currently selected object in ListObject 4009 else 4010 objectcolor='b'; 4011 end 4012 UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(UvData.Object{IndexObj},ObjectData,hobject,objectcolor);%draw the object in uvmat 4013 end 4014 set(handles.uvmat,'UserData',UvData) 3995 4015 3996 4016 %% display the object parameters if the GUI set_object is already opened … … 4005 4025 set(handles.ViewObject,'Value',1)% show that the selected object in ListObject_1 is currently visualised 4006 4026 end 4027 4007 4028 % desactivate the edit object mode 4008 4029 set(handles.edit_object,'Value',0) … … 4059 4080 4060 4081 %% update the color of the graphic object representation: the selected object in magenta, others in blue 4061 update_object_color(handles.axes3,hhview_field.axes3,UvData.Object{IndexObj(end)}.DisplayHandle_uvmat) 4062 hview_field=findobj(allchild(0),'tag','view_field'); 4082 update_object_color(handles.axes3,hhview_field.axes3,UvData.Object{IndexObj}.DisplayHandle.uvmat) 4063 4083 4064 4084 %------------------------------------------------------------------------ … … 4087 4107 set(hother(iobj),'Selected','off') 4088 4108 end 4089 if ~isempty(DisplayHandle)4109 if ishandle(DisplayHandle) 4090 4110 linetype=get(DisplayHandle,'Type'); 4091 4111 if isequal(linetype,'line') … … 4257 4277 else 4258 4278 Data=get(hview_field,'UserData'); 4259 set(hview_field,'Position',Data.GUISize) 4279 set(hview_field,'Position',Data.GUISize)% restore the size of view_field for plots 4260 4280 end 4261 4281 else … … 4513 4533 UvData=get(handles.uvmat,'UserData'); 4514 4534 UvData.Object{IndexObj}=[]; %create a new empty object 4535 UvData.Object{IndexObj}.DisplayHandle.uvmat=handles.axes3; % axes for plot_object 4536 UvData.Object{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 4515 4537 data.Name=data.Type;% default name=type 4516 4538 data.Coord=[0 0]; %default … … 4568 4590 set(handles.ListObject,'String',ListObject) 4569 4591 end 4592 UvData=get(handles.uvmat,'UserData'); 4593 UvData.Object{IndexObj}=[]; %create a new empty object 4594 UvData.Object{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation 4595 UvData.Object{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 4596 set(handles.uvmat,'UserData',UvData) 4570 4597 set(handles.ListObject,'Value',length(ListObject)) 4571 4598 hset_object=set_object(data);% call the set_object interface … … 4574 4601 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4575 4602 set(handles.delete_object,'Visible','on') 4603 4576 4604 4577 4605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -
trunk/src/view_field.m
r429 r432 64 64 guidata(hObject, handles); 65 65 66 dircur=pwd; %current working directory67 dir_opening=dircur;68 69 % set the position of colorbar and ancillary GUIs:70 set(hObject,'Units','Normalized')71 handles_mouse=handles;72 huvmat=findobj(allchild(0),'Name','uvmat');73 if ~isempty(huvmat)74 hhuvmat=guidata(huvmat);75 handles_mouse.edit=hhuvmat.edit_object;76 pos_view_field=get(hObject,'Position');77 pos_uvmat=get(huvmat,'Position');78 pos_view_field(1)=pos_uvmat(1)+pos_uvmat(3)/2;79 pos_view_field(2)=pos_uvmat(2)-pos_uvmat(3)/4;80 % pos_view_field(3:4)=pos_uvmat(3:4);81 set(hObject,'Position',pos_view_field)82 end83 84 66 %functions for the mouse and keyboard 85 set(hObject,'KeyPressFcn',{'keyboard_callback',handles _mouse})%set keyboard action function86 set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles _mouse})%set mouse action functio67 set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function 68 set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles})%set mouse action functio 87 69 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 88 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles _mouse})70 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles}) 89 71 set(hObject,'DeleteFcn',{@closefcn})% 90 72 set(hObject,'ResizeFcn',{@ResizeFcn,handles})% … … 103 85 write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters 104 86 end 87 88 %put the GUI on the lower right of the sceen 89 pos_view_field=get(hObject,'Position'); 90 ScreenSize=get(0,'ScreenSize'); 91 pos_view_field(1)=ScreenSize(1)+ScreenSize(3)-pos_view_field(3); 92 pos_view_field(2)=ScreenSize(2); 93 set(hObject,'Position',pos_view_field) 105 94 106 95 %------------------------------------------------------------------------ … … 827 816 828 817 818 % 819 % 820 % % --- Executes when view_field is resized. 821 % function view_field_ResizeFcn(hObject, eventdata, handles) 822 % % hObject handle to view_field (see GCBO) 823 % % eventdata reserved - to be defined in a future version of MATLAB 824 % % handles structure with handles and user data (see GUIDATA)
Note: See TracChangeset
for help on using the changeset viewer.