Changeset 309 for trunk/src/set_object.m
- Timestamp:
- Nov 30, 2011, 11:09:12 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r307 r309 84 84 end 85 85 set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front) 86 set(hObject,'WindowButtonDownFcn',{'mouse_ alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)86 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 87 87 enable_plot=0;%default: does not allow plot of object and projection 88 88 … … 644 644 set(handles.XObject,'String',XObject) 645 645 set(handles.YObject,'String',YObject) 646 646 647 %METTRA A JOUR ASPECT DE L'INTERFACE (COMME set_object_Opening 647 648 %------------------------------------------------------------------------ … … 649 650 % executed when closing: set the parent interface button to value 0 650 651 function closefcn(gcbo,eventdata,parent_button) 651 652 652 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle 653 653 if ~isempty(huvmat) … … 671 671 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 672 672 hhuvmat=guidata(huvmat);%handles in the uvmat GUI 673 ObjectName=get(handles.TITLE,'String');%name of the current object674 673 ListObject=get(hhuvmat.ListObject,'String');%position in the objet list 675 IndexObj=get(hhuvmat.ListObject,'Value'); 676 IndexObj_1=IndexObj(1); 677 % if isequal(get(hhuvmat.list_object_2,'Visible'),'on') 678 % IndexObj_2=get(hhuvmat.list_object_2,'Value'); 679 % List2=get(hhuvmat.list_object_2,'String'); 680 if numel(IndexObj)==2 681 IndexObj_2=IndexObj(2); 682 else 683 IndexObj_2=[]; 684 end 685 testnew=0; 674 IndexObj=get(hhuvmat.ListObject,'Value') 675 % name of the object 676 ObjectName=get(handles.TITLE,'String');%name of the current object defiend in set_object 686 677 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object 687 if ~isempty(ListObject) && strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame 688 IndexObj=IndexObj_1; 689 projview='uvmat'; 690 elseif ~isempty(IndexObj_2) && IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 691 IndexObj=IndexObj_2; 692 projview='view_field'; 693 else %new object 694 testnew=1; 695 IndexObj=numel(ListObject)+1; 696 projview='view_field'; 697 end 698 if strcmp(projview,'view_field') 699 hview_field=findobj(allchild(0),'tag','view_field'); 700 if isempty(hview_field) 701 hview_field=view_field; 702 end 703 PlotHandles=guidata(hview_field); 704 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 705 else 706 PlotHandles=hhuvmat; 707 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 708 709 end 710 711 %% naming the object 712 if length(ObjectName)<1% name of object not defined in set_object 713 ObjectName=[num2str(IndexObj) '-' ObjectData.Style];%default name 714 elseif ~get(hhuvmat.edit_object,'Value')%not in edit mode (new object created) 678 if isempty(ObjectName) 679 if get(hhuvmat.edit_object,'Value')% edit mode 680 ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item 681 end 682 end 683 if ~get(hhuvmat.edit_object,'Value') %new object is being created 715 684 detectname=1; 716 685 ObjectNameNew=ObjectName; 717 686 vers=0; 718 while detectname==1 687 while detectname==1 719 688 detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list 720 689 if detectname% if the object name already exists … … 725 694 else 726 695 vers=vers+1; 727 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]; 696 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]; 728 697 end 729 698 end 730 699 end 731 700 ObjectName=ObjectNameNew; 732 end 733 ListObject{IndexObj,1}=ObjectName; 701 ObjectName=[num2str(IndexObj(end)) '-' ObjectData.Style];%default name 702 end 703 % IndexObj_1=IndexObj(1); 704 % % if isequal(get(hhuvmat.list_object_2,'Visible'),'on') 705 % % IndexObj_2=get(hhuvmat.list_object_2,'Value'); 706 % % List2=get(hhuvmat.list_object_2,'String'); 707 % if numel(IndexObj)==2 708 % IndexObj_2=IndexObj(2); 709 % else 710 % IndexObj_2=[]; 711 % end 712 testnew=0; 713 714 if numel(IndexObj)==1 % if only one object is selected, the projection is in uvmat 715 PlotHandles=hhuvmat; 716 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 717 else % if a second object is selected, the projection is in view_field, and this second object is selected 718 hview_field=findobj(allchild(0),'tag','view_field'); 719 if isempty(hview_field) 720 hview_field=view_field; 721 end 722 PlotHandles=guidata(hview_field); 723 plotaxes=PlotHandles.axes3;%handle of axes3 in view_field 724 end 725 726 %% naming the object 727 ListObject{IndexObj(end),1}=ObjectName; 734 728 set(hhuvmat.ListObject,'String',ListObject) 735 % set(hhuvmat.list_object_2,'String',ListObject)736 729 737 730 %% update the object plot and projection field 738 if testnew 739 set(hhuvmat.ListObject,'Value',IndexObj) 740 % set(hhuvmat.list_object_2,'Value',IndexObj) 731 if testnew 732 set(hhuvmat.ListObject,'Value',IndexObj) 741 733 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; 742 734 ObjectData.DisplayHandle_view_field=[]; 743 735 else 744 IndexObj 745 UvData.Object{IndexObj} 746 if IndexObj<=length(UvData.Object) && isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles 747 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat; 736 if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles 737 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat; 748 738 else 749 739 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input 750 740 end 751 if isfield(UvData.Object{IndexObj },'DisplayHandle_view_field')% save the previous object graph handles752 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj }.DisplayHandle_view_field;741 if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles 742 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field; 753 743 else 754 744 ObjectData.DisplayHandle_view_field=[]; 755 745 end 756 746 end 757 UvData.Object{IndexObj}=ObjectData;%update the current object properties 758 UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2); 747 UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties 748 if numel(IndexObj)==2 749 UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2)); 750 end 759 751 set(huvmat,'UserData',UvData) 760 752 … … 765 757 return 766 758 end 767 %PlotParam=read_plot_param(PlotHandles);768 759 fighandle=get(plotaxes,'parent'); 769 760 PlotParam=read_GUI(fighandle); 770 [PlotType,Object_out{IndexObj }.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot761 [PlotType,Object_out{IndexObj(end)}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot 771 762 772 763 %% update the GUI uvmat … … 775 766 set(hhuvmat.edit_object,'Value',1) % set uvmat to object edit mode to allow further object update 776 767 set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow 777 %UvData.MouseAction='edit_object'; % set the edit button to 'on'778 768 779 769 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.