Changeset 681
- Timestamp:
- Sep 2, 2013, 2:42:52 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/keyboard_callback.m
r625 r681 4 4 cur_axes=get(hObject,'CurrentAxes');%current plotting axes of the figure with handle hObject 5 5 xx=double(get(hObject,'CurrentCharacter')); %get the keyboard character 6 if ~isempty(xx) 6 7 switch xx 7 8 case {29,28,30,31} %arrows for displacement … … 44 45 end 45 46 end 46 case {8, 127} %if the delete or suppr key is pressed, delete the current object47 currentobject=gco;48 huvmat=findobj(allchild(0),'tag','uvmat');49 hlist_object=findobj(huvmat,'Tag','list_object_1');50 ObjIndex=get(hlist_object,'Value');51 if ObjIndex>152 delete_object(ObjIndex)53 end54 if ishandle(currentobject)55 tag=get(currentobject,'Tag');%tag of the current selected object56 if isequal(tag,'proj_object')57 delete_object(currentobject)58 end59 end47 % case {8, 127} %if the delete or suppr key is pressed, delete the current object 48 % currentobject=gco; 49 % huvmat=findobj(allchild(0),'tag','uvmat'); 50 % hlist_object=findobj(huvmat,'Tag','list_object_1'); 51 % ObjIndex=get(hlist_object,'Value'); 52 % if ObjIndex>1 53 % delete_object(ObjIndex) 54 % end 55 % if ishandle(currentobject) 56 % tag=get(currentobject,'Tag');%tag of the current selected object 57 % if isequal(tag,'proj_object') 58 % delete_object(currentobject) 59 % end 60 % end 60 61 case 112% key 'p' 61 62 uvmat('runplus_Callback',hObject,eventdata,handleshaxes) 62 63 case 109% key 'm' 63 64 uvmat('runmin_Callback',hObject,eventdata,handleshaxes) 65 otherwise 66 set(handleshaxes.run0,'BackgroundColor',[1 0 1])%indicat that Run must be activated (todo: rplace by REFRESH) 64 67 end 65 68 end -
trunk/src/mouse_down.m
r680 r681 59 59 UvData=get(huvmat,'UserData'); 60 60 test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler action, second priority; 61 test_edit=get(hhuvmat.CheckEditObject,'Value') && (isequal(obj_tag,'proj_object')||isequal(obj_tag,'DeformPoint'));%test for object editing, third priority61 test_edit=get(hhuvmat.CheckEditObject,'Value');%&& (isequal(obj_tag,'proj_object')||isequal(obj_tag,'DeformPoint'));%test for object editing, third priority 62 62 hset_object=findobj(allchild(0),'Name','set_object'); 63 63 if ~isempty(hset_object) … … 97 97 ind_object=find(check_pos(:,1) & check_pos(:,2),1);% select the index of the (first) object under the mouse 98 98 hchild=hchildren(ind_object);% corresponding object handle 99 htype=''; 99 100 if ~isempty(hchild) 100 101 htype=get(hchild,'Type');%type of object child of the current figure … … 105 106 xy=get(hchild,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 106 107 AxeData=get(hchild,'UserData');% data attached to the axis 107 % if isfield(AxeData,'ObjectCoord') && size(AxeData.ProjObjectCoord,2)==3 108 % xy(1,3)=AxeData.ProjObjectCoord(1,3); % z coordinate of the mouse: to generalise ... 109 % else 110 % xy(1,3)=0; % z coordinate set to 0 by default 111 % end 108 AxeData.Enable='on';% unable current axes for mouse up action 112 109 AxeData.CurrentOrigin=xy(1,1:2);% The current point set by the mouse becomes the current origin 113 110 … … 135 132 end 136 133 end 137 %break% leave the loop once an axes has been selected 138 134 set(hchild,'UserData',AxeData) 139 135 %if the mouse is over a uicontrol, with right mouse button activated, duplicate the display in an editable zoom window 140 136 case 'uicontrol' … … 153 149 hhchildren=get(hchild,'Children');%handles of all objects in the selected panel 154 150 check_visible=strcmp(get(hhchildren,'Visible'),'on');%=1 if visible='on', =0 otherwise 155 hhchildren=hhchildren(check_visible); %keep only the visible children 156 151 hhchildren=hhchildren(check_visible); %keep only the visible children 157 152 PosChildren=get(hhchildren,'Position'); 158 153 PosLength=cellfun('length',PosChildren); … … 171 166 end 172 167 end 173 end 174 % return %leave the function once a uicontrol has been selected 175 end 176 end 177 168 end 169 end 170 end 171 if ~strcmp(htype,'axes') 172 currentaxes=get(hObject,'CurrentAxes'); 173 if ~isempty(currentaxes) 174 AxeData=get(currentaxes,'UserData');% data attached to the axis 175 AxeData.Enable='off';% desactivate current axes for mouse up action 176 set(currentaxes,'UserData',AxeData); 177 end 178 end 179 178 180 %% zoom has first priority, stop here 179 181 if CheckZoom … … 236 238 %% selection of an existing projection object (third priority) 237 239 if test_edit 240 testdeform=0; 238 241 if ~(isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'create')) 239 242 userdata=get(hcurrentobject,'UserData'); … … 293 296 set_object(UvData.ProjObject{IndexObj}) 294 297 axes(hchild);%set back the current axes haxes 295 testdeform=0;296 298 set(gcbo,'Pointer','circle'); 297 299 AxeData.Drawing='deform'; … … 307 309 end 308 310 end 309 if testdeform==0 311 % if testdeform==0 312 % AxeData.Drawing='translate'; 313 % set(AxeData.CurrentObject,'Selected','on') 314 % set(gcbo,'Pointer','fleur'); 315 % end 316 else 317 if strcmp(get(hCurrentGUI,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field 318 IndexObj=get(hhuvmat.ListObject,'Value'); 319 AxeData.CurrentObject=UvData.ProjObject{IndexObj}.DisplayHandle.uvmat; 320 else 321 IndexObj=get(hhuvmat.ListObject_1,'Value'); 322 AxeData.CurrentObject=UvData.ProjObject{IndexObj}.DisplayHandle.view_field; 323 end 324 ObjectData=get(AxeData.CurrentObject,'UserData'); 325 ObjectData.IndexObj=IndexObj; 326 set(AxeData.CurrentObject,'UserData',ObjectData) 327 end 328 if testdeform==0 310 329 AxeData.Drawing='translate'; 311 330 set(AxeData.CurrentObject,'Selected','on') 312 331 set(gcbo,'Pointer','fleur'); 313 end314 332 end 315 333 end -
trunk/src/mouse_motion.m
r664 r681 49 49 test_zoom_draw=0; 50 50 test_object=0; %test for object editing or creation 51 test_edit_object=0;% edit test for mouse shap : an arrow51 test_edit_object=0;% edit test for mouse shape: an arrow 52 52 test_ruler=0;%test for active ruler 53 53 test_transform=0; … … 357 357 plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m'); 358 358 pointershape='crosshair'; 359 elseif isequal(AxeData.Drawing,'translate')359 elseif test_edit_object && isequal(AxeData.Drawing,'translate') 360 360 DX=xy(1,1)-XYData(1);%translation from initial position 361 361 DY=xy(1,2)-XYData(2); … … 364 364 plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m'); 365 365 pointershape='fleur'; 366 elseif isequal(AxeData.Drawing,'deform')366 elseif test_edit_object && isequal(AxeData.Drawing,'deform') 367 367 ind_move=AxeData.CurrentIndex; 368 368 ObjectData.Coord(ind_move,1)=xy(1,1); -
trunk/src/mouse_up.m
r660 r681 51 51 end 52 52 test_drawing=0;%default, =1 to allow drawing by further mouse action 53 if ~(isfield(AxeData,'Enable')&& strcmp(AxeData.Enable,'on')) 54 return 55 end 53 56 xy=get(gca,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 54 57 … … 74 77 ObjectData.Coord(:,1)=ObjectData.Coord(:,1)+DX; 75 78 ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY; 76 79 set(hh_set_object.Coord,'Data',ObjectData.Coord); 77 80 %ending object deformation 78 81 elseif isequal(AxeData.Drawing,'deform') … … 80 83 ObjectData.Coord(ind_move,1)=xy(1,1); 81 84 ObjectData.Coord(ind_move,2)=xy(1,2); 82 85 set(hh_set_object.Coord,'Data',ObjectData.Coord); 83 86 %creating object 84 87 else … … 160 163 drawnow 161 164 set(hview_field,'UserData',ViewFieldData);% restore the previously stored GUI position after GUI resizing 162 else 165 elseif isfield(ViewFieldData,'GUISize') 163 166 set(hview_field,'Position',ViewFieldData.GUISize) 164 167 end -
trunk/src/plot_object.m
r680 r681 394 394 end 395 395 if test_patch 396 if isfield(PlotData,'SubObject') 396 397 for iobj=1:length(PlotData.SubObject) 397 398 if ~ishandle(PlotData.SubObject(iobj)) … … 408 409 end 409 410 end 410 end 411 end 412 end 411 413 else% no patch image requested, erase existing ones 412 414 if isfield(PlotData,'SubObject') -
trunk/src/read_field.m
r675 r681 71 71 Role={}; 72 72 ProjModeRequest={}; 73 checkU=0; 74 checkV=0; 73 75 for ilist=1:numel(InputField) 74 76 r=regexp(InputField{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names'); 77 Operator=''; 75 78 if isempty(r)% no operator used 76 ListVar=[ListVar InputField(ilist)]; 79 if isempty(find(strcmp(InputField{ilist},ListVar))) 80 ListVar=[ListVar InputField(ilist)];%append the variable name if not already in the list 81 end 77 82 if check_colorvar(ilist) 78 83 Role{numel(ListVar)}='ancillary';% not projected with interpolation … … 83 88 end 84 89 else % an operator 'vec' or 'norm' is used 90 Operator=r.Operator; 85 91 if ~check_colorvar(ilist) && strcmp(r.Operator,'norm') 86 92 ProjModeRequestVar='interp_lin';%scalar field (requires interpolation for plot) … … 94 100 Role=[Role {'vector_x'}]; 95 101 ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}]; 102 else 103 checkU=1; 96 104 end 97 105 if isempty(ind_var_V) … … 99 107 Role=[Role {'vector_y'}]; 100 108 ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}]; 109 else 110 checkV=1; 101 111 end 102 112 end … … 125 135 Field.VarAttribute{ivar+2}.ProjModeRequest=ProjModeRequest{ivar}; 126 136 end 127 137 if strcmp(Operator,'norm') 138 NormName='norm'; 139 if ~isempty(strcmp(ListVar,'norm')) 140 NormName='norm_1'; 141 end 142 Field.ListVarName=[Field.ListVarName {NormName}]; 143 ilist=numel(Field.ListVarName); 144 Field.VarDimName{ilist}=Field.VarDimName{ind_var_U}; 145 Field.VarDimName{ilist}.Role='scalar'; 146 Field.(NormName)=Field.(r.UName).*Field.(r.UName)+Field.(r.VName).*Field.(r.VName); 147 Field.(NormName)=sqrt(Field.(NormName)); 148 if ~checkU && ~checkV 149 Field.ListVarName([ind_var_U ind_var_V])=[]; 150 Field.VarDimName([ind_var_U ind_var_V])=[]; 151 Field.VarAttribute([ind_var_U ind_var_V])=[]; 152 elseif ~checkU 153 Field.ListVarName(ind_var_U)=[]; 154 Field.VarDimName(ind_var_U)=[]; 155 Field.VarAttribute(ind_var_U )=[]; 156 elseif ~checkV 157 Field.ListVarName(ind_var_V)=[]; 158 Field.VarDimName(ind_var_V)=[]; 159 Field.VarAttribute(ind_var_V )=[]; 160 end 161 end 128 162 case 'video' 129 163 if strcmp(class(ParamIn),'VideoReader') -
trunk/src/set_object.m
r680 r681 36 36 function varargout = set_object(varargin) 37 37 38 % Last Modified by GUIDE v2.5 28-Aug-2013 20:41:0238 % Last Modified by GUIDE v2.5 02-Sep-2013 11:39:56 39 39 40 40 % Begin initialization code - DO NOT REFRESH … … 93 93 ZBounds=0; %default 94 94 end 95 set(handles.Coord,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function (allow action on uvmat when set_object is in front)96 95 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 97 96 set(hObject,'DeleteFcn',{@closefcn}) … … 116 115 end 117 116 Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type 118 117 set(handles.REFRESH,'BackgroundColor',[1 0 0]) 119 118 if isfield(data,'RangeZ') && length(ZBounds) >= 2 120 119 set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3)) … … 219 218 function Type_Callback(hObject, eventdata, handles) 220 219 %------------------------------------------------------------------------ 221 %style_prev=get(handles.Type,'UserData');%previous object style 220 222 221 ListType=get(handles.Type,'String'); 223 222 Type=ListType{get(handles.Type,'Value')}; … … 271 270 % --- Executes on selection change in ProjMode. 272 271 %------------------------------------------------------------------------ 273 274 272 function ProjMode_Callback(hObject, eventdata, handles) 273 274 set(handles.REFRESH,'BackgroundColor',[1 0 1]) 275 275 menu=get(handles.ProjMode,'String'); 276 276 value=get(handles.ProjMode,'Value'); … … 419 419 function REFRESH_Callback(hObject, eventdata, handles) 420 420 421 set(handles.REFRESH,'BackgroundColor',[1 1 0]) 421 set(handles.REFRESH,'BackgroundColor',[1 1 0])% indicate activation of REFRESH 422 422 drawnow 423 423 … … 588 588 set(hhuvmat.CheckEditObject,'Value',1) % set uvmat to object edit mode to allow further object update 589 589 set(hhuvmat.CheckViewField,'Value',1) 590 590 591 set(handles.REFRESH,'BackgroundColor',[1 0 0]) 592 %set(handles.Coord,'BackgroundColor',[1 1 1]) 593 set(handles.num_RangeY_2,'BackgroundColor',[1 1 1]) 594 591 595 %------------------------------------------------------------------------ 592 596 % --- Executes on button press in MenuCoord. … … 617 621 618 622 function num_RangeX_2_Callback(hObject, eventdata, handles) 623 619 624 %------------------------------------------------------------------------ 620 625 %------------------------------------------------------------------------ … … 720 725 function Coord_CellEditCallback(hObject, eventdata, handles) 721 726 %------------------------------------------------------------------------ 727 %set(handles.Coord,'BackgroundColor',[1 1 0]) 722 728 % ListType=get(handles.Type,'String'); 723 729 % Type=ListType{get(handles.Type,'Value')}; … … 744 750 end 745 751 746 %------------------------------------------------------------------------ 747 % --- 'key_press_fcn:' function activated when a key is pressed on the keyboard 748 %------------------------------------------------------------------------ 749 function key_press_fcn(hObject,eventdata,handles) 750 752 753 function num_Angle_3_Callback(hObject, eventdata, handles) 754 755 %------------------------------------------------------------------------ 756 % --- Executes on key press with selection of a uicontrol 757 %------------------------------------------------------------------------ 758 function KeyPressFcn(hObject, eventdata, handles) 759 set(handles.REFRESH,'BackgroundColor',[1 0 1])% se REFRESH to magenta color, indicates that refresh needs to be done 760 761 %------------------------------------------------------------------------ 762 % --- Executes on key press with focus on Coord and none of its controls. 763 %------------------------------------------------------------------------ 764 function Coord_KeyPressFcn(hObject, eventdata, handles) 765 766 set(handles.REFRESH,'BackgroundColor',[1 0 1]) 751 767 xx=double(get(handles.set_object,'CurrentCharacter')); %get the keyboard character 752 768 if ismember(xx,[127 31])% delete, or downward … … 763 779 end 764 780 765 function num_Angle_3_Callback(hObject, eventdata, handles) 766 % hObject handle to num_Angle_3 (see GCBO) 767 % eventdata reserved - to be defined in a future version of MATLAB 768 % handles structure with handles and user data (see GUIDATA) 769 770 % Hints: get(hObject,'String') returns contents of num_Angle_3 as text 771 % str2double(get(hObject,'String')) returns contents of num_Angle_3 as a double 781 782 -
trunk/src/uvmat.m
r680 r681 204 204 205 205 %% set functions for the mouse and keyboard 206 set(hObject,' KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function206 set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function 207 207 set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles})%set mouse action functio 208 208 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function … … 1769 1769 errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2); 1770 1770 end 1771 1772 %% refresh plots 1773 % errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2,i1_1,i2_1,j1_1,j2_1); 1771 set(handles.run0,'BackgroundColor',[1 0 0]) 1774 1772 1775 1773 %% update the index counters if the index move is successfull … … 1822 1820 else 1823 1821 set(handles.movie_pair,'BusyAction','queue') 1822 set(handles.run0,'BackgroundColor',[1 0 0]) 1824 1823 end 1825 1824 … … 1987 1986 set(handles.j2,'BackgroundColor',[1 1 1]) 1988 1987 set(handles.FileIndex,'BackgroundColor',[1 1 1]) 1989 set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 1988 set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 1989 set(handles.run0,'BackgroundColor',[1 0 0]) 1990 1990 end 1991 set(handles.run0,'BackgroundColor',[1 0 0])1992 1993 1991 1994 1992 %------------------------------------------------------------------------ … … 2702 2700 end 2703 2701 ResizeFcn(handles.uvmat,[],handles) 2702 %set(handles.uvmat,'CurrentAxes',handles.PlotAxes)% make the main axis current (usefull for key board callback) 2704 2703 2705 2704 %------------------------------------------------------------------------ … … 4021 4020 [tild,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam); 4022 4021 errormsg=fill_GUI(PlotParamOut,handles.uvmat); 4023 %write_plot_param(handles,PlotParamOut); %update the auto plot parameters 4022 RUNColor=get(handles.run0,'BackgroundColor');% 4023 if isequal(RUNColor,[1 0 1])% suppress magenta color (indicate that plot is updated) 4024 set(handles.run0,'BackgroundColor',[1 0 0]); 4025 end 4024 4026 4025 4027 %------------------------------------------------------------------------ … … 4334 4336 if ~isempty(UvData) && isfield(UvData, 'ProjObject') && length(UvData.ProjObject)>=IndexObj 4335 4337 if isfield(UvData.ProjObject{IndexObj},'DisplayHandle') && isfield(UvData.ProjObject{IndexObj}.DisplayHandle,'uvmat') 4336 hdisplay=UvData.ProjObject{IndexObj}.DisplayHandle.uvmat; 4338 hdisplay=UvData.ProjObject{IndexObj}.DisplayHandle.uvmat;%handle of the object graphic representation in uvmat 4337 4339 for iview=1:length(hdisplay) 4338 4340 if ishandle(hdisplay(iview)) && ~isequal(hdisplay(iview),0) 4339 4341 ObjectData=get(hdisplay(iview),'UserData'); 4340 4342 if isfield(ObjectData,'SubObject') & ishandle(ObjectData.SubObject) 4341 delete(ObjectData.SubObject); 4343 delete(ObjectData.SubObject);% delete the graphic 'sub-objects (e.g. projection bounds) 4342 4344 end 4343 if isfield(ObjectData,'DeformPoint') & ishandle(ObjectData.DeformPoint) 4344 delete(ObjectData.DeformPoint); 4345 end 4346 delete(hdisplay(iview)) 4345 check_suppress= isfield(ObjectData,'DeformPoint') & ishandle(ObjectData.DeformPoint) 4346 delete(ObjectData.DeformPoint(check_suppress));% delete the graphic deformation points 4347 delete(hdisplay(iview))% delete the main graphic representation of the object 4347 4348 end 4348 4349 ishandle(hdisplay(iview)) -
trunk/src/view_field.m
r650 r681 65 65 66 66 %functions for the mouse and keyboard 67 set(hObject,' KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function67 set(hObject,'WindowKeyPressFcn',{'keyboard_callback',handles})%set keyboard action function 68 68 set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles})%set mouse action functio 69 69 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
Note: See TracChangeset
for help on using the changeset viewer.