source: trunk/src/update_obj.m @ 85

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

mouse_up: improve zoom : keep the selected point at the same place on the graph
plot_field: memorize the max coordiantes on the graph (AxeData?) for zoom out
set_object: input possibilities extende to restrict menu (for mask objects)
uvmat: improvement of mask creation
civ: select mask option for civ2 when select(ed for civ1

File size: 4.1 KB
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%UvData: structure stored as 'Userdata' on the uvmat interface, it contains
12%    .Object{1},{2}... description of all the projection objects
13%    .Object{iview}.plotaxes: axes for the plot of the field projected on this object
14%    .Object{iview}.HandlesDisplay(ih): array of handles for plots representing the object #iview in the field #ih
15%IndexObjIn: object index for an existing objects stored in UvData
16%ObjectData: structure containing the input object properties
17%       .Style: style of the object: 'line', 'rectangle'...
18%PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat or view_field interface
21function Object_out=update_obj(UvData,IndexObj,ObjectData,PlotHandles)
23%default input and output
25if  isfield(UvData,'Object')
26    Object_set=UvData.Object;
28    Object_set={};%create the object
31% object representation in the different projected field plots
32for iview=1:length(Object_set) %loop on projection planes iview
33      if isfield(Object_set{iview},'plotaxes')
34         haxes=Object_set{iview}.plotaxes% axes for the field plot
35         if ishandle(haxes) & isequal(get(haxes,'Type'),'axes')% update the representation of the object IndexObj on this axes if it exists
36             testupdate=0;
37             HandlesDisplay=[];%default
38             if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'HandlesDisplay')
39                 HandlesDisplay=Object_set{IndexObj}.HandlesDisplay;%list of handles of object representations
40             end
41             hplot_list=findobj(haxes,'Tag','proj_object');%list of projection objects on the axes
42             for ih=1:length(HandlesDisplay)
43                 plot_detect=find(hplot_list==HandlesDisplay(ih));
44                 if ~isempty(plot_detect)
45                     Object_out.HandlesDisplay(ih)=plot_object(ObjectData,Object_set{iview},HandlesDisplay(ih),'m');%update the the object representation
46                     testupdate=1;
47                     break
48                 end
49             end
50             if ~testupdate% draw new object plot
51                hh=plot_object(ObjectData,Object_set{iview},haxes,'m');%draw the object with the new object data
52                if isfield(Object_out,'HandlesDisplay')
53                    Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh];
54                else
55                    Object_out.HandlesDisplay=hh;
56                end
57                PlotData=get(hh,'UserData');
58                PlotData.IndexObj=IndexObj;
59                set(hh,'UserData',PlotData); %record the object index in the graph
60             end
61         end
62      end
65% plot the field projected on the object
66ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData
67if ~isempty(ProjData)   
68    plotaxes=[];%default
69%         get(Object_set{IndexObj}.plotaxes)
70    if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'plotaxes')
71        plotaxes=Object_set{IndexObj}.plotaxes;
72        [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);
73    else
74         [plotaxes]=view_field(ProjData);
75    end
76%         [PlotType,Object_out.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);
77    Object_out.plotaxes=plotaxes;
78    plotfig=get(plotaxes,'parent');
79    name_str=get(plotfig,'Name');
80    if ~isequal(name_str,'uvmat')
81        set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]);
82    end
Note: See TracBrowser for help on using the repository browser.