Changeset 429 for trunk/src/mouse_up.m
- Timestamp:
- May 22, 2012, 1:07:40 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_up.m
r425 r429 60 60 IndexObj=PlotData.IndexObj; 61 61 ObjectData=UvData.Object{IndexObj}; 62 ObjectData.enable_plot=1; 63 62 % ObjectData.enable_plot=1; 63 if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse') 64 NbDefPoint=1; 65 elseif strcmp(ObjectData.Type,'line')|| strcmp(ObjectData.Type,'plane'); 66 NbDefPoint=2; 67 else 68 NbDefPoint=3; 69 end 64 70 % ending translation 65 71 if isequal(AxeData.Drawing,'translate') … … 78 84 %creating object 79 85 else 80 if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||... 81 strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points') 82 if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3 83 xy(1,3)=AxeData.ObjectCoord(1,3); % z coordinate of the mouse: to generalise ... 84 else 85 xy(1,3)=0; % z coordinate set to 0 by default 86 end 87 if ~isequal(ObjectData.Coord,xy(1,:)) 88 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordiantes marked by the mouse to the eobject 89 end 90 elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse')||isequal(ObjectData.Type,'volume') 91 XYData=AxeData.CurrentOrigin; 92 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate 93 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2; 94 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width 95 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height 96 elseif isequal(ObjectData.Type,'plane') %case of 'plane' 97 DX=(xy(1,1)-ObjectData.Coord(1,1)); 98 DY=(xy(1,2)-ObjectData.Coord(1,2)); 99 ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width 100 if isfield(ObjectData,'RangeX') 101 XMax=sqrt(DX*DX+DY*DY); 102 if XMax>max(ObjectData.RangeX) 103 ObjectData.RangeX=[min(ObjectData.RangeX) XMax]; 104 end 105 end 106 end 107 end 108 if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse') 109 NbDefPoint=1; 110 elseif strcmp(ObjectData.Type,'line')|| strcmp(ObjectData.Type,'plane'); 111 NbDefPoint=2; 112 else 113 NbDefPoint=3; 86 switch ObjectData.Type 87 case {'line'} 88 if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3 89 xy(1,3)=AxeData.ObjectCoord(1,3); % z coordinate of the mouse: to generalise ... 90 else 91 xy(1,3)=0; % z coordinate set to 0 by default 92 end 93 % if ~isequal(ObjectData.Coord,xy(1,:)) 94 if ~isequal(ObjectData.Coord(end,1:2),xy(1,1:2)) 95 ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the second point of the line if different from the first one 96 end 97 % end 98 case {'rectangle','ellipse','volume'} 99 XYData=AxeData.CurrentOrigin; 100 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate 101 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2; 102 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width 103 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height 104 case 'plane' %case of 'plane' 105 DX=(xy(1,1)-ObjectData.Coord(1,1)); 106 DY=(xy(1,2)-ObjectData.Coord(1,2)); 107 ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width 108 if isfield(ObjectData,'RangeX') 109 XMax=sqrt(DX*DX+DY*DY); 110 if XMax>max(ObjectData.RangeX) 111 ObjectData.RangeX=[min(ObjectData.RangeX) XMax]; 112 end 113 end 114 end 114 115 end 115 116 … … 118 119 hh_set_object=guidata(h_set_object); 119 120 set(hh_set_object.Coord,'Data',ObjectData.Coord); 120 % set(hh_set_object.XObject,'String',num2str(ObjectData.Coord(:,1),4));121 % set(hh_set_object.YObject,'String',num2str(ObjectData.Coord(:,2),4));122 % set(hh_set_object.ZObject,'String',num2str(ObjectData.Coord(:,3),4));123 121 if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse') 124 122 set(hh_set_object.num_RangeX_2,'String',num2str(ObjectData.RangeX,4)); … … 128 126 strcmp(AxeData.Drawing,'translate') || strcmp(AxeData.Drawing,'deform');%stop drawing 129 127 AxeData.CurrentOrigin=[]; %suppress the current origin 130 if isequal(ObjectData.Type,'line') && size(ObjectData.Coord,1) <=1128 if isequal(ObjectData.Type,'line') && size(ObjectData.Coord,1)>=2 131 129 AxeData.Drawing='off'; 132 130 set(currentaxes,'UserData',AxeData); 133 return % line needs at leqst two points131 % return % line needs at leqst two points 134 132 end 135 133 if ~isempty(ObjectData) … … 153 151 if ~isempty(ProjData) 154 152 if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen in view_field 155 hview_field=findobj(allchild(0),'tag','view_field');153 hview_field=findobj(allchild(0),'tag','view_field'); 156 154 if isempty(hview_field) 157 hview_field=view_field(ProjData); 155 hview_field=view_field(ProjData); %open the view_field GUI for plot 158 156 else 159 hhview_field=guidata(hview_field);160 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing field plot157 hhview_field=guidata(hview_field); 158 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing plot in view_field 161 159 write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object 162 160 end 163 161 ViewFieldData=get(hview_field,'UserData'); 164 ViewFieldData.axes3=ProjData; 165 set(hview_field,'UserData',ViewFieldData) 166 162 % ViewFieldData.axes3=ProjData; 163 haxes=findobj(hview_field,'tag','axes3'); 164 if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table) 165 h_TableDisplay=findobj(hview_field,'tag','TableDisplay'); 166 pos_table=get(h_TableDisplay,'Position'); 167 pos=get(hview_field,'Position'); 168 set(hview_field,'Position',[pos(1)+pos(3)-pos_table(3) pos(2)+pos(4)-pos_table(4) pos_table(3) pos_table(4)]) 169 drawnow 170 set(hview_field,'UserData',ViewFieldData);% restore the previously stored GUI position after GUI resizing 171 else 172 set(hview_field,'Position',ViewFieldData.GUISize) 173 end 174 175 % Data=get(hview_field,'UserData'); 176 % if isempty(hview_field) 177 % hview_field=view_field(ProjData); 178 % else 179 % hhview_field=guidata(hview_field); 180 % [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing field plot 181 % write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object 182 % end 183 % ViewFieldData=get(hview_field,'UserData'); 184 % ViewFieldData.axes3=ProjData; 185 % set(hview_field,'UserData',ViewFieldData) 167 186 else 168 187 UvData.axes3=ProjData;
Note: See TracChangeset
for help on using the changeset viewer.