- Timestamp:
- May 2, 2013, 7:51:42 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_files.m
r623 r625 43 43 'civ_3D.fig';... 44 44 'civ_matlab';...% civ programs, Matlab version (called by civ.m, option Civprogram/Matlab in the upper menu bar) 45 'close_fig';...% function activated when a figure is closed46 45 'copyfields';...% copy fields between two matlab structures 47 46 'create_grid';...% called by the GUI geometry_calib to create a physical grid -
trunk/src/keyboard_callback.m
r622 r625 3 3 function keyboard_callback(hObject,eventdata,handleshaxes) 4 4 cur_axes=get(hObject,'CurrentAxes');%current plotting axes of the figure with handle hObject 5 if ~isempty(eventdata) && isnumeric(eventdata)6 xx=eventdata; % keyboard_callback called by mouse_down7 else8 5 xx=double(get(hObject,'CurrentCharacter')); %get the keyboard character 9 end10 6 switch xx 11 7 case {29,28,30,31} %arrows for displacement 8 AxeData=get(cur_axes,'UserData'); 9 if isfield(AxeData,'ZoomAxes')&&ishandle(AxeData.ZoomAxes) 10 cur_axes=AxeData.ZoomAxes;% move the field of the zoom sub-plot instead of the main axes if it exsits 11 axes(cur_axes) 12 end 12 13 if ~isempty(cur_axes) 13 14 xlimit=get(cur_axes,'XLim'); … … 33 34 rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)]; 34 35 set(hparentrect,'Position',rect) 35 hfig=get(hparentrect,'parent');36 hfig=get(hfig,'parent');37 36 elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field) 38 37 hh=guidata(hfig); -
trunk/src/mouse_down.m
r623 r625 28 28 FigData=get(hObject,'UserData'); %default data stored on the current object 29 29 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 30 h currentfig=get(get(FigData,'parent'),'parent');%handle of the current GUI: zoom plot30 hCurrentGUI=get(get(FigData,'parent'),'parent');%handle of the current GUI: zoom plot 31 31 else 32 h currentfig=hObject; % handle of the current GUI: usual plot33 end 34 hh currentfig=guidata(hcurrentfig);% tags of the children of the current GUI32 hCurrentGUI=hObject; % handle of the current GUI: usual plot 33 end 34 hhCurrentGUI=guidata(hCurrentGUI);% tags of the children of the current GUI 35 35 CheckZoom=0; 36 if isfield(hh currentfig,'CheckZoom') && get(hhcurrentfig.CheckZoom,'Value');%test for zoom action, first priority36 if isfield(hhCurrentGUI,'CheckZoom') && get(hhCurrentGUI.CheckZoom,'Value');%test for zoom action, first priority 37 37 CheckZoom=1; 38 38 end 39 39 test_piv=isfield(FigData,'CivHandle'); 40 set(h currentfig,'Units','pixels')41 GUI_pos=get(h currentfig,'Position');%position of the GUI series on the screen (in pixels), used to position message boxes42 set(h currentfig,'Units','normalized')% back to current unit for fig position40 set(hCurrentGUI,'Units','pixels') 41 GUI_pos=get(hCurrentGUI,'Position');%position of the GUI series on the screen (in pixels), used to position message boxes 42 set(hCurrentGUI,'Units','normalized')% back to current unit for fig position 43 43 44 44 %% determine the currently selected items 45 45 hcurrentobject=gco;% current object handle (selected by the mouse) 46 fig_tag=get(hcurrentfig,'Tag');46 CurrentGUI_tag=get(hCurrentGUI,'Tag'); 47 47 obj_tag=get(gco,'Tag');%tag of the currently selected object 48 48 xy=[];%default … … 63 63 if ~isempty(hset_object) 64 64 hPLOT=findobj(hset_object,'tag','PLOT'); 65 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'65 test_create=strcmp(get(hPLOT,'enable'),'on') &&~get(hhuvmat.edit_object,'Value');% create new object if set_object is in mode enable and uvmat not in mode 'edit_object' 66 66 end 67 67 test_edit_vect=get(hhuvmat.edit_vect,'Value') && ~test_create && ~(isequal(obj_tag,'proj_object')||isequal(obj_tag,'DeformPoint')) ;%test for vector editing, priority 4 … … 81 81 %% loop on all the objects in the current figure (selected by the last mouse click) 82 82 hchildren=get(hObject,'Children');%handles of all objects in the current figure 83 check_visible=strcmp(get(hchildren,'Visible'),'on');% if visible='on', =0 otherwise 84 hchildren=hchildren(check_visible); %kkep only the visible children 83 check_visible=strcmp(get(hchildren,'Visible'),'on')& ~strcmp(get(hchildren,'Type'),'uimenu');% if visible='on', =0 otherwise 84 hchildren=hchildren(check_visible); %keep only the visible children 85 set(hchildren,'Units','normalized'); 85 86 PosChildren=get(hchildren,'Position');% set of object positions 86 87 if iscell(PosChildren)% only one child … … 96 97 ind_object=find(check_pos(:,1) & check_pos(:,2),1);% select the index of the (first) object under the mouse 97 98 hchild=hchildren(ind_object);% corresponding object handle 98 if isempty(hchild) 99 % if test_edit||test_create 100 % hPlotAxes=findobj(hcurrentfig,'Tag','PlotAxes'); 101 % if ~isempty( hPlotAxes) 102 % PosPlotAxes=get(hPlotAxes,'Position'); 103 % PosDiff(1)=xy_fig(1)-PosPlotAxes(1)-PosPlotAxes(3);% distance to the right axes edge 104 % PosDiff(2)=PosPlotAxes(1)-xy_fig(1);% distance to the left axes edge 105 % PosDiff(3)=xy_fig(2)-PosPlotAxes(1)-PosPlotAxes(3);% distance to the top axes edge 106 % PosDiff(4)=PosPlotAxes(2)-xy_fig(2);% distance to the low axes edge 107 % [tild,ind_sel]=max(PosDiff); 108 % list_arrow=[29 28 30 31]; 109 % arrow_option=list_arrow(ind_sel); 110 % keyboard_callback(hcurrentfig,arrow_option) 111 % return 112 % end 113 % end 114 else 99 if ~isempty(hchild) 115 100 htype=get(hchild,'Type');%type of object child of the current figure 116 101 switch htype … … 129 114 if test_edit_vect 130 115 ivec=[]; 131 FigData=get(h currentfig,'UserData');116 FigData=get(hCurrentGUI,'UserData'); 132 117 tagaxes=get(hchild,'tag'); 133 118 if isfield(FigData,tagaxes) … … 200 185 201 186 %% creation of a zoom subfig 202 if isfield(hh currentfig,'CheckZoomFig') && get(hhcurrentfig.CheckZoomFig,'Value')187 if isfield(hhCurrentGUI,'CheckZoomFig') && get(hhCurrentGUI.CheckZoomFig,'Value') 203 188 AxeData.Drawing='zoom'; %initiate drawing mode 204 189 AxeData.CurrentObject=[];%unselect objects … … 212 197 213 198 %% ruler has second priority 214 if test_ruler 199 if test_ruler && ~isempty(xy) 215 200 AxeData.RulerCoord(1,1:2)=xy(1,1:2); 216 201 AxeData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler'); … … 287 272 IndexObj=ObjectData.IndexObj; 288 273 %indicate on the list of the GUI uvmat which object has been selected 289 if strcmp(get(h currentfig,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field274 if strcmp(get(hCurrentGUI,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field 290 275 % IndexObj=get(hhuvmat.ListObject,'Value'); 291 276 % if IndexObj>IndexObj_old(1) … … 331 316 332 317 %% create projection object 333 if test_create && ~isempty(xy) 318 if test_create && ~isempty(xy) && ~strcmp(get(hCurrentGUI,'SelectionType'),'alt') 334 319 % activate this option if the GUI set_object is opened 335 if ~isempty(hset_object) && ~strcmp(get(hcurrentfig,'SelectionType'),'alt') 336 sethandles=guidata(hset_object);% handles of the elements in the GUI set_object 337 ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object 338 IndexObj=length(UvData.ProjObject); 339 %initiate a new object (no data .Coord yet recorded) 340 if ~isfield(UvData.ProjObject{IndexObj},'Coord'); 341 ObjectData.Coord=[]; 342 ObjectNameNew=ObjectData.Name; 343 if isempty(ObjectNameNew) 344 ObjectNameNew=ObjectData.Type; 345 end 346 % add an index to the object name if the proposed name already exists 347 vers=0;% index of the name 348 ListObject=get(hhuvmat.ListObject,'String'); 349 detectname=1; 350 while ~isempty(detectname) 351 detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list 352 if detectname% if the object name already exists 353 indstr=regexp(ObjectNameNew,'\D'); 354 if indstr(end)<length(ObjectNameNew) %object name ends by a number 355 vers=str2double(ObjectNameNew(indstr(end)+1:end))+1; 356 ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)]; 357 else 358 vers=vers+1; 359 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]; 360 end 320 sethandles=guidata(hset_object);% handles of the elements in the GUI set_object 321 ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object 322 IndexObj=length(UvData.ProjObject); 323 % if the currently selected object is already finished, a new object is initiated 324 if ~isfield(UvData.ProjObject{IndexObj},'CreateMode') 325 IndexObj=IndexObj+1;%start new object 326 ObjectData.Coord=[]; 327 ObjectNameNew=ObjectData.Name; 328 if isempty(ObjectNameNew) 329 ObjectNameNew=ObjectData.Type; 330 end 331 % add an index to the object name if the proposed name already exists 332 vers=0;% index of the name 333 ListObject=get(hhuvmat.ListObject,'String'); 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)]; 361 345 end 362 346 end 363 ObjectName=ObjectNameNew; 364 set(sethandles.Name,'String',ObjectName)% display the default name in set_object 365 if isempty(ListObject) 366 ListObject={ObjectName}; 367 else 368 ListObject{end}=ObjectName; 369 end 370 set(hhuvmat.ListObject,'String',ListObject);%complement the object list 371 set(hhuvmat.ListObject_1,'String',ListObject);%complement the object list 347 end 348 ObjectName=ObjectNameNew; 349 set(sethandles.Name,'String',ObjectName)% display the default name in set_object 350 ListObject=[ListObject;{ObjectName}]; 351 set(hhuvmat.ListObject,'String',ListObject);%complement the object list 352 set(hhuvmat.ListObject_1,'String',ListObject);%complement the object list 353 if strcmp(CurrentGUI_tag,'uvmat') 372 354 set(hhuvmat.ListObject,'Value',IndexObj) 373 set(hhuvmat.ViewObject,'Value',1) 374 end 375 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object 376 %TODO replace 0 by z coord for 3D 377 hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(fig_tag); 378 if isempty(hobject) 379 hobject=haxes; 380 end 355 else 356 set(hhuvmat.ListObject_1,'Value',IndexObj) 357 end 358 UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object 359 UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 360 set(hhuvmat.ViewObject,'Value',1) 361 end 362 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object 363 %TODO replace 0 by z coord for 3D 364 hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(CurrentGUI_tag); 365 if isempty(hobject) 366 hobject=haxes; 367 end 368 if strcmp(CurrentGUI_tag,'uvmat') 381 369 ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')}; 382 AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject 383 UvData.ProjObject{IndexObj}=ObjectData; 384 UvData.ProjObject{IndexObj}.DisplayHandle.(fig_tag)=AxeData.CurrentObject;% attribute the current plot object handle to the Object 385 set(huvmat,'UserData',UvData) 386 PlotData=get(AxeData.CurrentObject,'UserData'); 387 PlotData.IndexObj=IndexObj; 388 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion) 389 AxeData.Drawing='create';% flag for mouse motion 390 %show object coordinates in the GUI set_object 391 h_set_object=findobj(allchild(0),'Tag','set_object'); 392 hh_set_object=guidata(h_set_object); 393 set(hh_set_object.Coord,'Data',ObjectData.Coord); 394 end 370 else 371 ProjObject=UvData.ProjObject{get(hhuvmat.ListObject,'Value')}; 372 end 373 AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject 374 UvData.ProjObject{IndexObj}=ObjectData; 375 UvData.ProjObject{IndexObj}.DisplayHandle.(CurrentGUI_tag)=AxeData.CurrentObject;% attribute the current plot object handle to the Object 376 UvData.ProjObject{IndexObj}.CreateMode='on';% mark the object as in the course of creation 377 set(huvmat,'UserData',UvData) 378 PlotData=get(AxeData.CurrentObject,'UserData'); 379 PlotData.IndexObj=IndexObj; 380 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion) 381 AxeData.Drawing='create';% flag for mouse motion 382 383 384 %initiate a new object (no data .Coord yet recorded) 385 %if ~isfield(UvData.ProjObject{IndexObj},'Coord'); 386 % ObjectData.Coord=[]; 387 388 % if isempty(ListObject) 389 % ListObject={ObjectName}; 390 % else 391 % ListObject{end}=ObjectName; 392 % end 393 % UvData.ProjObject{IndexObj}=[]; %create a new empty object 394 % UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object 395 % UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 396 397 % PlotData=get(AxeData.CurrentObject,'UserData'); 398 % PlotData.IndexObj=IndexObj; 399 % set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion) 400 % AxeData.Drawing='create';% flag for mouse motion 401 %show object coordinates in the GUI set_object 402 h_set_object=findobj(allchild(0),'Tag','set_object'); 403 hh_set_object=guidata(h_set_object); 404 set(hh_set_object.Coord,'Data',ObjectData.Coord); 395 405 end 396 406 … … 475 485 Field.FF(ivec)=0; 476 486 end 477 PlotParam=read_GUI(h currentfig);487 PlotParam=read_GUI(hCurrentGUI); 478 488 plot_field(Field,haxes,PlotParam); 479 489 eval(['FigData.' tagaxes '=Field;'])%record the modified field in FigData 480 set(h currentfig,'UserData',FigData);490 set(hCurrentGUI,'UserData',FigData); 481 491 end 482 492 set(haxes,'UserData',AxeData); -
trunk/src/mouse_motion.m
r622 r625 30 30 FigData=get(hObject,'UserData'); 31 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 32 CurrentFig=get(get(FigData,'parent'),'parent');32 hCurrentFig=get(get(FigData,'parent'),'parent'); 33 33 else 34 CurrentFig=hObject;%usual plot35 end 36 hhCurrentFig=guidata( CurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)34 hCurrentFig=hObject;%usual plot 35 end 36 hhCurrentFig=guidata(hCurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field) 37 37 CheckZoom=get(hhCurrentFig.CheckZoom,'Value');% check for zoom on mode 38 38 CheckZoomFig=get(hhCurrentFig.CheckZoomFig,'Value');% check for zoom sub fig creation mode 39 hPlotAxes=hhCurrentFig.PlotAxes';% handles of the main plot axes 40 AxeData=get(hPlotAxes,'UserData');% data attached to the axis 41 test_draw=0;%test for mouse drawing of object, =0 by default 42 if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing) 43 test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active 44 end 39 45 test_zoom_draw=0; 40 test_draw=0;%test for mouse drawing of object, =0 by default41 46 test_object=0; %test for object editing or creation 42 47 test_edit_object=0;% edit test for mouse shap: an arrow … … 64 69 text_displ_4=''; 65 70 66 AxeData=[];%default71 % AxeData=[];%default 67 72 xy=[];%default 68 73 xy_fig=get(hObject,'CurrentPoint');% current point of the current figure (gcbo) … … 92 97 CurrentAxes=hchild; 93 98 xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 94 AxeData=get(CurrentAxes,'UserData');% data attached to the axis95 if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing)96 test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active97 end98 99 test_zoom_draw=test_draw && isequal(AxeData.Drawing,'zoom')&& isfield(AxeData,'CurrentOrigin') && isequal(get(gcf,'SelectionType'),'normal'); 99 100 test_object=test_draw && isfield(AxeData,'CurrentObject') && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject); 100 %if ~test_edit_object && ~test_zoom_draw && ~test_ruler101 101 if ~test_edit_object && ~test_ruler && ~CheckZoom 102 102 pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis) 103 103 end 104 FigData=get( CurrentFig,'UserData');104 FigData=get(hCurrentFig,'UserData'); 105 105 tagaxes=get(CurrentAxes,'tag'); 106 106 if isfield(FigData,tagaxes) … … 130 130 pointershape='arrow'; %mouse indicates the detection of a vector 131 131 if isempty(hhh) 132 set(0,'CurrentFigure', CurrentFig)133 set( CurrentFig,'CurrentAxes',CurrentAxes)132 set(0,'CurrentFigure',hCurrentFig) 133 set(hCurrentFig,'CurrentAxes',CurrentAxes) 134 134 rectangle('Curvature',[1 1],... 135 135 'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh],'EdgeColor','m',... … … 232 232 hhhh=findobj(CurrentAxes,'Tag','PIV_search_marker'); 233 233 if isempty(hhh) 234 set(0,'CurrentFigure', CurrentFig)235 set( CurrentFig,'CurrentAxes',CurrentAxes)234 set(0,'CurrentFigure',hCurrentFig) 235 set(hCurrentFig,'CurrentAxes',CurrentAxes) 236 236 rectangle('Curvature',[0 0],... 237 237 'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2],'EdgeColor','m',... … … 420 420 421 421 %% update the mouse pointer 422 set( CurrentFig,'Pointer',pointershape);422 set(hCurrentFig,'Pointer',pointershape); -
trunk/src/mouse_up.m
r623 r625 25 25 26 26 test_ruler=0;%default 27 hcurrentfig=hObject; 28 fig_tag=get(hcurrentfig,'tag'); 29 currentaxes=gca; %store the current axes handle 30 AxeData=get(currentaxes,'UserData'); 27 AxeData=get(gca,'UserData'); 28 if isfield(AxeData,'ParentAxes')% case of a zoom plot as current axis 29 hcurrentaxes=AxeData.ParentAxes; 30 AxeData=get(hcurrentaxes,'UserData'); 31 hcurrentfig=get(hcurrentaxes,'parent');%handles of the GUI parent of the zoom plot 32 testsubplot=1;% mouse selection is on a zoom subplot 33 else 34 hcurrentfig=hObject; 35 hcurrentaxes=gca; %store the current axes handle 36 testsubplot=0; 37 end 31 38 CurrentOrigin=[]; 32 39 if isfield(AxeData,'CurrentOrigin') 33 40 CurrentOrigin=AxeData.CurrentOrigin; 34 41 end 35 if 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; 41 else 42 hhcurrentfig=guidata(hcurrentfig);%the current figure is a GUI (uvmat or view_field) 43 testsubplot=0; 44 end 45 test_zoom=get(hhcurrentfig.CheckZoom,'Value'); 46 42 FigTag=get(hcurrentfig,'tag'); 43 hhcurrentfig=guidata(hcurrentfig);%the current figure is a GUI (uvmat or view_field) 44 CheckZoom=get(hhcurrentfig.CheckZoom,'Value'); 45 CheckZoomFig=get(hhcurrentfig.CheckZoomFig,'Value');%exclusive to CheckZoom 47 46 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle 48 47 if ~isempty(huvmat) 49 48 hhuvmat=guidata(huvmat); 50 49 UvData=get(huvmat,'UserData'); 51 test_ruler=~test_zoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler action, second priority 52 end 53 test_drawing=0;%default 54 55 %% finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field 50 test_ruler=~CheckZoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler action, second priority 51 end 52 test_drawing=0;%default, =1 to allow drawing by further mouse action 53 xy=get(gca,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 54 55 56 %% proceed with the creation or editing (translation/deformation) of an object 56 57 if ~isempty(huvmat) && isfield(AxeData,'Drawing') && ~isequal(AxeData.Drawing,'off') && isfield(AxeData,'CurrentObject')... 57 58 && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject) 58 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates59 % xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 59 60 PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object 60 61 IndexObj=PlotData.IndexObj; 61 62 ObjectData=UvData.ProjObject{IndexObj}; 62 63 check_multiple=0; 64 65 h_set_object=findobj(allchild(0),'Tag','set_object'); 66 hh_set_object=guidata(h_set_object); 67 ObjectData.Coord=get(hh_set_object.Coord,'Data'); 68 63 69 % ending translation 64 70 if isequal(AxeData.Drawing,'translate') … … 69 75 ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY; 70 76 71 %ending object deformation77 %ending object deformation 72 78 elseif isequal(AxeData.Drawing,'deform') 73 79 ind_move=AxeData.CurrentIndex; … … 75 81 ObjectData.Coord(ind_move,2)=xy(1,2); 76 82 77 %creating object83 %creating object 78 84 else 79 85 switch ObjectData.Type … … 85 91 end 86 92 case {'rectangle','ellipse','volume'} 87 % if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click88 % check_multiple=1;89 % else90 ObjectData.Coord=(CurrentOrigin+xy(1,1:2))/2;% keep only the first point coordinate 93 % if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click 94 % check_multiple=1; 95 % else 96 ObjectData.Coord=(CurrentOrigin+xy(1,1:2))/2;% keep only the first point coordinate 91 97 ObjectData.RangeX=abs(ObjectData.Coord(1,1)-xy(1,1));%rectangle width 92 ObjectData.RangeY=abs(ObjectData.Coord(1,2)-xy(1,2));%rectangle height 98 ObjectData.RangeY=abs(ObjectData.Coord(1,2)-xy(1,2));%rectangle height 93 99 if isequal(ObjectData.RangeX,0)||isequal(ObjectData.RangeY,0) 94 100 check_multiple=1;% pass to next mous up if width of height=0 95 101 end 96 % ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate97 % ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;98 % ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width99 % ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height100 % end102 % ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate 103 % ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2; 104 % ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width 105 % ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height 106 % end 101 107 case 'plane' %case of 'plane' 102 108 DX=(xy(1,1)-ObjectData.Coord(1,1)); … … 110 116 end 111 117 otherwise 112 check_multiple=1; 118 check_multiple=1; 113 119 end 114 120 end 115 121 116 122 %show object coordinates in the GUI set_object 117 h_set_object=findobj(allchild(0),'Tag','set_object');118 hh_set_object=guidata(h_set_object);119 set(hh_set_object.Coord,'Data',ObjectData.Coord);123 % h_set_object=findobj(allchild(0),'Tag','set_object'); 124 % hh_set_object=guidata(h_set_object); 125 % set(hh_set_object.Coord,'Data',ObjectData.Coord); 120 126 if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse') 121 127 set(hh_set_object.num_RangeX_2,'String',num2str(ObjectData.RangeX,4)); 122 128 set(hh_set_object.num_RangeY_2,'String',num2str(ObjectData.RangeY,4)); 123 129 end 124 125 % stop drawing and plotprojected field if the object manipulation is finished130 131 %% stop drawing and plot the projected field if the object manipulation is finished 126 132 if check_multiple==0 || isequal(get(hcurrentfig,'SelectionType'),'alt') 127 133 AxeData.CurrentOrigin=[]; %suppress the current origin 128 hobject=UvData.ProjObject{IndexObj}.DisplayHandle.( fig_tag);134 hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(FigTag); 129 135 if ~isempty(hObject) 130 ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')};131 AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject136 ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')}; 137 AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject 132 138 end 133 139 %% … … 136 142 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 137 143 if ~isempty(ProjData) 138 if strcmp( fig_tag,'uvmat')% uvmat plot selected, projection plot seen in view_field144 if strcmp(FigTag,'uvmat')% uvmat plot selected, projection plot seen in view_field 139 145 hview_field=findobj(allchild(0),'tag','view_field'); 140 146 if isempty(hview_field) … … 159 165 else 160 166 UvData.PlotAxes=ProjData; 161 [PlotType,PlotParam]=plot_field(ProjData,hhuvmat.PlotAxes,read_GUI(h huvmat));%update an existing field plot167 [PlotType,PlotParam]=plot_field(ProjData,hhuvmat.PlotAxes,read_GUI(huvmat));%update an existing field plot 162 168 errormsg=fill_GUI(PlotParam,huvmat); 163 169 end 164 170 end 165 171 set(hhuvmat.ViewField,'Value',1);% 166 set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 167 set(hhuvmat.edit_object,'Value',1);% 172 set(hhuvmat.edit_object,'Value',1);% 168 173 set(hhuvmat.edit_object,'Enable','on');% 169 174 set(hhuvmat.MenuEditObject,'Enable','on');% 170 175 set(hhuvmat.MenuEdit,'Enable','on');% 176 set(get(h_set_object,'children'),'Enable','on') 177 end 178 UvData.ProjObject{IndexObj}=ObjectData; 179 if isfield(UvData.ProjObject{IndexObj},'CreateMode') 180 UvData.ProjObject{IndexObj}=rmfield(UvData.ProjObject{IndexObj},'CreateMode');%remove createMode to mark the object as finished 171 181 end 172 182 else 173 %test_drawing=1;%allow continuation of drawing object174 %AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the next current origin175 end 176 UvData.ProjObject{IndexObj}=ObjectData;183 test_drawing=1;%allow continuation of drawing object 184 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the next current origin 185 end 186 % UvData.ProjObject{IndexObj}=ObjectData; 177 187 hother=findobj('Tag','deformpoint');%find all the deformpoints 178 188 set(hother,'Color','b');%reset all the deformpoints in 'blue' 179 189 end 180 190 181 %% creation of a new zoom plot 182 if isequal(get(hcurrentfig,'SelectionType'),'normal');%if left button has been pressed 191 %% creation or update of a zoom sub-plot 192 if CheckZoomFig && isequal(get(hcurrentfig,'SelectionType'),'normal')&&...%if left button has been pressed 193 ~isempty(CurrentOrigin) && ~isequal(CurrentOrigin(1),xy(1,1)) && ~isequal(CurrentOrigin(2),xy(1,2))%if mouse moved in x and y since presed down 183 194 hparentfig=hcurrentfig; 184 195 %open or update a new zoom figure if a rectangle has been drawn 185 if ishandle( currentaxes);196 if ishandle(hcurrentaxes); 186 197 if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom) 187 PosRect=get(AxeData.CurrentRectZoom,'Position');198 %PosRect=get(AxeData.CurrentRectZoom,'Position'); 188 199 if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec) 189 200 delete(AxeData.CurrentVec) 190 201 end 191 if ~testsubplot 192 hfig2=figure;%create new figure 193 set(hfig2,'name','zoom') 194 set(0,'Unit','pixels') 195 set(hfig2,'Unit','pixels') 196 FigPos=get(hfig2,'Position'); 197 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right 198 Left=ScreenSize(3)- FigPos(3)-40; %right edge close to the right, with margin=40 199 Bottom=ScreenSize(4)-FigPos(4)-40; %put fig at top right 200 FigPos(1:2)=[Left Bottom]; 201 set(hfig2,'Position',FigPos); 202 map=colormap(currentaxes); 203 colormap(map);%transmit the current colormap to the zoom fig 204 set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function 205 set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function 206 set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function 207 set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles}) 208 set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'}) 209 set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig 210 AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure 202 if ~testsubplot% if we are not already on a zoom plot 203 hfig2=findobj(allchild(0),'Tag','zoom_fig'); 204 if isempty(hfig2)% create zoom sub plot if absent 205 hfig2=figure('name',['zoom_' FigTag],'tag','zoom_fig');%create new figure (unit='pixels' by default) 206 set(0,'Unit','pixels') 207 FigPos=get(hfig2,'Position');%get the standard width and height of the fig 208 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right 209 Left=ScreenSize(3)- FigPos(3)-40; %right edge close to the right, with margin=40 210 Bottom=ScreenSize(4)-FigPos(4)-40; %put fig at top right 211 FigPos(1:2)=[Left Bottom]; 212 set(hfig2,'Position',FigPos);% put the zoom fig close to the upper right of the screen 213 map=colormap(hcurrentaxes); 214 colormap(map);%transmit the current colormap to the zoom fig 215 set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function 216 set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function 217 set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function 218 set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles}) 219 else 220 zoom_axes=findobj(hfig2,'Type','axes');%delete existing axes 221 axes(zoom_axes);%make the zoom axes apparent 222 delete(zoom_axes) 223 end 224 set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom}) 225 set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig 226 AxeData.ZoomAxes=copyobj(hcurrentaxes,hfig2); %copy the current graph axes to the zoom figure 211 227 hrect_zoom=findobj(AxeData.ZoomAxes,'Tag','rect_zoom');%find and delete the copy of the rect_zoom rectangle 212 228 delete(hrect_zoom) 213 ChildAxeData=get(AxeData.ZoomAxes,'UserData');214 if isfield(ChildAxeData,'ParentGUI')215 ChildAxeData=rmfield(ChildAxeData,'ParentGUI');%no parent GUI, e.g. uvmat, for the new plot216 end217 set(AxeData.ZoomAxes,'Position',[0.1300 0.1100 0.7750 0.8150])% standard axes position on a figure218 229 hcol=findobj(hparentfig,'Tag','Colorbar'); %look for colorbar axes 219 230 if ~isempty(hcol) … … 228 239 set(hcol_new,'Yticklabel',YTicklabel); 229 240 end 230 end 241 ChildAxeData=get(AxeData.ZoomAxes,'UserData'); 242 end 243 ChildAxeData.CurrentOrigin=[];% forget the current origin 231 244 ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window 232 245 ChildAxeData.Drawing='off'; 233 ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe 234 PosRect=CurrentOrigin; 235 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 236 set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)]) 237 set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)]) 246 ChildAxeData.ParentAxes=hcurrentaxes; 247 ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle drawing as a 'parent' associated to the new axe 248 %PosRect=CurrentOrigin; 249 % xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 250 if xy(1,1)>CurrentOrigin(1) 251 set(AxeData.ZoomAxes,'Xlim',[CurrentOrigin(1) xy(1,1)]) 252 else 253 set(AxeData.ZoomAxes,'Xlim',[xy(1,1) CurrentOrigin(1)]) 254 end 255 if xy(1,2)>CurrentOrigin(2) 256 set(AxeData.ZoomAxes,'Ylim',[CurrentOrigin(2) xy(1,2)]) 257 else 258 set(AxeData.ZoomAxes,'Ylim',[xy(1,2) CurrentOrigin(2)]) 259 end 238 260 set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes 239 261 end … … 242 264 243 265 %% zoom in or out by a factor 2 if no new figure is created 244 if test_zoom 245 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 246 xlim=get(currentaxes,'XLim'); 247 ylim=get(currentaxes,'YLim'); 266 if CheckZoom 267 if testsubplot 268 haxes=gca;% zoom on a zoom sub-plot 269 else 270 haxes=hcurrentaxes;% zoom on the main plot 271 end 272 % xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 273 xlim=get(haxes,'XLim'); 274 ylim=get(haxes,'YLim'); 248 275 % if left mouse button has been pressed, zoom in by a factor of 2 249 if isequal(get( hcurrentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2250 PlotBoxAspectRatio=get( currentaxes,'PlotBoxAspectRatio');276 if isequal(get(gcf,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2 277 PlotBoxAspectRatio=get(haxes,'PlotBoxAspectRatio'); 251 278 yoverx=PlotBoxAspectRatio(2)/PlotBoxAspectRatio(1); 252 279 if yoverx <2 253 280 xlim(1)=0.5*xy(1,1)+0.5*xlim(1); 254 281 xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points 255 set( currentaxes,'XLim',xlim)282 set(haxes,'XLim',xlim) 256 283 end 257 284 if yoverx >0.5 258 285 ylim(2)=0.5*xy(1,2)+0.5*ylim(2); 259 286 ylim(1)=0.5*xy(1,2)+0.5*ylim(1); 260 set( currentaxes,'YLim',ylim)287 set(haxes,'YLim',ylim) 261 288 end 262 289 … … 267 294 ylim(1)=2*ylim(1)-xy(1,2); 268 295 ylim(2)=2*ylim(2)-xy(1,2); 269 if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY') 296 % adjust the zoom out to the available field 297 if ~testsubplot && isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY') 270 298 xlim(1)=max(AxeData.RangeX(1),xlim(1)); 271 299 xlim(2)=min(AxeData.RangeX(2),xlim(2)); … … 279 307 if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY) 280 308 set(hhuvmat.CheckZoom,'Value',0) 281 set(hhuvmat.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])309 % set(hhuvmat.CheckZoom,'BackgroundColor',[0.7 0.7 0.7]) 282 310 set(hhuvmat.CheckFixLimits,'Value',0) 283 set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])284 end 285 end 286 set( currentaxes,'XLim',xlim)287 set( currentaxes,'YLim',ylim)311 % set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7]) 312 end 313 end 314 set(haxes,'XLim',xlim) 315 set(haxes,'YLim',ylim) 288 316 %test whther zoom out is operating (to inactivate AxedAta 289 317 if ~isfield(AxeData,'CurrentXLim')|| ~isequal(xlim,AxeData.CurrentXLim) … … 291 319 end 292 320 end 293 if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field) 321 %if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field) 322 if testsubplot 323 set(AxeData.CurrentRectZoom,'Position',[xlim(1) ylim(1) xlim(2)-xlim(1) ylim(2)-ylim(1)]) 324 else 294 325 set(hhcurrentfig.num_MinX,'String',num2str(xlim(1))) 295 326 set(hhcurrentfig.num_MaxX,'String',num2str(xlim(2))) … … 300 331 301 332 %% editing calibration point 302 if ~ test_zoom && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'calibration')333 if ~CheckZoom && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'calibration') 303 334 h_geometry_calib=findobj(allchild(0),'tag','geometry_calib'); %find the geomterty_calib GUI 304 335 if ~isempty(h_geometry_calib) 305 336 hh_geometry_calib=guidata(h_geometry_calib); 306 337 edit_test=get(hh_geometry_calib.edit_append,'Value'); 307 hh=findobj( currentaxes,'tag','calib_points');%look for handle of calibration points338 hh=findobj(hcurrentaxes,'tag','calib_points');%look for handle of calibration points 308 339 if ~isempty(hh) && edit_test 309 340 index_point=get(hh,'UserData'); … … 313 344 data=read_geometry_calib(Coord); 314 345 % val=get(h_ListCoord,'Value'); 315 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates346 % xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 316 347 data.Coord(index_point,4)=xy(1,1); 317 348 data.Coord(index_point,5)=xy(1,2); … … 331 362 332 363 %% finalising ruler 333 if test_ruler 364 if test_ruler && ~isempty(xy) 334 365 set(hhuvmat.MenuRuler,'checked','off')%desable the ruler option in uvmat 335 xy=get( currentaxes,'CurrentPoint');% get the current mouse coordinates366 xy=get(hcurrentaxes,'CurrentPoint');% get the current mouse coordinates 336 367 RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)];% append the recorded ruler origin to the current mouse coordinates 337 368 RulerCoord=diff(RulerCoord,1);% coordiante difference between segment end and beginning … … 346 377 347 378 %% display the data of the current object selected with the mouse right click 348 if isequal(get(hcurrentfig,'SelectionType'),'alt') && ~ test_zoom && (~isfield(AxeData,'Drawing')||~isequal(AxeData.Drawing,'create'))379 if isequal(get(hcurrentfig,'SelectionType'),'alt') && ~CheckZoom && (~isfield(AxeData,'Drawing')||~isequal(AxeData.Drawing,'create')) 349 380 hother=findobj('Tag','proj_object');%find all the proj objects 350 381 nbselect=0; … … 384 415 AxeData.Drawing='off';%stop current drawing action 385 416 end 386 set( currentaxes,'UserData',AxeData);417 set(hcurrentaxes,'UserData',AxeData); 387 418 if ~isempty(huvmat) 388 419 set(huvmat,'UserData',UvData); 389 420 end 390 421 391 392 422 %------------------------------------------------------------------------ 423 % --- 'close_fig': function activated when a zoom figure is closed 424 %------------------------------------------------------------------------ 425 function close_fig(ggg,eventdata,hparent) 426 427 hfig=get(get(hparent,'parent'),'parent'); 428 hbutton=findobj(hfig,'Tag','CheckZoomFig'); 429 if ~isempty(hbutton) 430 set(hbutton,'Value',0)% desactivate the zoom fig option 431 end 432 delete(hparent) % delete the rectangle showing the zoom graph in the parent fig 433 -
trunk/src/plot_field.m
r609 r625 12 12 % dimension variables (case of matrices). 13 13 % 14 % function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam, htext,PosColorbar)14 % function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,PosColorbar) 15 15 % 16 16 % OUPUT: -
trunk/src/plot_object.m
r622 r625 54 54 return 55 55 end 56 XMin=0;%default 56 XMin=0;%default range for the graph 57 57 XMax=0; 58 58 YMin=0; … … 60 60 ZMin=0; 61 61 ZMax=0; 62 XMinRange=[];%default range set by input 63 XMaxRange=[]; 64 YMinRange=[]; 65 YMaxRange=[]; 66 ZMinRange=[]; 67 ZMaxRange=[]; 62 68 63 69 %% determine the plotting axes (with handle 'haxes') … … 99 105 XMax=max(ObjectData.RangeX); 100 106 XMin=min(ObjectData.RangeX); 107 XMaxRange=max(ObjectData.RangeX); 108 if numel(ObjectData.RangeX)==2 109 XMinRange=min(ObjectData.RangeX); 110 end 101 111 end 102 112 if isfield(ObjectData,'RangeY')&&~isempty(ObjectData.RangeY) 103 113 YMax=max(ObjectData.RangeY); 104 114 YMin=min(ObjectData.RangeY); 115 YMaxRange=max(ObjectData.RangeY); 116 if numel(ObjectData.RangeY)==2 117 YMinRange=min(ObjectData.RangeY); 118 end 105 119 end 106 120 if isfield(ObjectData,'RangeZ')&&~isempty(ObjectData.RangeZ) 107 121 ZMax=max(ObjectData.RangeZ); 108 122 ZMin=min(ObjectData.RangeZ); 109 end 110 switch ObjectData.Type 111 case 'points' 112 if strcmp(ObjectData.ProjMode,'projection') 113 YMax=max(XMax,YMax); 114 YMax=max(YMax,ZMax); 115 end 116 case {'rectangle','ellipse','volume'} 117 % if isequal(YMax,0) 118 % ylim=get(haxes,'YLim'); 119 % YMax=(ylim(2)-ylim(1))/100; 120 % end 121 % if isequal(XMax,0) 122 % XMax=YMax;%default 123 % end 124 case 'plane' 125 if isequal(XMax,0) 126 xlim=get(haxes,'XLim'); 127 XMax=xlim(2); 128 end 129 if isequal(YMax,0) 130 ylim=get(haxes,'YLim'); 131 YMax=ylim(2); 132 end 123 ZMaxRange=max(ObjectData.RangeZ); 124 ZMinRange=min(ObjectData.RangeZ); 125 end 126 if strcmp(ObjectData.Type,'points') && strcmp(ObjectData.ProjMode,'projection') 127 YMax=max(XMax,YMax); 128 YMax=max(YMax,ZMax); 133 129 end 134 130 sizcoord=size(ObjectData.Coord); … … 147 143 yline=[yline; ObjectData.Coord(1,2)]; 148 144 elseif isequal(ObjectData.Type,'plane')|| isequal(ObjectData.Type,'volume') 145 if ~isfield(ObjectData,'Angle') 146 ObjectData.Angle=[0 0 0]; 147 end 149 148 phi=ObjectData.Angle(3)*pi/180;%angle in radians 150 Xend_x=xline(1)+XMax*cos(phi); 151 Xend_y=yline(1)+XMax*sin(phi); 152 Xbeg_x=xline(1)+XMin*cos(phi); 153 Xbeg_y=yline(1)+XMin*sin(phi); 154 Yend_x=xline(1)-YMax*sin(phi); 155 Yend_y=yline(1)+YMax*cos(phi); 156 Ybeg_x=xline(1)-YMin*sin(phi); 157 Ybeg_y=yline(1)+YMin*cos(phi); 158 xline=[Xbeg_x Xend_x NaN Ybeg_x Yend_x]; 159 yline=[Xbeg_y Xend_y NaN Ybeg_y Yend_y]; 149 x0=xline(1); y0=yline(1); 150 xlim=get(haxes,'XLim'); 151 ylim=get(haxes,'YLim'); 152 graph_scale=max(abs(xlim(2)-xlim(1)),abs(ylim(2)-ylim(1)))/2;% estimate the length of axes plots 153 XMax=graph_scale; 154 YMax=graph_scale; 155 XMin=-graph_scale; 156 YMin=-graph_scale; 157 if ~isempty(XMaxRange) 158 XMax=XMaxRange; 159 end 160 if ~isempty(XMinRange) 161 XMin=XMinRange; 162 end 163 if ~isempty(YMaxRange) 164 YMax=YMaxRange; 165 end 166 if ~isempty(YMinRange) 167 YMin=YMinRange; 168 end 169 % axes lines 170 xline=NaN(1,13); 171 xline(1)=x0+min(0,XMin)*cos(phi); % min end of the x axes 172 yline(1)=y0+min(0,XMin)*sin(phi); 173 xline(2)=x0+XMax*cos(phi);% max end of the x axes 174 yline(2)=y0+XMax*sin(phi); 175 xline(8)=x0-min(0,YMin)*sin(phi);% min end of the y axes 176 yline(8)=y0+min(0,YMin)*cos(phi); 177 xline(9)=x0-YMax*sin(phi);% max end of the y axes 178 yline(9)=y0+YMax*cos(phi); 179 180 %arrows on x axis 181 arrow_scale=graph_scale/20; 182 xline(3)=xline(2)-arrow_scale*cos(phi-pi/8); 183 yline(3)=yline(2)-arrow_scale*sin(phi-pi/8); 184 xline(5)=xline(2); 185 yline(5)=yline(2); 186 xline(6)=xline(2)-arrow_scale*cos(phi+pi/8); 187 yline(6)=yline(2)-arrow_scale*sin(phi+pi/8); 188 189 %arrows on y axis 190 xline(10)=xline(9)-arrow_scale*cos(phi+pi/2-pi/8); 191 yline(10)=yline(9)-arrow_scale*sin(phi+pi/2-pi/8); 192 xline(12)=xline(9); 193 yline(12)=yline(9); 194 xline(13)=xline(9)-arrow_scale*cos(phi+pi/2+pi/8); 195 yline(13)=yline(9)-arrow_scale*sin(phi+pi/2+pi/8); 196 %xline=[Xbeg_x Xend_x NaN Ybeg_x Yend_x]; 197 %yline=[Xbeg_y Xend_y NaN Ybeg_y Yend_y]; 198 % dashed lines indicating bounds 199 xsup=NaN(1,5); 200 ysup=NaN(1,5); 201 if ~isempty(XMaxRange) 202 xsup(1)=xline(2)-YMin*sin(phi); 203 ysup(1)=yline(2)+YMin*cos(phi); 204 xsup(2)=xline(2)-YMax*sin(phi); 205 ysup(2)=yline(2)+YMax*cos(phi); 206 end 207 if ~isempty(YMaxRange) 208 xsup(2)=xline(2)-YMax*sin(phi); 209 ysup(2)=yline(2)+YMax*cos(phi); 210 xsup(3)=xline(9)+XMin*cos(phi); 211 ysup(3)=yline(9)+XMin*sin(phi); 212 end 213 if ~isempty(XMinRange) 214 xsup(3)=xline(9)+XMin*cos(phi); 215 ysup(3)=yline(9)+XMin*sin(phi); 216 xsup(4)=x0+XMin*cos(phi)-YMin*sin(phi); 217 ysup(4)=y0+XMin*sin(phi)+YMin*cos(phi); 218 end 219 if ~isempty(YMinRange) 220 xsup(4)=x0+XMin*cos(phi)-YMin*sin(phi); 221 ysup(4)=y0+XMin*sin(phi)+YMin*cos(phi); 222 xsup(5)=xline(8)-YMin*sin(phi); 223 ysup(5)=yline(8)+YMin*cos(phi); 224 end 160 225 end 161 226 SubLineStyle='none';%default … … 258 323 if test_newobj==0; 259 324 hh=hplot; 260 PlotData=get(hplot,'UserData'); 325 PlotData=get(hplot,'UserData'); 261 326 if test_line 262 327 set(hplot,'XData',xline) 263 328 set(hplot,'YData',yline) 264 %modify subobjects 265 if isfield(PlotData,'SubObject') 266 if length(PlotData.SubObject)==2 && ~isequal(ObjectData.Type,'points')&& ~isequal(ObjectData.Type,'plane'); 329 %modify subobjects 330 if isfield(PlotData,'SubObject') 331 if isequal(ObjectData.Type,'points') 332 if ~isequal(YMax,0) 333 for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1)) 334 set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax]) 335 end 336 %complement missing points 337 if length(PlotData.SubObject)>nbpoints% fpoints in excess on the graph 338 for ii=nbpoints+1: length(PlotData.SubObject); 339 if ishandle(PlotData.SubObject(ii)) 340 delete(PlotData.SubObject(ii)) 341 end 342 end 343 end 344 % NbDeformPoint=nbpoints; 345 346 if nbpoints>length(PlotData.SubObject) 347 for ipt=length(PlotData.SubObject)+1:nbpoints 348 PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],... 349 'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,... 350 'LineStyle',SubLineStyle,'Tag','proj_object'); 351 end 352 end 353 end 354 elseif length(PlotData.SubObject)==2 267 355 set(PlotData.SubObject(1),'XData',xinf); 268 356 set(PlotData.SubObject(1),'YData',yinf); 269 357 set(PlotData.SubObject(2),'XData',xsup); 270 358 set(PlotData.SubObject(2),'YData',ysup); 271 elseif isequal(ObjectData.Type,'points')&& ~isequal(YMax,0) 272 for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1)) 273 set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax]) 274 end 275 %complement missing points 276 if length(PlotData.SubObject)>nbpoints% fpoints in excess on the graph 277 for ii=nbpoints+1: length(PlotData.SubObject); 278 if ishandle(PlotData.SubObject(ii)) 279 delete(PlotData.SubObject(ii)) 280 end 281 end 282 % NbDeformPoint=nbpoints; 283 end 284 if nbpoints>length(PlotData.SubObject) 285 for ipt=length(PlotData.SubObject)+1:nbpoints 286 PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],... 287 'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,... 288 'LineStyle',SubLineStyle,'Tag','proj_object'); 289 end 290 end 291 end 359 elseif length(PlotData.SubObject)==1 360 set(PlotData.SubObject(1),'XData',xsup); 361 set(PlotData.SubObject(1),'YData',ysup); 362 end 292 363 end 293 364 if isfield(PlotData,'DeformPoint') 294 365 NbDeformPoint=length(PlotData.DeformPoint); 295 if NbDeformPoint>nbpoints% fpoints in excess on the graph296 for ii=nbpoints+1:NbDeformPoint;297 if ishandle(PlotData.DeformPoint(ii))366 if NbDeformPoint>nbpoints% fpoints in excess on the graph 367 for ii=nbpoints+1:NbDeformPoint; 368 if ishandle(PlotData.DeformPoint(ii)) 298 369 delete(PlotData.DeformPoint(ii)) 299 end300 end301 NbDeformPoint=nbpoints;302 end303 for ipt=1:NbDeformPoint304 if ishandle(PlotData.DeformPoint(ipt))305 if nbpoints>=ipt370 end 371 end 372 NbDeformPoint=nbpoints; 373 end 374 for ipt=1:NbDeformPoint 375 if ishandle(PlotData.DeformPoint(ipt)) 376 if nbpoints>=ipt 306 377 set(PlotData.DeformPoint(ipt),'XData',xline(ipt),'YData',yline(ipt)); 307 378 end 308 end309 end310 if nbpoints>length(PlotData.DeformPoint)311 for ipt=length(PlotData.DeformPoint)+1:nbpoints379 end 380 end 381 if nbpoints>length(PlotData.DeformPoint) 382 for ipt=length(PlotData.DeformPoint)+1:nbpoints 312 383 PlotData.DeformPoint(ipt)=line(xline(ipt),yline(ipt),'Color',col,'LineStyle','.','Tag','DeformPoint',... 313 384 'SelectionHighlight','off','UserData',hplot); 314 end315 set(hplot,'UserData',PlotData)316 end385 end 386 set(hplot,'UserData',PlotData) 387 end 317 388 end 318 389 elseif (isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse'))&&XMax>0 && YMax>0 319 set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax]) 320 end 321 if test_patch 390 set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax]) 391 end 392 if test_patch 322 393 for iobj=1:length(PlotData.SubObject) 323 394 objtype=get(PlotData.SubObject(iobj),'Type'); … … 353 424 set(hother,'Color','b'); 354 425 set(hother,'Selected','off') 355 if isequal(ObjectData.Type,'points') 356 hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+'); 357 for ipt=1:length(xline) 358 PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',... 359 col,'LineStyle','.','SelectionHighlight','off','UserData',hh,'Tag','DeformPoint'); 360 %create circle around each point 361 if ~isequal(YMax,0) 362 PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],... 363 'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,... 364 'LineStyle',SubLineStyle,'Tag','proj_object'); 365 end 366 end 367 elseif strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||... 368 strcmp(ObjectData.Type,'polygon') ||strcmp(ObjectData.Type,'plane')||strcmp(ObjectData.Type,'volume')% (isequal(ObjectData.Type,'polygon') & ~test_patch) |isequal(ObjectData.Type,'plane') 369 hh=line(xline,yline,'Color',col); 370 if ~strcmp(ObjectData.Type,'plane') && ~strcmp(ObjectData.Type,'volume') 371 PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines 372 PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object'); 373 for ipt=1:sizcoord(1) 426 switch ObjectData.Type 427 case 'points' 428 hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+'); 429 for ipt=1:length(xline) 374 430 PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',... 375 col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh); 376 end 377 end 378 379 elseif strcmp(ObjectData.Type,'rectangle') 380 hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col); 381 elseif strcmp(ObjectData.Type,'ellipse') 382 hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col); 383 else 384 msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m') 385 return 431 col,'LineStyle','.','SelectionHighlight','off','UserData',hh,'Tag','DeformPoint'); 432 %create circle around each point 433 if ~isequal(YMax,0) 434 PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],... 435 'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,... 436 'LineStyle',SubLineStyle,'Tag','proj_object'); 437 end 438 end 439 case {'line','polyline','polygon'} 440 hh=line(xline,yline,'Color',col); 441 PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines 442 PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object'); 443 for ipt=1:sizcoord(1) 444 PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',... 445 col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh); 446 end 447 case {'plane','volume'} 448 hh=line(xline,yline,'Color',col); 449 PlotData.SubObject(1)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object'); 450 case 'rectangle' 451 hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'LineWidth',2,'EdgeColor',col); 452 case 'ellipse' 453 hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col); 454 otherwise 455 msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m') 456 return 386 457 end 387 458 set(hh,'Tag','proj_object') -
trunk/src/proj_field.m
r603 r625 2203 2203 2204 2204 %% store the properties of the projection object 2205 ListObject={' Type','ProjMode','RangeX','RangeY','RangeZ','Phi','Theta','Psi','Coord'};2205 ListObject={'Name','Type','ProjMode','angle','RangeX','RangeY','RangeZ','DX','DY','DZ','Coord'}; 2206 2206 for ilist=1:length(ListObject) 2207 2207 if isfield(ObjectData,ListObject{ilist}) 2208 2208 val=ObjectData.(ListObject{ilist}); 2209 2209 if ~isempty(val) 2210 ProjData.([' Object' ListObject{ilist}])=val;2211 ProjData.ListGlobalAttribute=[ProjData.ListGlobalAttribute {[' Object' ListObject{ilist}]}];2210 ProjData.(['ProjObject' ListObject{ilist}])=val; 2211 ProjData.ListGlobalAttribute=[ProjData.ListGlobalAttribute {['ProjObject' ListObject{ilist}]}]; 2212 2212 end 2213 2213 end -
trunk/src/set_object.m
r622 r625 153 153 end 154 154 end 155 if isfield(data,'Angle') && isequal(numel(data.Angle),3) 155 if ~isfield(data,'Angle') 156 data.Angle=[0 0 0]; 157 end 158 % if isfield(data,'Angle') && isequal(numel(data.Angle),3) 156 159 set(handles.num_Angle_1,'String',num2str(data.Angle(1))) 157 160 set(handles.num_Angle_2,'String',num2str(data.Angle(2))) 158 161 set(handles.num_Angle_3,'String',num2str(data.Angle(3))) 159 end 160 end 161 % if enable_plot 162 % set(handles.PLOT,'enable','on') 163 % else 164 % enable the PLOT (REFRESH) button by default 165 %defaul settings 166 set(get(handles.set_object,'children'),'enable','on') 167 set(handles.PLOT,'enable','off') 168 % end 169 % huvmat=findobj(allchild(0),'tag','uvmat'); 170 % UvData=get(huvmat,'UserData'); 171 % pos_uvmat=get(huvmat,'Position'); 172 % %position the set_object GUI with respect to uvmat 173 % if isfield(UvData,'SetObjectOrigin') 174 % pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); 175 % pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 176 % set(hObject,'Position',pos_set_object) 177 % end 162 % end 163 end 164 set(get(handles.set_object,'children'),'enable','off') 165 set(handles.SAVE,'enable','on') 166 % set(handles.PLOT,'enable','off') 167 178 168 179 169 %------------------------------------------------------------------------ … … 195 185 set(hhuvmat.ViewObject,'value',0)% 196 186 set(hhuvmat.edit_object,'Value',0)% desactivate the edit option 197 set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree187 % set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree 198 188 % deselect the object in ListObject when view_field is closed 199 189 if isempty(findobj(allchild(0),'Tag','view_field')) … … 450 440 hhuvmat=guidata(huvmat);%handles of the objects children of the GUI uvmat 451 441 ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat 452 IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat 442 443 if isequal(get(hhuvmat.edit_object,'Value'),0) %we append a new object 444 ListObject=[ListObject;{''}]; 445 IndexObj=length(ListObject); 446 set(hhuvmat.ListObject,'String',ListObject) 447 set(hhuvmat.ListObject,'Value',IndexObj) 448 UvData.ProjObject{IndexObj}=[]; %create a new empty object 449 UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object 450 UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 451 else 452 % if ~strcmp(ListObject{end},'') 453 % ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object 454 % set(handles.ListObject,'String',ListObject) 455 % end 456 % IndexObj=length(ListObject); 457 % set(handles.uvmat,'UserData',UvData) 458 IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat 459 end 460 453 461 %set or modify(edit mode) the nameof the currently selected object 454 462 detectname=1; … … 474 482 ListObject{IndexObj}=ObjectName; 475 483 set(hhuvmat.ListObject,'String',ListObject);%complement the object list 484 set(hhuvmat.ListObject_1,'String',ListObject);%complement the object list 476 485 set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object 477 486 check_handle=isfield(UvData.ProjObject{IndexObj},'DisplayHandle') && isfield(UvData.ProjObject{IndexObj}.DisplayHandle,'uvmat')... … … 572 581 set(hhuvmat.MenuEditObject,'enable','on') 573 582 set(hhuvmat.edit_object,'Value',1) % set uvmat to object edit mode to allow further object update 574 set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow583 %set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 575 584 set(hhuvmat.ViewField,'Value',1) 576 585 % set(handles.PLOT,'enable','on') -
trunk/src/uvmat.m
r623 r625 2551 2551 UvData.ProjObject{1}.Type='plane';%main plotting plane 2552 2552 UvData.ProjObject{1}.ProjMode='projection';%main plotting plane 2553 UvData.ProjObject{1}.Coord=[0 0 0]; 2553 2554 UvData.ProjObject{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat 2554 2555 UvData.ProjObject{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat … … 4168 4169 list_str=get(handles.ListObject,'String'); 4169 4170 IndexObj=get(handles.ListObject,'Value');%present object selection 4170 4171 %% The object is displayed in set_object if this GUI is already opened4172 4171 UvData=get(handles.uvmat,'UserData'); 4173 4172 ObjectData=UvData.ProjObject{IndexObj}; 4174 hset_object=findobj(allchild(0),'tag','set_object');4175 if ~isempty(hset_object)4176 4173 ZBounds=0; % default 4177 4174 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') … … 4179 4176 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 4180 4177 end 4181 ObjectData.Name=list_str{IndexObj}; 4178 4179 %% show object features if view_object isselected 4180 if get(handles.ViewObject,'value') 4182 4181 set_object(ObjectData,[],ZBounds); 4183 set(handles.ViewField,'Value',1)% show that the selected object in ListObject is currently visualised 4184 end 4185 4186 %% desactivate the edit object mode 4182 end 4183 4184 %% The object is displayed in set_object if this GUI is already opened 4185 % 4186 % hset_object=findobj(allchild(0),'tag','set_object'); 4187 % if ~isempty(hset_object) 4188 % 4189 % ObjectData.Name=list_str{IndexObj}; 4190 % set_object(ObjectData,[],ZBounds); 4191 % set(handles.ViewField,'Value',1)% show that the selected object in ListObject is currently visualised 4192 % end 4193 4194 %% desactivate the edit object mode for security 4187 4195 set(handles.edit_object,'Value',0) 4196 4188 4197 % set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4189 4198 … … 4274 4283 %------------------------------------------------------------------- 4275 4284 hset_object=findobj(allchild(0),'Tag','set_object'); 4276 if get(handles.edit_object,'Value') 4277 % set(handles.edit_object,'BackgroundColor',[1,1,0]) 4285 if get(handles.edit_object,'Value') 4278 4286 %suppress the other options 4279 4287 set(handles.CheckZoom,'Value',0) … … 4283 4291 hhgeometry_calib=guidata(hgeometry_calib); 4284 4292 set(hhgeometry_calib.edit_append,'Value',0)% desactivate mouse action in geometry_calib 4285 set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7])4286 4293 end 4287 4294 set(handles.ViewObject,'value',1) 4288 4295 ViewObject_Callback(hObject, eventdata, handles) 4289 else % desctivate object edit mode 4290 % set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4296 else % desactivate object edit mode 4291 4297 if ~isempty(hset_object)% open the 4292 hhset_object=guidata(hset_object);4293 set(hhset_object.PLOT,'enable','off');4294 set( get(hset_object,'children'),'enable','inactive')4298 set(get(hset_object,'children'),'Enable','off') 4299 hSAVE=findobj(hset_object,'Tag','SAVE'); 4300 set(hSAVE,'Enable','on') 4295 4301 end 4296 4302 end … … 4317 4323 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 4318 4324 end 4319 % set(handles.ListObject_1,'Value',IndexObj);%restore ListObject selection after set_object deletion4320 4325 data=UvData.ProjObject{IndexObj}; 4321 4326 if ~isfield(data,'Type')% default plane 4322 4327 data.Type='plane'; 4323 4328 end 4324 % if isfield(UvData,'Field')4325 % Field=UvData.Field;4326 % if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)4327 % data.RangeX=[UvData.Field.XMin UvData.Field.XMax];4328 % if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')4329 % data.RangeY=UvData.Field.Mesh;4330 % else4331 % data.RangeY=[UvData.Field.YMin UvData.Field.YMax];4332 % end4333 % data.DX=UvData.Field.Mesh;4334 % data.DY=UvData.Field.Mesh;4335 % end4336 % if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)4337 % data.Coord=[0 0 0]; %default4338 % end4339 % if isfield(Field,'CoordUnit')4340 % data.CoordUnit=Field.CoordUnit;4341 % end4342 % end4343 4329 hset_object=set_object(data,[],ZBounds); 4344 4330 hhset_object=guidata(hset_object); 4345 4331 if get(handles.edit_object,'Value')% edit mode 4346 set(hhset_object.PLOT,'Enable','on') 4347 set(get(hset_object,'children'),'enable','on') 4332 set(get(hset_object,'children'),'Enable','on') 4348 4333 else 4349 set(hhset_object.PLOT,'Enable','off') 4350 set(get(hset_object,'children'),'enable','inactive')% deactivate the GUI except SAVE 4334 set(get(hset_object,'children'),'Enable','off')% deactivate the GUI except SAVE 4351 4335 set(hhset_object.SAVE,'Enable','on') 4352 4336 end … … 4771 4755 end 4772 4756 set(handles.edit_object,'Value',0) %desactivate the object edit mode 4757 edit_object_Callback([],[],handles) 4758 set(handles.ViewObject,'Value',0) % desactivate view_object (new object created) 4773 4759 set(handles.CheckZoomFig,'Value',0) %desactivate zoom sub fig 4774 4760 set(handles.CheckZoom,'Value',0) %desactivate the zoom action … … 4777 4763 end 4778 4764 4779 %% append a new line to the list of projection objects 4780 ListObject=get(handles.ListObject,'String');4781 if isempty(ListObject)4782 ListObject={''};4783 end4784 if ~strcmp(ListObject{end},'')4785 ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object4786 set(handles.ListObject,'String',ListObject)4787 end4788 IndexObj=length(ListObject);4789 set(handles.ListObject,'Value',IndexObj)4765 %% append a new line to the list of projection objects A METTRE PLUS TARD 4766 % ListObject=get(handles.ListObject,'String'); 4767 % if isempty(ListObject) 4768 % ListObject={''}; 4769 % end 4770 % if ~strcmp(ListObject{end},'') 4771 % ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object 4772 % set(handles.ListObject,'String',ListObject) 4773 % end 4774 % IndexObj=length(ListObject); 4775 % set(handles.ListObject,'Value',IndexObj) 4790 4776 UvData=get(handles.uvmat,'UserData'); 4791 UvData.ProjObject{IndexObj}=[]; %create a new empty object4792 UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=handles.PlotAxes; % axes for plot_object4793 UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation4794 set(handles.uvmat,'UserData',UvData)4777 % UvData.ProjObject{IndexObj}=[]; %create a new empty object 4778 % UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=handles.PlotAxes; % axes for plot_object 4779 % UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 4780 % set(handles.uvmat,'UserData',UvData) 4795 4781 4796 4782 %% initiate the new projection object … … 4862 4848 set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object 4863 4849 set(handles.edit_object,'Value',0); %suppress the object edit mode 4850 edit_object_Callback([],[],handles) 4864 4851 % set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4865 4852 set(handles.delete_object,'Visible','on') -
trunk/src/view_field.m
r622 r625 90 90 set(handles.Scalar,'Visible','off') 91 91 end 92 92 93 errormsg=fill_GUI(PlotParamOut,hObject); 93 94 if ~isempty(errormsg) … … 394 395 function CheckFixLimits_Callback(hObject, eventdata, handles) 395 396 test=get(handles.CheckFixLimits,'Value'); 396 if test397 set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])398 else399 set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])400 end397 % if test 398 % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0]) 399 % else 400 % set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7]) 401 % end 401 402 update_plot(handles) 402 403 … … 406 407 %------------------------------------------------------------------- 407 408 if get(handles.CheckFixAspectRatio,'Value') 408 set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])409 409 update_plot(handles); 410 410 else 411 set(handles.CheckFixAspectRatio,'BackgroundColor',[0.7 0.7 0.7])412 411 update_plot(handles); 413 412 end … … 417 416 %------------------------------------------------------------------- 418 417 set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button 419 set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])% mark in yellow420 418 update_plot(handles); 421 419 … … 600 598 %------------------------------------------------------------------------ 601 599 set(handles.CheckFixLimits,'Value',1) %suppress auto mode 602 set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])600 % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0]) 603 601 update_plot(handles); 604 602 … … 607 605 %------------------------------------------------------------------------ 608 606 set(handles.CheckFixLimits,'Value',1) %suppress auto mode 609 set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])607 % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0]) 610 608 update_plot(handles); 611 609 … … 614 612 %------------------------------------------ 615 613 set(handles.CheckFixLimits,'Value',1) %suppress auto mode 616 set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])614 % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0]) 617 615 update_plot(handles); 618 616 … … 621 619 %------------------------------------------------------------------------ 622 620 set(handles.CheckFixLimits,'Value',1) %suppress auto mode 623 set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])621 % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0]) 624 622 update_plot(handles); 625 623 … … 635 633 %-------------------------------------------- 636 634 set(handles.CheckFixScalar,'Value',1) %suppress auto mode 637 set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])635 % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0]) 638 636 update_plot(handles) 639 637 … … 642 640 %-------------------------------------------- 643 641 test=get(handles.CheckFixScalar,'Value'); 644 if test645 set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])646 else647 set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])648 update_plot(handles);649 % set(handles.MinA,'String',num2str(ScalOut.MinA,3))650 % set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))651 end642 % if test 643 % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0]) 644 % else 645 % set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7]) 646 % update_plot(handles); 647 % % set(handles.MinA,'String',num2str(ScalOut.MinA,3)) 648 % % set(handles.MaxA,'String',num2str(ScalOut.MaxA,3)) 649 % end 652 650 653 651 %------------------------------------------------------------------- … … 699 697 update_plot(handles); 700 698 %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3)) 701 set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7])699 % set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7]) 702 700 end 703 701
Note: See TracChangeset
for help on using the changeset viewer.