Changeset 71 for trunk/src/set_object.m
- Timestamp:
- Mar 29, 2010, 6:34:55 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r67 r71 89 89 PlotHandles=[]; 90 90 end 91 enable_plot=0;%default 92 SetData.PlotHandles=PlotHandles; 93 % if exist('data','var') && isfield(data,'ParentButton') 94 % SetData.ParentButton=data.ParentButton; 95 % set(hObject,'DeleteFcn',{@closefcn,SetData.ParentButton})% 96 % end 97 set(hObject,'UserData',SetData) 91 enable_plot=0;%default: does not allow plot of object and projection 92 % SetData.PlotHandles=PlotHandles; 93 % set(hObject,'UserData',SetData) 98 94 99 95 % fill the interface as set in the input data: 100 96 if exist('data','var') 101 if isfield(data,'desable_plot') 102 enable_plot=~data.desable_plot;%test to desable button PLOT (display mode) 97 if isfield(data,'enable_plot') 98 enable_plot=data.enable_plot;%test to desable button PLOT (display mode) 99 end 100 if isfield(data,'Name') 101 set(handles.TITLE,'String',data.Name) 103 102 end 104 103 if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case … … 732 731 function PLOT_Callback(hObject, eventdata, handles) 733 732 734 SetData=get(handles.set_object,'UserData');%get the hidden interface data 735 huvmat=findobj('Name','uvmat');%find the current uvmat interface handle 736 hlist_object=findobj(huvmat,'Tag','list_object_1');%handles of the object list in the GUI uvmat 737 IndexObj=get(hlist_object,'Value');%position in the objet list 733 %SetData=get(handles.set_object,'UserData');%get the hidden interface data 734 huvmat=findobj('tag','uvmat');%find the current uvmat interface handle 738 735 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 736 hhuvmat=guidata(huvmat);%handles in the uvmat GUI 737 ObjectName=get(handles.set_object,'name');%name ome)f the current object (set_object na 738 ListObject=get(hhuvmat.list_object_1,'String');%position in the objet list 739 IndexObj_1=get(hhuvmat.list_object_1,'Value'); 740 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 741 742 % set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]); 739 743 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object 740 ObjectData.HandlesDisplay=[]; % new object plot by default 741 if length(UvData.Object) >= IndexObj && isfield(UvData.Object{IndexObj},'HandlesDisplay') 742 hdisplay=UvData.Object{IndexObj}.HandlesDisplay; 743 if isequal(UvData.Object{IndexObj}.Style, ObjectData.Style) && isequal(UvData.Object{IndexObj}.ProjMode, ObjectData.ProjMode) 744 ObjectData.HandlesDisplay=UvData.Object{IndexObj}.HandlesDisplay; 745 else % for a new object styl, delete the existing object plots 746 for ih=1:length(hdisplay) 747 PlotData=get(hdisplay(ih),'UserData'); 748 if isfield(PlotData,'SubObject') & ishandle(PlotData.SubObject) 749 delete(PlotData.SubObject); 750 end 751 if isfield(PlotData,'DeformPoint') & ishandle(PlotData.DeformPoint) 752 delete(PlotData.DeformPoint); 753 end 754 if ~isequal(hdisplay(ih),0) 755 delete(hdisplay(ih)); 756 end 757 end 758 if isfield(ObjectData,'plotaxes') && ishandle(ObjectData.plotaxes) 759 delete(ObjectData.plotaxes)%delete the axes for plotting the current projection result 760 end 761 end 762 end 744 PlotHandles=[];%default 745 testnew=0; 746 if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame 747 ObjectData.HandlesDisplay=handles.axes3; 748 PlotHandles=get_plot_handles(handles); 749 IndexObj=IndexObj_1; 750 elseif strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 751 hview_field=findobj('tag','view_field'); 752 if ~isempty(hview_field) 753 PlotHandles=guidata(hview_field); 754 % PlotHandles=get_plot_handles( hhview_field); 755 ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field 756 end 757 IndexObj=IndexObj_2; 758 else %new object 759 testnew=1; 760 761 IndexObj=numel(ListObject)+1; 762 %ObjectName=[num2str(IndexObj) '-' ObjectData.Style]; 763 % ListObject=[ListObject;ObjectName]; 764 % set(hhuvmat.list_object_2,'String',[ListObject;ObjectName;{'...'}]) 765 % set(hhuvmat.list_object_2,'Value',IndexObj) 766 end 767 ObjectName=get(handles.TITLE,'String'); 768 if length(ObjectName)<1 769 ObjectName=[num2str(IndexObj) '-' ObjectData.Style]; 770 else 771 for ilist=1:numel(ListObject) 772 if strcmp(ListObject{ilist},ObjectName) 773 ObjectName=[num2str(IndexObj) '-' ObjectName]; 774 break 775 end 776 end 777 end 778 ListObject{IndexObj,1}=ObjectName; 779 set(hhuvmat.list_object_1,'String',ListObject) 780 set(hhuvmat.list_object_2,'String',[ListObject;{'...'}]) 781 set(handles.set_object,'name',ObjectName);%update the name of set_object so that it equals its corresponding object in the list 782 if testnew 783 set(hhuvmat.list_object_2,'Value',IndexObj) 784 end 785 % ObjectData.HandlesDisplay=[]; % new object plot by default 786 % if length(UvData.Object) >= IndexObj && isfield(UvData.Object{IndexObj},'HandlesDisplay') 787 % hdisplay=UvData.Object{IndexObj}.HandlesDisplay; 788 % if isequal(UvData.Object{IndexObj}.Style, ObjectData.Style) && isequal(UvData.Object{IndexObj}.ProjMode, ObjectData.ProjMode) 789 % ObjectData.HandlesDisplay=UvData.Object{IndexObj}.HandlesDisplay; 790 % else % for a new object styl, delete the existing object plots 791 % for ih=1:length(hdisplay) 792 % PlotData=get(hdisplay(ih),'UserData'); 793 % if isfield(PlotData,'SubObject') & ishandle(PlotData.SubObject) 794 % delete(PlotData.SubObject); 795 % end 796 % if isfield(PlotData,'DeformPoint') & ishandle(PlotData.DeformPoint) 797 % delete(PlotData.DeformPoint); 798 % end 799 % if ~isequal(hdisplay(ih),0) 800 % delete(hdisplay(ih)); 801 % end 802 % end 803 % if isfield(ObjectData,'plotaxes') && ishandle(ObjectData.plotaxes) 804 % delete(ObjectData.plotaxes)%delete the axes for plotting the current projection result 805 % end 806 % end 807 % end 763 808 764 809 % update the object plot and projection field 765 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,SetData.PlotHandles); 766 810 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 767 811 768 812 set(huvmat,'UserData',UvData)%update the data in the uvmat interface 769 list_str=get(hlist_object,'String'); 770 % TITLE=set_title(ObjectData.Style,ObjectData.ProjMode); 771 % list_str{IndexObj}=[num2str(IndexObj) '-' TITLE]; 772 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 773 % if isequal(length(list_str),IndexObj) 774 % list_str{IndexObj+1}='more...'; 775 % end 776 set(hlist_object_1,'String',list_str) 777 set(hlist_object_1,'Value',IndexObj) 778 779 %update create buttons on the GUI uvmat: set to object edit mode after object plotting 813 % list_str=get(hlist_object,'String'); 814 % list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 815 % set(hlist_object_1,'String',list_str) 816 % set(hlist_object_1,'Value',IndexObj) 817 818 %set uvmat to object edit mode to allow further object update 780 819 hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI 781 %desactivate all create buttons in mode edit782 % if isequal(get(hhuvmat.edit,'Value'),0)783 % set(hhuvmat.create,'Value',0)784 % set(hhuvmat.create,'BackgroundColor',[0 1 0])%put unactivated buttons to green785 % set(hhuvmat.LINE,'Value',0)786 % set(hhuvmat.LINE,'BackgroundColor',[0 1 0])%put unactivated buttons to green787 % set(hhuvmat.PATCH,'Value',0)788 % set(hhuvmat.PATCH,'BackgroundColor',[0 1 0])%put unactivated buttons to green789 % set(hhuvmat.PLANE,'Value',0)790 % set(hhuvmat.PLANE,'BackgroundColor',[0 1 0])%put unactivated buttons to green791 % set(hhuvmat.VOLUME,'Value',0)792 % set(hhuvmat.VOLUME,'BackgroundColor',[0 1 0])%put unactivated buttons to green793 % end794 820 set(hhuvmat.MenuEditObject,'enable','on') 795 821 set(hhuvmat.edit,'Value',1) … … 848 874 title={'object name'}; 849 875 dir_save=uigetdir(RootPath); 850 def={fullfile(dir_save,['Object' Object.CoordType '.xml'])}; 876 ObjectName=get(handles.TITLE,'String'); 877 if ~isempty(ObjectName)&&~strcmp(ObjectName,'') 878 def={fullfile(dir_save,[ObjectName Object.CoordType '.xml'])}; 879 else 880 def={fullfile(dir_save,[Object.Style Object.CoordType '.xml'])}; 881 end 851 882 options.Resize='on'; 852 883 displ_txt='save object as an .xml file';%default display
Note: See TracChangeset
for help on using the changeset viewer.