Changeset 67 for trunk/src/mouse_motion.m
- Timestamp:
- Mar 25, 2010, 6:48:48 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_motion.m
r65 r67 27 27 return 28 28 end 29 % if ~isfield(handles, 'mouse_coord')30 % 'TEST'31 % return32 % end33 % if ~ishandle(handles.mouse_coord)34 % return35 % end36 % proj_coord=get(handles.mouse_coord,'String');37 % choice=get(handles.mouse_coord,'Value');38 % if ~isempty(proj_coord); proj_coord=proj_coord{choice};else;proj_coord=[];end;39 29 test_create=0;%default 40 30 test_edit=0;%default 41 % if isfield(handles,'VOLUME') % mouse_motion not applied to the uvmat figure, no object creation42 % test_create=get(handles.create,'Value');43 % end44 31 test_edit=isfield(handles,'edit') & get(handles.edit,'Value');% edit test for mouse shap: an arrow 45 32 test_zoom=isfield(handles,'zoom')& get(handles.zoom,'Value');% edit test for mouse shap: an arrow … … 54 41 AxeData=[];%default 55 42 mouse=[]; 43 xy=[];%default 56 44 57 45 pointershape='arrow';% default pointer is an arrow 58 59 xy_fig=get(gcbo,'CurrentPoint');% current point of the current figure (gcbo)60 hchild=get(gcbo,'Children');%handles of all objects in the current figure61 46 currentfig=gcbo;%store gcbo as variable currentfig 47 xy_fig=get(currentfig,'CurrentPoint');% current point of the current figure (gcbo) 48 hchild=get(currentfig,'Children');%handles of all objects in the current figure 49 62 50 % loop on all the objects in the current figure (selected by the last mouse click) 63 51 for ichild=1:length(hchild) … … 88 76 flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/3) & AxeData.X>(xy(1,1)-AxeData.Mesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse 89 77 (AxeData.Y<(xy(1,2)+AxeData.Mesh/3) & AxeData.Y>(xy(1,2)-AxeData.Mesh/3));%f 90 ivec=find(flag_vec );% search theselected vector index ivec78 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 91 79 hhh=findobj(haxes,'Tag','vector_marker'); 92 if length(ivec)>080 if ~isempty(ivec) 93 81 %ivec=ivec(1);%choice the first selected vector if several are selected 94 82 if ~test_create 95 83 pointershape='arrow'; %mouse indicates the detection of a vector 96 97 84 if isempty(hhh) 98 85 set(currentfig,'CurrentAxes',haxes) … … 262 249 end 263 250 end 251 264 252 %%%%%%%%%%%%% 265 %draw a rectangle if no object creation is selected253 %draw a zoom rectangle if no object creation is selected 266 254 if ~isempty(haxes) & isfield(AxeData,'Drawing')& isequal(AxeData.Drawing,'zoom')& isfield(AxeData,'CurrentOrigin')... 267 255 & isequal(get(gcf,'SelectionType'),'normal')% … … 281 269 end 282 270 end 283 end284 if test_zoom271 % end 272 % if test_zoom 285 273 pointershape='arrow'; 274 end 275 276 % detect calibration points if the GUI geometry_calib is opened 277 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 278 if ~test_zoom && ~isempty(h_geometry_calib) 279 pointershape='crosshair';%default for geometry_calib: ready to create new points 280 hh_geometry_calib=guidata(h_geometry_calib); 281 if get(hh_geometry_calib.edit_append,'Value') && ~isempty(xy) 282 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 283 Coord=get(h_ListCoord,'String'); 284 data=read_geometry_calib(Coord);%transform char cell to numbers 285 if size(data.Coord,2)>=5 286 XCoord=(data.Coord(:,4)); 287 YCoord=(data.Coord(:,5)); 288 xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 289 if ~isempty(xy) 290 ind_range=10; 291 index_point=find((XCoord<xy(1,1)+ind_range) & (XCoord>xy(1,1)-ind_range) & ...%flagx=1 for the vectors with x position selected by the mouse 292 (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse 293 if ~isempty(index_point) 294 pointershape='arrow';% default pointer is an arrow 295 set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib 296 hh=findobj('Tag','calib_points');%look for handle of calibration points 297 if ~isempty(hh) && strcmp(get(hh,'UserData'),'edit_mode') 298 XCoord(index_point)=xy(1,1); 299 YCoord(index_point)=xy(1,2); 300 set(hh,'XData',XCoord) 301 set(hh,'YData',YCoord) 302 end 303 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 304 if ~isempty(hhh) 305 set(hhh,'XData',XCoord(index_point)) 306 set(hhh,'YData',YCoord(index_point)) 307 end 308 end 309 end 310 end 311 end 286 312 end 287 313 … … 291 317 if isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler') 292 318 if isfield(UvData,'RulerHandle') 319 pointershape='crosshair'; 293 320 RulerCoord=[UvData.RulerCoord ;xy(1,1:2)]; 294 321 set(UvData.RulerHandle,'XData',RulerCoord(:,1));
Note: See TracChangeset
for help on using the changeset viewer.