Changeset 432 for trunk/src/set_object.m
- Timestamp:
- May 25, 2012, 8:59:59 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r429 r432 414 414 415 415 %------------------------------------------------------------------------ 416 % --- Executes on button press in PLOT: PLOT the definedobject and its projected field416 % --- Executes on button press in PLOT: refresh the current object , plot the object and its projected field 417 417 function PLOT_Callback(hObject, eventdata, handles) 418 418 … … 430 430 ObjectName=ObjectData.Name;%name of the current object defined in set_object 431 431 if isempty(ObjectName) 432 ObjectName=ObjectData.Type; 433 end 434 435 %% read the object selection in the GUI uvmat432 ObjectName=ObjectData.Type;% name the object by the object type type by default 433 end 434 435 %% read the current object selection in the GUI uvmat 436 436 huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle 437 437 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 438 438 hhuvmat=guidata(huvmat);%handles of the objects children of the GUI uvmat 439 ListObject=get(hhuvmat.ListObject_1,'String');% list of objects displayed in uvmat 440 IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat 441 if get(hhuvmat.ViewObject,'Value') && get(hhuvmat.edit_object,'Value') 442 IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field 443 end 439 ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat 440 IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat 444 441 if ~get(hhuvmat.edit_object,'Value') %new object is being created 445 442 detectname=1; … … 461 458 ObjectName=ObjectNameNew; 462 459 set(handles.Name,'String',ObjectName)% display the default name in set_object 463 IndexObj (2)=numel(ListObject)+1;% append an object to the list in uvmat460 IndexObj=numel(ListObject)+1;% append an object to the list in uvmat 464 461 set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list 465 462 set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list 466 set(hhuvmat.ListObject,'Value',IndexObj (2))463 set(hhuvmat.ListObject,'Value',IndexObj) 467 464 set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object 468 UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet) 469 end 470 471 %% naming the object 472 % ListObject{IndexObj(end),1}=ObjectName; 473 % set(hhuvmat.ListObject,'String',ListObject) 474 % set(hhuvmat.ListObject_1,'String',ListObject) 475 476 %% update the object plot 477 if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles 478 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat; 479 else 480 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input 481 end 482 if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles 483 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field; 484 else 485 ObjectData.DisplayHandle_view_field=[]; 486 end 487 UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties 488 if numel(IndexObj)==2 489 UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2)); 490 end 491 set(huvmat,'UserData',UvData) 465 UvData.Object{IndexObj}=[];%initiate a new object (empty yet) 466 UvData.Object{IndexObj}.DisplayHandle.uvmat=hhuvmat.axes3; %axes taken as object display handle by defualt 467 end 492 468 493 469 %% plot the field projected on the object 470 hview_field=[];%default 494 471 if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none') 495 472 PlotType='text'; … … 500 477 return 501 478 end 502 if numel(IndexObj)==1 % if only one object is selected, the projection is in uvmat 479 IndexObj_1=get(hhuvmat.ListObject_1,'Value') 480 if isequal(IndexObj_1,IndexObj) % if only one object is selected, the projection is in uvmat 503 481 PlotType=plot_field(ProjData,hhuvmat.axes3,read_GUI(get(hhuvmat.axes3,'parent')));%update the current uvmat plot 504 482 else % if a second object is selected, the projection is in view_field, and this second object is selected … … 525 503 end 526 504 end 505 506 %% update the object plot 507 % if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle')% save the previous object graph handles 508 % ObjectData.DisplayHandle.uvmat=UvData.Object{IndexObj(end)}.DisplayHandle.uvmat; 509 % else 510 % ObjectData.DisplayHandle.uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input 511 % end 512 % if isfield(UvData.Object{IndexObj},'DisplayHandle')% save the previous object graph handles 513 % ObjectData.DisplayHandle.view_field=UvData.Object{IndexObj(end)}.DisplayHandle.view_field; 514 % else 515 % ObjectData.DisplayHandle.view_field=[]; 516 % end 517 % UvData.Object{IndexObj}=ObjectData;%update the current object properties 518 % if numel(IndexObj)==2 519 hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat; 520 if isempty(hobject) 521 hobject=hhuvmat.axes3; 522 end 523 UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(ObjectData,[],hobject,'m');%draw the object in uvmat 524 if ~isempty(hview_field) 525 if isfield(UvData.Object{IndexObj}.DisplayHandle,'view_field') 526 hobject=UvData.Object{IndexObj}.DisplayHandle.view_field; 527 end 528 if isempty(hobject) 529 hobject=haxes; 530 end 531 UvData.Object{IndexObj}.DisplayHandle.view_field=plot_object(ObjectData,[],hobject,'m');%draw the object in view_field 532 % UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2)); 533 end 534 set(huvmat,'UserData',UvData) 527 535 528 536 %% update the GUI uvmat
Note: See TracChangeset
for help on using the changeset viewer.