Changeset 78 for trunk/src/mouse_down.m
- Timestamp:
- Apr 2, 2010, 9:01:21 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_down.m
r71 r78 63 63 %if the mouse is over an axis, look at the data 64 64 if isequal(htype,'axes') 65 y_lim=get(hchild(ichild),'YLim'); 66 x_lim=get(hchild(ichild),'XLim'); 65 67 haxes=hchild(ichild); 66 68 xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 67 AxeData=get(haxes,'UserData');% data attached to the axis 68 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin 69 if ~isequal(tag_obj,'proj_object') & ~test_create 70 x_mouse=xy(1,1);%default 71 y_mouse=xy(1,2);%default 72 u_mouse=[]; 73 v_mouse=[]; 74 w_mouse=[]; 75 A_mouse=[]; 76 c_text=[]; 77 f_text=[]; 78 ff_text=[]; 79 ivec=[]; 80 if isfield(AxeData,'X') & isfield(AxeData,'Y') & isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis 81 flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/4) & AxeData.X>(xy(1,1)-AxeData.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 82 (AxeData.Y<(xy(1,2)+AxeData.Mesh/4) & AxeData.Y>(xy(1,2)-AxeData.Mesh/4));%f 83 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 69 if xy(1,1)>x_lim(1) && xy(1,1)<x_lim(2) && xy(1,2)>y_lim(1) && xy(1,2)<y_lim(2) 70 AxeData=get(haxes,'UserData');% data attached to the axis 71 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin 72 if ~isequal(tag_obj,'proj_object') & ~test_create 73 x_mouse=xy(1,1);%default 74 y_mouse=xy(1,2);%default 75 u_mouse=[]; 76 v_mouse=[]; 77 w_mouse=[]; 78 A_mouse=[]; 79 c_text=[]; 80 f_text=[]; 81 ff_text=[]; 82 ivec=[]; 83 if isfield(AxeData,'X') & isfield(AxeData,'Y') & isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis 84 flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/4) & AxeData.X>(xy(1,1)-AxeData.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 85 (AxeData.Y<(xy(1,2)+AxeData.Mesh/4) & AxeData.Y>(xy(1,2)-AxeData.Mesh/4));%f 86 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 87 end 84 88 end 85 e nd86 % elseif isequal(get(hchild(ichild),'Visible'),'on')& ~isequal(get(hchild(ichild),'Style'),'frame') 87 % %FAIRE UNE OPTION D'AIDE AVEC BOUTON SOURIS DROIT (ALT)?? 89 else 90 haxes=[];%mouse out of axes 91 end 88 92 end 89 93 end … … 240 244 241 245 % create calibration points if the GUI geometry_calib is opened, if the main axes axes3 of uvmat has ben selected 242 if test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'axes3')246 if ~testzoom && test_cal && ~isempty(haxes) && strcmp(get(haxes,'tag'),'axes3') 243 247 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 244 248 hh_geometry_calib=guidata(h_geometry_calib); 245 249 h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord'); 246 250 h_edit_append=hh_geometry_calib.edit_append;%findobj(h_geometry_calib,'Tag','edit_append'); 247 if isequal(get(h_edit_append,'Value'),1) 251 if isequal(get(h_edit_append,'Value'),1) && ~isempty(haxes) 248 252 coord_value=get(hhuvmat.transform_fct,'Value');% set uvmat to pixel coordinates, run it again if not 249 253 if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys) … … 256 260 Coord=get(h_ListCoord,'String'); 257 261 data=read_geometry_calib(Coord);%transform char cell to numbers 258 ind_range=10;%range of research around each existing point 262 xlim=get(haxes,'XLim'); 263 ind_range_x=abs((xlim(2)-xlim(1))/50); 264 ylim=get(haxes,'YLim'); 265 ind_range_y=abs((ylim(2)-ylim(1))/50); 266 ind_range=sqrt(ind_range_x*ind_range_y); 259 267 test_newpoint=1; 260 268 if size(data.Coord,2)>=5 %if calibration points already exist … … 265 273 test_newpoint=isempty(index_point);%test for no existing calibration point near the mouse position 266 274 end 275 val=get(h_ListCoord,'Value'); 267 276 %create a new calib point if we are not close to an existing one 268 277 if test_newpoint 269 278 strline=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 270 val=get(h_ListCoord,'Value');279 271 280 if length(Coord)>=val 272 281 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point … … 286 295 set(hh,'YData',YCoord) 287 296 end 288 set(hh,'UserData', 'edit_mode')% flag the points to edit mode297 set(hh,'UserData',val)% flag the points to edit mode 289 298 hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle) 290 299 if ~isempty(hhh)
Note: See TracChangeset
for help on using the changeset viewer.