- Timestamp:
- Dec 9, 2010, 11:35:47 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_up.m
r150 r154 26 26 test_zoom=0;%default 27 27 currentfig=hObject; 28 tagfig=get(currentfig,'tag'); 28 29 hhcurrentfig=guidata(currentfig); 29 30 test_zoom=get(hhcurrentfig.zoom,'Value'); … … 46 47 test_drawing=0;%default 47 48 48 % finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field49 %% finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field 49 50 if ~isempty(huvmat) & isfield(AxeData,'Drawing') & ~isequal(AxeData.Drawing,'off') & isfield(AxeData,'CurrentObject')... 50 51 & ishandle(AxeData.CurrentObject) … … 54 55 ObjectData=UvData.Object{IndexObj}; 55 56 ObjectData.enable_plot=1; 57 58 % ending translation 56 59 if isequal(AxeData.Drawing,'translate') 57 60 XYData=AxeData.CurrentOrigin; … … 60 63 ObjectData.Coord(:,1)=ObjectData.Coord(:,1)+DX; 61 64 ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY; 65 66 %ending object deformation 62 67 elseif isequal(AxeData.Drawing,'deform') 63 68 ind_move=AxeData.CurrentIndex; 64 69 ObjectData.Coord(ind_move,1)=xy(1,1); 65 70 ObjectData.Coord(ind_move,2)=xy(1,2); 66 else %creating object 71 72 %creating object 73 else 67 74 if strcmp(ObjectData.Style,'line')||strcmp(ObjectData.Style,'polyline')||... 68 75 strcmp(ObjectData.Style,'polygon')||strcmp(ObjectData.Style,'points') … … 84 91 DX=(xy(1,1)-ObjectData.Coord(1,1)); 85 92 DY=(xy(1,2)-ObjectData.Coord(1,2)); 86 ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle widt 93 ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width 87 94 if isfield(ObjectData,'RangeX') 88 95 XMax=sqrt(DX*DX+DY*DY); … … 93 100 end 94 101 end 95 %set(AxeData.CurrentObject,'UserData',ObjectData); %update the object properties96 102 if strcmp(ObjectData.Style,'rectangle')||strcmp(ObjectData.Style,'ellipse') 97 103 NbDefPoint=1; … … 117 123 end 118 124 if ~isempty(ObjectData) 119 testmask=0; 120 hmask=findobj(huvmat,'Tag','makemask'); 121 if ~isempty(hmask) 122 testmask=get(hmask,'Value'); 123 end 124 if testmask 125 PlotHandles=[];%do not project data on the object during mask creation 126 else 127 PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 128 end 129 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 125 % testmask=0; 126 % hmask=findobj(huvmat,'Tag','makemask'); 127 % if ~isempty(hmask) 128 % testmask=get(hmask,'Value'); 129 % end 130 % if testmask 131 % PlotHandles=[];%do not project data on the object during mask creation 132 % else 133 PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters 134 % end 135 UvData.Object=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 136 if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen on view_field 137 % if strcmp(projview,'view_field') 138 hview_field=findobj(allchild(0),'tag','view_field'); 139 ViewFieldData=get(hview_field,'UserData'); 140 ViewFieldData.axes3=ObjectData; 141 set(hview_field,'UserData',ViewFieldData) 142 else 143 UvData.axes3=ObjectData; 144 end 130 145 if isfield(UvData.Object{IndexObj},'PlotParam') 131 146 write_plot_param(PlotHandles,UvData.Object{IndexObj}.PlotParam); %update the display of plotting parameters for the current object … … 148 163 test_drawing=0; 149 164 end 150 %creation of a new zoom plot 165 166 %% creation of a new zoom plot 151 167 test_replot=0; 152 168 if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed … … 208 224 end 209 225 end 210 %zoom in by a factor 2 if no new figure is created 226 227 %% zoom in by a factor 2 if no new figure is created 211 228 if test_zoom 212 229 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates … … 270 287 end 271 288 272 % editing calibration point273 if ~test_zoom && strcmp(MouseAction,'calib') 289 %% editing calibration point 290 if ~test_zoom && strcmp(MouseAction,'calib') 274 291 h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI 275 292 hh_geometry_calib=guidata(h_geometry_calib); 276 293 edit_test=get(hh_geometry_calib.edit_append,'Value'); 277 hh=findobj(currentaxes,'Tag','calib_points');%look for handle of calibration points 294 hh=findobj(currentaxes,'Tag','calib_points');%look for handle of calibration points 278 295 if ~isempty(hh) && edit_test 279 296 index_point=get(hh,'UserData'); … … 281 298 h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list 282 299 Coord=get(h_ListCoord,'String'); 283 % val=get(h_ListCoord,'Value'); 284 coord_str=Coord{index_point}; %current line (string) 285 k=findstr('|',coord_str);%find separator indices on the string 286 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 287 if numel(k)>=3 288 coord_str=[coord_str(1:k(3)-1) '| ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord 289 else 290 coord_str=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 291 end 292 Coord{index_point}=coord_str; 293 set(h_ListCoord,'String',Coord) 294 data=read_geometry_calib(Coord);%transform char cell to numbers 300 data=read_geometry_calib(Coord); 301 % val=get(h_ListCoord,'Value'); 302 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 303 data.Coord(index_point,4)=xy(1,1); 304 data.Coord(index_point,5)=xy(1,2); 305 for ipoint=1:size(data.Coord,1) 306 for jcoord=1:5 307 Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits 308 end 309 end 310 Tabchar=cell2tab(Coord_cell,' | '); 311 Tabchar=[Tabchar ;{'......'}]; 312 set(h_ListCoord,'String',Tabchar) 313 % coord_str=Coord{index_point}; %current line (string) 314 % k=findstr('|',coord_str);%find separator indices on the string 315 % blanks=blank 316 % xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 317 % if numel(k)>=3 318 % coord_str=[coord_str(1:k(3)-1) ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord 319 % else 320 % coord_str=[ ' | ' ' | ' ' | ' num2str(xy(1,1),4) ' | ' num2str(xy(1,2),4)]; 321 % end 322 % Coord{index_point}=coord_str; 323 % set(h_ListCoord,'String',Coord) 324 % data=read_geometry_calib(Coord);%transform char cell to numbers 295 325 set(hh,'XData',data.Coord(:,4)) 296 326 set(hh,'YData',data.Coord(:,5)) … … 298 328 end 299 329 300 % finalising ruler 330 331 %% finalising ruler 301 332 if strcmp(MouseAction,'ruler') 302 333 UvData.MouseAction='none'; … … 315 346 end 316 347 317 318 %display the data of the current object selected with the mouse right click 348 %% display the data of the current object selected with the mouse right click 319 349 if isequal(get(currentfig,'SelectionType'),'alt') && ~test_zoom && (~isfield(AxeData,'Drawing')||~isequal(AxeData.Drawing,'create')) 320 350 hother=findobj('Tag','proj_object');%find all the proj objects … … 350 380 end 351 381 end 382 383 %% update 352 384 if test_drawing==0 353 385 AxeData.Drawing='off';%stop current drawing action
Note: See TracChangeset
for help on using the changeset viewer.