'update_obj': update the object graph representation and its projection field, record it in the uvmat interface ------------------------------------------------------------------- Object=update_obj(UvData,IndexObj,ObjectData,PlotHandles); OUTPUT: UvData: data to be stored as 'Userdata' on the uvmat interface IndexObj: object index for a new object added to the list in UvData the function updates UvData.Object{IndexObj}, and possibly adds a new plot (UvData.Plane or Line) in the list atached to the interface INPUT: UvIn: structure stored as 'Userdata' on the uvmat interface IndexObjIn: object index for an existing objects stored in UvData ObjectData: structure containing the input object properties PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat interface (obtained by get_plot_handles.m) -------------------------------------
0001 %'update_obj': update the object graph representation and its projection field, record it in the uvmat interface 0002 %------------------------------------------------------------------- 0003 %Object=update_obj(UvData,IndexObj,ObjectData,PlotHandles); 0004 % 0005 %OUTPUT: 0006 %UvData: data to be stored as 'Userdata' on the uvmat interface 0007 %IndexObj: object index for a new object added to the list in UvData 0008 % the function updates UvData.Object{IndexObj}, and possibly adds a new plot (UvData.Plane or Line) in the list atached to the interface 0009 % 0010 %INPUT: 0011 %UvIn: structure stored as 'Userdata' on the uvmat interface 0012 %IndexObjIn: object index for an existing objects stored in UvData 0013 %ObjectData: structure containing the input object properties 0014 %PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat interface (obtained by get_plot_handles.m) 0015 %------------------------------------- 0016 0017 function Object_out=update_obj(UvData,IndexObj,ObjectData,PlotHandles) 0018 0019 %default input and output 0020 Object_out=ObjectData;%default 0021 if isfield(UvData,'Object') 0022 Object_set=UvData.Object; 0023 else 0024 Object_set={};%create the object 0025 end 0026 0027 % object representation in the different projected field plots 0028 for iview=1:length(Object_set) %loop on projection planes iview 0029 if isfield(Object_set{iview},'plotaxes') 0030 haxes=Object_set{iview}.plotaxes;% axes for the field plot 0031 if ishandle(haxes) & isequal(get(haxes,'Type'),'axes')% update the representation of the object IndexObj on this axes if it exists 0032 testupdate=0; 0033 HandlesDisplay=[];%default 0034 if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'HandlesDisplay') 0035 HandlesDisplay=Object_set{IndexObj}.HandlesDisplay;%list of handles of object representations 0036 end 0037 hplot_list=findobj(haxes,'Tag','proj_object'); 0038 for ih=1:length(HandlesDisplay) 0039 plot_detect=find(hplot_list==HandlesDisplay(ih)); 0040 if ~isempty(plot_detect) 0041 Object_out.HandlesDisplay(ih)=plot_object(ObjectData,Object_set{iview},HandlesDisplay(ih),'m');%update the the object representation 0042 testupdate=1; 0043 break 0044 end 0045 end 0046 if ~testupdate% draw new object plot 0047 hh=plot_object(ObjectData,Object_set{iview},haxes,'m');%draw the object with the new object data 0048 Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh]; 0049 PlotData=get(hh,'UserData'); 0050 PlotData.IndexObj=IndexObj; 0051 set(hh,'UserData',PlotData); %record the object index in the graph 0052 end 0053 end 0054 end 0055 end 0056 0057 % plot the field projected on the object 0058 if ~isempty(PlotHandles) %&& ~testmask 0059 ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData 0060 if ~isempty(ProjData) 0061 plotaxes=[];%default 0062 if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'plotaxes') 0063 plotaxes=Object_set{IndexObj}.plotaxes; 0064 end 0065 [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles); 0066 Object_out.plotaxes=plotaxes; 0067 plotfig=get(plotaxes,'parent'); 0068 name_str=get(plotfig,'Name'); 0069 if ~isequal(name_str,'uvmat') 0070 set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' set_title(ObjectData.Style,ObjectData.ProjMode)]); 0071 end 0072 end 0073 end 0074 0075