Changeset 156 for trunk/src/set_object.m
- Timestamp:
- Dec 19, 2010, 10:11:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r153 r156 721 721 function PLOT_Callback(hObject, eventdata, handles) 722 722 723 %% reading the object parameters on the GUI uvmat 723 724 huvmat=findobj('tag','uvmat');%find the current uvmat interface handle 724 725 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat … … 728 729 IndexObj_1=get(hhuvmat.list_object_1,'Value'); 729 730 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 730 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object731 731 testnew=0; 732 732 PlotHandles=get_plot_handles(hhuvmat); 733 projview=' ';733 projview='view_field';%default 734 734 if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame 735 ObjectData.HandlesDisplay=hhuvmat.axes3; 735 % ObjectData.HandlesDisplay=hhuvmat.axes3; 736 % Object_set{iobj}.DisplayHandle_view_field 736 737 IndexObj=IndexObj_1; 737 738 projview='uvmat'; 739 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 738 740 elseif IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 741 742 IndexObj=IndexObj_2; 743 % projview='view_field'; 744 else %new object 745 testnew=1; 746 IndexObj=numel(ListObject)+1; 739 747 hview_field=findobj(allchild(0),'tag','view_field'); 740 748 if ~isempty(hview_field) 741 749 PlotHandles=guidata(hview_field); 742 ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field 743 end 744 IndexObj=IndexObj_2; 745 projview='view_field'; 746 else %new object 747 testnew=1; 748 IndexObj=numel(ListObject)+1; 749 end 750 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 751 % ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field 752 end 753 end 754 if strcmp(projview,'view_field') 755 hview_field=findobj(allchild(0),'tag','view_field') 756 if isempty(hview_field) 757 hview_field=view_field 758 end 759 PlotHandles=guidata(hview_field); 760 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 761 end 762 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object 763 764 %% naming the object 750 765 if length(ObjectName)<1% name of object not defined in set_object 751 766 ObjectName=[num2str(IndexObj) '-' ObjectData.Style];%default name 752 elseif ~get(hhuvmat.edit ,'Value')%not in edit mode (new object created)767 elseif ~get(hhuvmat.edit_object,'Value')%not in edit mode (new object created) 753 768 detectname=1; 754 769 ObjectNameNew=ObjectName; 755 770 vers=0; 756 while detectname==1 %create a new subdir if the netcdf files already exist757 detectname=find(strcmp(ObjectNameNew,ListObject),1) %test the existence of the proposed name in the list758 if detectname% if athe object name already exists759 indstr=regexp(ObjectNameNew,'\D') 771 while detectname==1 772 detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list 773 if detectname% if the object name already exists 774 indstr=regexp(ObjectNameNew,'\D'); 760 775 if indstr(end)<length(ObjectNameNew) %object name ends by a number 761 776 vers=str2double(ObjectNameNew(indstr(end)+1:end))+1; 762 777 ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)]; 763 778 else 764 vers=vers+1 765 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)] 779 vers=vers+1; 780 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]; 766 781 end 767 782 end … … 772 787 set(hhuvmat.list_object_1,'String',ListObject) 773 788 set(hhuvmat.list_object_2,'String',[ListObject;{'...'}]) 789 790 %% update the object plot and projection field 774 791 if testnew 775 792 set(hhuvmat.list_object_2,'Value',IndexObj) 776 end 777 778 % update the object plot and projection field 779 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 793 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; 794 ObjectData.DisplayHandle_view_field=[]; 795 else % save the previous object graph handles 796 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat; 797 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field; 798 end 799 UvData.Object{IndexObj}=ObjectData;%update the current object properties 800 IndexObj 801 ObjectData 802 UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2); 803 804 %% plot the field projected on the object and store it the corresponding figue 805 get(plotaxes,'tag') 806 ProjData= proj_field(UvData.Field,ObjectData)%project the current interface field on ObjectData 807 [PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);%update an existing field plot 780 808 if strcmp(projview,'view_field') 781 809 ViewFieldData=get(hview_field,'UserData'); … … 786 814 end 787 815 788 % set uvmat to object edit mode to allow further object update816 %% update the GUI uvmat 789 817 hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI 790 818 set(hhuvmat.MenuEditObject,'enable','on') 791 set(hhuvmat.edit ,'Value',1)792 set(hhuvmat.edit ,'BackgroundColor',[1 1 0]);% paint the edit text in yellow793 UvData.MouseAction='edit_object'; % set the edit button to 'on'819 set(hhuvmat.edit_object,'Value',1) % set uvmat to object edit mode to allow further object update 820 set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 821 %UvData.MouseAction='edit_object'; % set the edit button to 'on' 794 822 set(huvmat,'UserData',UvData) 795 823 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.