Changeset 413 for trunk/src/set_object.m
- Timestamp:
- May 8, 2012, 2:27:50 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r410 r413 415 415 function PLOT_Callback(hObject, eventdata, handles) 416 416 417 %% reading the object selection in the GUI uvmat418 huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle419 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat420 hhuvmat=guidata(huvmat);%handles of the objects children of the GUI uvmat421 ListObject=get(hhuvmat.ListObject,'String');% list of objects displyed in uvmat422 IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat423 if get(hhuvmat.ViewObject,'Value')424 IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field425 end426 427 417 %% read the object parameters in the GUI set_object 428 418 ObjectData=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object … … 438 428 ObjectName=ObjectData.Name;%name of the current object defined in set_object 439 429 if isempty(ObjectName) 440 % if get(hhuvmat.edit_object,'Value')% edit mode 441 % if isempty(ListObject) 442 % ObjectName='Plane'; 443 % else 444 % ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item 445 % end 446 % else %new object 447 ObjectName=ObjectData.Type; 448 % end 430 ObjectName=ObjectData.Type; 431 end 432 433 %% read the object selection in the GUI uvmat 434 huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle 435 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 436 hhuvmat=guidata(huvmat);%handles of the objects children of the GUI uvmat 437 ListObject=get(hhuvmat.ListObject_1,'String');% list of objects displayed in uvmat 438 IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat 439 if get(hhuvmat.ViewObject,'Value') && get(hhuvmat.edit_object,'Value') 440 IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field 449 441 end 450 442 if ~get(hhuvmat.edit_object,'Value') %new object is being created … … 473 465 UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet) 474 466 end 475 testnew=0;476 if numel(IndexObj)==1 % if only one object is selected, the projection is in uvmat477 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field478 else % if a second object is selected, the projection is in view_field, and this second object is selected479 hview_field=findobj(allchild(0),'tag','view_field');480 if isempty(hview_field)481 hview_field=view_field;%open the GUI view_field if it is not found482 end483 PlotHandles=guidata(hview_field);484 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field485 end486 467 487 468 %% naming the object 488 ListObject{IndexObj(end),1}=ObjectName;489 set(hhuvmat.ListObject,'String',ListObject)490 set(hhuvmat.ListObject_1,'String',ListObject)469 % ListObject{IndexObj(end),1}=ObjectName; 470 % set(hhuvmat.ListObject,'String',ListObject) 471 % set(hhuvmat.ListObject_1,'String',ListObject) 491 472 492 473 %% update the object plot 493 % if testnew 494 % set(hhuvmat.ListObject,'Value',IndexObj) 495 % ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; 496 % ObjectData.DisplayHandle_view_field=[]; 497 % else 498 if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles 499 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat; 500 else 501 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input 502 end 503 if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles 504 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field; 505 else 506 ObjectData.DisplayHandle_view_field=[]; 507 end 508 % end 474 if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles 475 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat; 476 else 477 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input 478 end 479 if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles 480 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field; 481 else 482 ObjectData.DisplayHandle_view_field=[]; 483 end 509 484 UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties 510 485 if numel(IndexObj)==2 511 486 UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2)); 512 487 end 513 488 set(huvmat,'UserData',UvData) 514 489 515 %% plot the field projected on the object and store in the corresponding figue490 %% plot the field projected on the object 516 491 if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none') 517 492 PlotType='text'; … … 521 496 msgbox_uvmat('ERROR', errormsg) 522 497 return 523 end 524 fighandle=get(plotaxes,'parent'); 525 PlotParam=read_GUI(fighandle); 526 PlotType=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot 498 end 499 if numel(IndexObj)==1 % if only one object is selected, the projection is in uvmat 500 % plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 501 PlotType=plot_field(ProjData,hhuvmat.axes3,read_GUI(get(hhuvmat.axes3,'parent')));%update the current uvmat plot 502 else % if a second object is selected, the projection is in view_field, and this second object is selected 503 hview_field=findobj(allchild(0),'tag','view_field'); 504 if isempty(hview_field) 505 PlotType=view_field(ProjData); %open the view_field GUI for plot 506 % hview_field=view_field;%open the GUI view_field if it is not found 507 else 508 hhview_field=guidata(hview_field); 509 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing plot in view_field 510 write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object 511 end 512 % PlotHandles=guidata(hview_field); 513 % plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 514 end 515 % fighandle=get(plotaxes,'parent'); 516 % PlotParam=read_GUI(fighandle); 517 % PlotType=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot 527 518 end 528 519 if strcmp(PlotType,'text')
Note: See TracChangeset
for help on using the changeset viewer.