source: trunk/src/update_obj.m @ 67

Last change on this file since 67 was 67, checked in by sommeria, 14 years ago

civ: RUN civ lounched out of the Matlab work space. RUN and BATCH now runned by a unique sub-function lounch.m.
FiLE PARAM.xml modified to provide different paths for Batch and Run !!!!!
RUN_FIX: minor error message modif
geometry_calib: calib point editing by the mouse
improvement of the interactions between the different GUIs. Close function...

File size: 3.6 KB
[8]1%'update_obj': update the object graph representation and its projection field, record it in the uvmat interface
6%UvData: data to be stored as 'Userdata' on the uvmat interface
7%IndexObj: object index for a new object added to the list in UvData
8%   the function updates UvData.Object{IndexObj}, and possibly adds a new plot (UvData.Plane or Line) in the list atached to the interface
11%UvIn: structure stored as 'Userdata' on the uvmat interface
12%IndexObjIn: object index for an existing objects stored in UvData
13%ObjectData: structure containing the input object properties
14%PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat interface (obtained by get_plot_handles.m)
17function Object_out=update_obj(UvData,IndexObj,ObjectData,PlotHandles)
19%default input and output
21if  isfield(UvData,'Object')
22    Object_set=UvData.Object;
24    Object_set={};%create the object
27% object representation in the different projected field plots
28for iview=1:length(Object_set) %loop on projection planes iview
29      if isfield(Object_set{iview},'plotaxes')
[67]30         haxes=Object_set{iview}.plotaxes% axes for the field plot
[8]31         if ishandle(haxes) & isequal(get(haxes,'Type'),'axes')% update the representation of the object IndexObj on this axes if it exists
32             testupdate=0;
33             HandlesDisplay=[];%default
34             if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'HandlesDisplay')
35                 HandlesDisplay=Object_set{IndexObj}.HandlesDisplay;%list of handles of object representations
36             end
37             hplot_list=findobj(haxes,'Tag','proj_object');
38             for ih=1:length(HandlesDisplay)
39                 plot_detect=find(hplot_list==HandlesDisplay(ih));
40                 if ~isempty(plot_detect)
41                     Object_out.HandlesDisplay(ih)=plot_object(ObjectData,Object_set{iview},HandlesDisplay(ih),'m');%update the the object representation
42                     testupdate=1;
43                     break
44                 end
45             end
46             if ~testupdate% draw new object plot
47                hh=plot_object(ObjectData,Object_set{iview},haxes,'m');%draw the object with the new object data
48                Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh];
49                PlotData=get(hh,'UserData');
50                PlotData.IndexObj=IndexObj;
51                set(hh,'UserData',PlotData); %record the object index in the graph
52             end
53         end
54      end
56% plot the field projected on the object
57if ~isempty(PlotHandles) %&& ~testmask
58    ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData
59    if ~isempty(ProjData)   
60        plotaxes=[];%default
61        if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'plotaxes')
62            plotaxes=Object_set{IndexObj}.plotaxes;
[60]63            [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);
64        else
65             [plotaxes]=view_field(ProjData);
[8]66        end
[60]67%         [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);
[8]68        Object_out.plotaxes=plotaxes;
69        plotfig=get(plotaxes,'parent');
70        name_str=get(plotfig,'Name');
71        if ~isequal(name_str,'uvmat')
[47]72            set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]);
[8]73        end
74    end
Note: See TracBrowser for help on using the repository browser.