Changeset 402 for trunk/src/mouse_down.m
- Timestamp:
- Apr 29, 2012, 11:29:24 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_down.m
r387 r402 253 253 set(hhuvmat.ListObject,'Value',IndexObj); 254 254 set(hhuvmat.ListObject,'UserData',IndexObj); 255 % list_str=get(hhuvmat.list_object_2,'String');256 % UvData.Object{IndexObj(2)}.Name=list_str{IndexObj};257 255 else 258 256 set(hhuvmat.ListObject,'Value',IndexObj); … … 291 289 %% create new projection object 292 290 if test_create && ~isempty(xy) && ~(isfield(AxeData,'Drawing')&& isequal(AxeData.Drawing,'create')) 293 hset_object=findobj(allchild(0),'tag','set_object'); 294 if ~isempty(hset_object) 295 %ObjectData=read_set_object(sethandles); %read object features in the GUI set_object 296 ObjectData=read_GUI(hset_object); 297 ObjectData.Coord=[]; %reset previous object coordinates 298 ObjectData.Coord(1,1)=xy(1,1); 299 ObjectData.Coord(1,2)=xy(1,2); 300 % ObjectData.Coord(1,3)=0; 301 if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3 302 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle 303 end 304 AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject 305 if isfield(UvData,'Object') 306 IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface 307 else 308 IndexObj=2; 309 end 310 UvData.Object{IndexObj}=ObjectData; 311 list_str=get(hhuvmat.ListObject,'String'); 312 IndexObj_old=get(hhuvmat.ListObject,'Value'); 313 % set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj] ); 314 UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject; 315 object_name=ObjectData.Name; 316 sethandles=guidata(hset_object); 317 if isempty(object_name) 318 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Type]; 319 set(sethandles.Name,'String',list_str{IndexObj}) 320 else 321 list_str{IndexObj}=object_name; 322 end 323 set(hhuvmat.ListObject,'String',list_str) 324 set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj] ); 325 UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject; 326 set(huvmat,'UserData',UvData) 327 PlotData=get(AxeData.CurrentObject,'UserData'); 328 PlotData.IndexObj=IndexObj; 329 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph 330 AxeData.Drawing='create'; 331 end 291 hset_object=findobj(allchild(0),'tag','set_object'); 292 if ~isempty(hset_object) 293 sethandles=guidata(hset_object); 294 ObjectData=read_GUI(hset_object); %read object features in the GUI set_object 295 ObjectData.Coord=[]; %reset previous object coordinates 296 ObjectData.Coord(1,1)=xy(1,1); 297 ObjectData.Coord(1,2)=xy(1,2); 298 if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3 299 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle 300 end 301 AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject 302 if isfield(UvData,'Object') 303 IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface 304 else 305 IndexObj=2; 306 end 307 UvData.Object{IndexObj}=ObjectData; 308 ListObject=get(hhuvmat.ListObject,'String'); 309 IndexObj_old=get(hhuvmat.ListObject,'Value'); 310 UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject; 311 ObjectNameNew=ObjectData.Name; 312 if isempty(ObjectNameNew) 313 ObjectNameNew=ObjectData.Type; 314 end 315 vers=0;% index of the name 316 detectname=1; 317 while detectname==1 318 detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list 319 if detectname% if the object name already exists 320 indstr=regexp(ObjectNameNew,'\D'); 321 if indstr(end)<length(ObjectNameNew) %object name ends by a number 322 vers=str2double(ObjectNameNew(indstr(end)+1:end))+1; 323 ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)]; 324 else 325 vers=vers+1; 326 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]; 327 end 328 end 329 end 330 ObjectName=ObjectNameNew; 331 set(sethandles.Name,'String',ObjectName)% display the default name in set_object 332 IndexObj=numel(ListObject)+1;% append an object to the list in uvmat 333 set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list 334 set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj]) 335 % if isempty(object_name) 336 % list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Type]; 337 % set(sethandles.Name,'String',list_str{IndexObj}) 338 % else 339 % list_str{IndexObj}=object_name; 340 % end 341 % set(hhuvmat.ListObject,'String',list_str) 342 UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject; 343 set(huvmat,'UserData',UvData) 344 PlotData=get(AxeData.CurrentObject,'UserData'); 345 PlotData.IndexObj=IndexObj; 346 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph 347 AxeData.Drawing='create'; 348 end 332 349 end 333 350
Note: See TracChangeset
for help on using the changeset viewer.