Index: /trunk/src/check_files.m
===================================================================
--- /trunk/src/check_files.m	(revision 431)
+++ /trunk/src/check_files.m	(revision 432)
@@ -108,5 +108,4 @@
     'translate_points.fig';...
     'update_imadoc';...  %update the ImaDoc xml file
-    'update_obj';... update the object representation graph and its projection field, record it in the uvmat interface
     'update_waitbar';... update the waitbar display, used for ACTION functions in the GUI 'series'
     'uvmat';...% master function for file scanning and visualisation of 2D fields
Index: /trunk/src/mouse_down.m
===================================================================
--- /trunk/src/mouse_down.m	(revision 431)
+++ /trunk/src/mouse_down.m	(revision 432)
@@ -311,6 +311,6 @@
         ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object
         IndexObj=length(UvData.Object);
-        %initiate a new object
-        if isempty(UvData.Object{IndexObj});
+        %initiate a new object (no data .Coord yet recorded)
+        if ~isfield(UvData.Object{IndexObj},'Coord');
             ObjectData.Coord=[];
             ObjectNameNew=ObjectData.Name;
@@ -318,7 +318,5 @@
                 ObjectNameNew=ObjectData.Type;
             end
-            % add an index to the object name if the proposed name already exists
-            
-            
+            % add an index to the object name if the proposed name already exists          
             vers=0;% index of the name
             ListObject=get(hhuvmat.ListObject,'String');
@@ -345,29 +343,14 @@
             set(hhuvmat.ViewObject,'Value',1)
         end
-        % ObjectData.Coord=[]; %reset previous object coordinates
-        %         ObjectData.Coord(1,1)=xy(1,1); % the object first coordinate is set by the mouse position
-        %         ObjectData.Coord(1,2)=xy(1,2);
-        %         if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
-        %             ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle
-        %         end
         ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
-        %                 if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
-        %                     xy(1,3)=AxeData.ObjectCoord(1,3); % z coordinate of the mouse: to generalise ...
-        %                 else
-        %                     xy(1,3)=0; % z coordinate set to 0 by default
-        %                 end
-        %                 if ~isequal(ObjectData.Coord,xy(1,:))
-        %                     ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
-        %                 end
-        
-        AxeData.CurrentObject=plot_object(ObjectData,[],haxes,'m');%draw the object and its handle becomes AxeData.CurrentObject
-        %         if isfield(UvData,'Object')
-        %             IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface
-        %         else
-        %             IndexObj=2;% the first object is used for uvmat display or blank
-        %         end
+        hobject=UvData.Object{IndexObj}.DisplayHandle.(fig_tag);
+        if isempty(hobject)
+            hobject=haxes;
+        end
+        ProjObject=UvData.Object{get(hhuvmat.ListObject_1,'Value')};
+        AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject
         UvData.Object{IndexObj}=ObjectData;      
-        UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject;      
-        UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject;
+        UvData.Object{IndexObj}.DisplayHandle.(fig_tag)=AxeData.CurrentObject;% attribute the current plot object handle to the Object      
+        %UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject;
         set(huvmat,'UserData',UvData)
         PlotData=get(AxeData.CurrentObject,'UserData');
Index: /trunk/src/mouse_motion.m
===================================================================
--- /trunk/src/mouse_motion.m	(revision 431)
+++ /trunk/src/mouse_motion.m	(revision 432)
@@ -29,12 +29,11 @@
 end
 FigData=get(hObject,'UserData');
-
 if ishandle(FigData)% case of a zoom plot, the handle of the parent rectangle is stored in UserData, its parent is the plotting axes of the rectangle
-    currentfig=get(get(FigData,'parent'),'parent');
+    CurrentFig=get(get(FigData,'parent'),'parent');
 else
-    currentfig=hObject;%usual plot
-end
-hhcurrentfig=guidata(currentfig);
-test_zoom=get(hhcurrentfig.CheckZoom,'Value');%test for zoom activated on the current figure
+    CurrentFig=hObject;%usual plot
+end
+hhCurrentFig=guidata(CurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)
+test_zoom=get(hhCurrentFig.CheckZoom,'Value');%test for zoom activated on the current figure
 test_draw=0;%test for mouse drawing of object, =0 by default
 test_object=0; %test for object editing or creation 
@@ -42,8 +41,7 @@
 test_zoom_draw=0; % test for zoom drawing 
 test_ruler=0;%test for active ruler 
-% test_piv=0;% test for PIV correlation display
 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle
 if ~isempty(huvmat)
-    hhuvmat=guidata(huvmat);
+    hhuvmat=guidata(huvmat);%handles of the elements in uvma
     test_edit_object=get(hhuvmat.edit_object,'Value');
     test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');
@@ -59,5 +57,5 @@
 end
 
-%find the current axe 'haxes' and display the current mouse position or uicontrol tag
+%find the current axe 'CurrentAxes' and display the current mouse position or uicontrol tag
 text_displ_1='';
 text_displ_2='';
@@ -74,6 +72,6 @@
 hchild=get(hObject,'Children');%handles of all objects in the current figure
 
-%% loop on all the objects in the current figure and detect whether the mouse is over a plot  axes
-haxes=[];
+%% loop on all the objects in the current figure, detect whether the mouse is over a plot  axes
+CurrentAxes=[];
 for ichild=1:length(hchild)
     obj_pos=get(hchild(ichild),'Position');
@@ -85,7 +83,7 @@
         %if the mouse is over an axis, look at the data
         if strcmp(htype,'axes')
-            haxes=hchild(ichild);
-            xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
-            AxeData=get(haxes,'UserData');% data attached to the axis
+            CurrentAxes=hchild(ichild);
+            xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
+            AxeData=get(CurrentAxes,'UserData');% data attached to the axis
             if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing)
                 test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active
@@ -96,6 +94,6 @@
                 pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis)
             end
-            FigData=get(currentfig,'UserData');
-            tagaxes=get(haxes,'tag');
+            FigData=get(CurrentFig,'UserData');
+            tagaxes=get(CurrentAxes,'tag');
             if isfield(FigData,tagaxes)
                 eval(['Field=FigData.' tagaxes ';'])
@@ -117,5 +115,5 @@
                                     (Y<(xy(1,2)+Field.Mesh/3) & Y>(xy(1,2)-Field.Mesh/3));%f
                                 ivec=find(flag_vec,1);% search the (first) selected vector index ivec
-                                hhh=findobj(haxes,'Tag','vector_marker');
+                                hhh=findobj(CurrentAxes,'Tag','vector_marker');
                                 if ~isempty(ivec)
                                     % mark the vectors with a circle in the absence of other operations
@@ -123,6 +121,6 @@
                                         pointershape='arrow'; %mouse indicates  the detection of a vector
                                         if isempty(hhh)
-                                            set(0,'CurrentFigure',currentfig)
-                                            set(currentfig,'CurrentAxes',haxes)
+                                            set(0,'CurrentFigure',CurrentFig)
+                                            set(CurrentFig,'CurrentAxes',CurrentAxes)
                                             rectangle('Curvature',[1 1],...
                                                 'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh],'EdgeColor','m',...
@@ -226,9 +224,9 @@
                         shiftx=par.Shiftx;
                         shifty=par.Shifty;     
-                        hhh=findobj(haxes,'Tag','PIV_box_marker');
-                        hhhh=findobj(haxes,'Tag','PIV_search_marker');
+                        hhh=findobj(CurrentAxes,'Tag','PIV_box_marker');
+                        hhhh=findobj(CurrentAxes,'Tag','PIV_search_marker');
                         if isempty(hhh)
-                            set(0,'CurrentFigure',currentfig)
-                            set(currentfig,'CurrentAxes',haxes)
+                            set(0,'CurrentFigure',CurrentFig)
+                            set(CurrentFig,'CurrentAxes',CurrentAxes)
                             rectangle('Curvature',[0 0],...
                                 'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2],'EdgeColor','m',...
@@ -264,5 +262,5 @@
                                    AxeData.TitleHandle=title(num2str(par.Grid));
                                     colorbar
-                                    set(haxes,'UserData',AxeData)
+                                    set(CurrentAxes,'UserData',AxeData)
                                     set(get(AxeData.CurrentCorrImage,'parent'),'YDir','normal')
                                 end
@@ -301,5 +299,5 @@
             else
                 AxeData.CurrentRectZoom=rectangle('Position',rect,'LineStyle',':','Tag','rect_zoom');
-                set(haxes,'UserData',AxeData)
+                set(CurrentAxes,'UserData',AxeData)
             end
         end
@@ -311,51 +309,54 @@
 %% create or modify an object
 if ~isempty(huvmat) && test_object
+    UvData=get(huvmat,'UserData');
     PlotData=get(AxeData.CurrentObject,'UserData');
-    huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle
-    if ~isempty(huvmat)
-        UvData=get(huvmat,'UserData');
-        if ~isfield(PlotData,'IndexObj')
-             return
+    if ~isfield(PlotData,'IndexObj')
+        return
+    end
+    ObjectData=UvData.Object{PlotData.IndexObj};
+    ProjObject=[];% object (plane) whose projection is represented on the current axes
+    if isequal(hObject,huvmat)% if the mouse ifs over the GUI uvmat
+        ProjObject=UvData.Object{get(hhuvmat.ListObject_1,'Value')};
+    else
+        ProjObject=UvData.Object{get(hhuvmat.ListObject,'Value')};
+    end
+    XYData=AxeData.CurrentOrigin;
+    if isequal(AxeData.Drawing,'create') && isfield(AxeData,'CurrentOrigin') && ~isempty(AxeData.CurrentOrigin)
+        if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points')
+            ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];
+            % ObjectData.Coord(end,:)=xy(1,:);
+        elseif strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')||strcmp(ObjectData.Type,'volume')
+            ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
+            ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
+            ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
+            ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
+        elseif isequal(ObjectData.Type,'plane') %case of 'plane'
+            DX=(xy(1,1)-ObjectData.Coord(1,1));
+            DY=(xy(1,2)-ObjectData.Coord(1,2));
+            ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle widt
+            if isfield(ObjectData,'RangeX')
+                XMax=sqrt(DX*DX+DY*DY);
+                if XMax>max(ObjectData.RangeX)
+                    ObjectData.RangeX=[min(ObjectData.RangeX) XMax];
+                end
+            end
         end
-        ObjectData=UvData.Object{PlotData.IndexObj};
-        XYData=AxeData.CurrentOrigin;
-        if isequal(AxeData.Drawing,'create') && isfield(AxeData,'CurrentOrigin') && ~isempty(AxeData.CurrentOrigin)
-           if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points')
-              ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];
-             % ObjectData.Coord(end,:)=xy(1,:);
-           elseif strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')||strcmp(ObjectData.Type,'volume')
-              ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
-              ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
-              ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
-              ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
-           elseif isequal(ObjectData.Type,'plane') %case of 'plane'
-                DX=(xy(1,1)-ObjectData.Coord(1,1));
-                DY=(xy(1,2)-ObjectData.Coord(1,2));
-                ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle widt
-                if isfield(ObjectData,'RangeX')
-                    XMax=sqrt(DX*DX+DY*DY);
-                    if XMax>max(ObjectData.RangeX)
-                        ObjectData.RangeX=[min(ObjectData.RangeX) XMax];
-                    end
-                end
-           end
-            plot_object(ObjectData,[],AxeData.CurrentObject,'m');
-            pointershape='crosshair';
-        elseif  isequal(AxeData.Drawing,'translate')
-            DX=xy(1,1)-XYData(1);%translation from initial position
-            DY=xy(1,2)-XYData(2);
-            ObjectData.Coord(:,1)=ObjectData.Coord(:,1)+DX;
-            ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY;
-            plot_object(ObjectData,[],AxeData.CurrentObject,'m');
-            pointershape='fleur';
-        elseif  isequal(AxeData.Drawing,'deform')
-            ind_move=AxeData.CurrentIndex;
-            ObjectData.Coord(ind_move,1)=xy(1,1);
-            ObjectData.Coord(ind_move,2)=xy(1,2);
-            plot_object(ObjectData,[],AxeData.CurrentObject,'m');
-            pointershape='circle';
-        end
-    end
-end    
+        plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m');
+        pointershape='crosshair';
+    elseif  isequal(AxeData.Drawing,'translate')
+        DX=xy(1,1)-XYData(1);%translation from initial position
+        DY=xy(1,2)-XYData(2);
+        ObjectData.Coord(:,1)=ObjectData.Coord(:,1)+DX;
+        ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY;
+        plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m');
+        pointershape='fleur';
+    elseif  isequal(AxeData.Drawing,'deform')
+        ind_move=AxeData.CurrentIndex;
+        ObjectData.Coord(ind_move,1)=xy(1,1);
+        ObjectData.Coord(ind_move,2)=xy(1,2);
+        plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m');
+        pointershape='circle';
+    end
+end
 
 %% detect calibration points if the GUI geometry_calib is opened
@@ -371,9 +372,9 @@
             XCoord=(data.Coord(:,4));
             YCoord=(data.Coord(:,5));
-            xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
+            xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
             if ~isempty(xy)
-                xlim=get(haxes,'XLim');
+                xlim=get(CurrentAxes,'XLim');
                 ind_range_x=abs((xlim(2)-xlim(1))/50);
-                ylim=get(haxes,'YLim');
+                ylim=get(CurrentAxes,'YLim');
                 ind_range_y=abs((ylim(2)-ylim(1))/50);
                 ind_range=sqrt(ind_range_x*ind_range_y);
@@ -414,3 +415,3 @@
 
 %% update the mouse pointer
-set(currentfig,'Pointer',pointershape);
+set(CurrentFig,'Pointer',pointershape);
Index: /trunk/src/mouse_up.m
===================================================================
--- /trunk/src/mouse_up.m	(revision 431)
+++ /trunk/src/mouse_up.m	(revision 432)
@@ -59,5 +59,5 @@
     PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object  
     IndexObj=PlotData.IndexObj;
-    ObjectData=UvData.Object{IndexObj};    
+    ObjectData=UvData.Object{IndexObj};   
 %     ObjectData.enable_plot=1;
     if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
@@ -139,11 +139,11 @@
 
             %% update the object representation
-            ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat;
-            ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field;
-            UvData.Object{IndexObj}=ObjectData;%update the current object properties
-            hhuvmat=guidata(huvmat);
-            IndexObj_1=get(hhuvmat.ListObject_1,'Value');
-            IndexObj_2=get(hhuvmat.ListObject,'Value');
-            UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2);
+%             ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat;
+%             ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field;
+%             UvData.Object{IndexObj}=ObjectData;%update the current object properties
+%             hhuvmat=guidata(huvmat);
+%             IndexObj_1=get(hhuvmat.ListObject_1,'Value');
+%             IndexObj_2=get(hhuvmat.ListObject,'Value');
+%             UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2);
 
             %% plot the field projected on the object 
@@ -199,9 +199,9 @@
             set(hhuvmat.MenuEdit,'Enable','on');%
         end
-    else
+    end    
        AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the new current origin
        test_drawing=1;%allow continuation of drawing object
        UvData.Object{IndexObj}=ObjectData;
-    end
+%     end
     hother=findobj('Tag','deformpoint');%find all the deformpoints
     set(hother,'Color','b');%reset all the deformpoints in 'blue' 
Index: /trunk/src/plot_object.m
===================================================================
--- /trunk/src/plot_object.m	(revision 431)
+++ /trunk/src/plot_object.m	(revision 432)
@@ -1,5 +1,5 @@
 %'plot_object': draws a projection object (points, line, plane...)
 %-------------------------------------------------------------------
-% function [ObjectData_out,hh]=plot_object(ObjectData,hplot,col)
+% function hh=plot_object(ObjectData,ProjObject,hplot,col)
 %
 %OUTPUT
@@ -8,5 +8,5 @@
 %INPUT:
 %
-% ObjectDataIn: structure representing the object properties:
+% ObjectData: structure representing the object properties:
 %        .Type : style of projection object
 %        .Coord: set of coordinates defining the object position;
@@ -36,24 +36,21 @@
 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 
-function [hh]=plot_object(ObjectDataIn,ProjObject,hplot,col)
+function [hh]=plot_object(ObjectData,ProjObject,hplot,col)
+
 %% default output
 hh=[];%default output
-if ~isfield(ObjectDataIn,'Type')|| isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot
-    return
-end
-if ~isfield(ProjObject,'Type') 
-    ObjectData=ObjectDataIn;
-elseif isequal(ProjObject.Type,'plane')
-    ObjectData=ObjectDataIn;% TODO: modify take into account rotation of axis
-else
-    return % object representation only  available in a plane
-end
-if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type)
-    msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m')
-    return
-end
-if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type)
-    msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m')
-    return
+% object representation is canceled if the field is not projected on a plane or is the same as the represented object 
+if ~isfield(ObjectData,'Type')|| isequal(ProjObject,ObjectData)|| ~strcmp(ProjObject.Type,'plane')
+    if ~isempty(hplot) && ishandle(hplot) && ~strcmp(get(hplot,'Type'),'axes')
+        ObjectPlotData=get(hplot,'UserData');
+        if isfield(ObjectPlotData,'SubObject') & ishandle(ObjectPlotData.SubObject)
+            delete(ObjectPlotData.SubObject);
+        end
+        if isfield(ObjectPlotData,'DeformPoint') & ishandle(ObjectPlotData.DeformPoint)
+            delete(ObjectPlotData.DeformPoint);
+        end
+        delete(hplot)
+    end
+    return 
 end
 XMin=0;%default
@@ -74,7 +71,4 @@
         haxes=hplot;
         currentfig=get(hplot,'parent');
-%         set(0,'CurrentFigure',currentfig)
-      
-%         set(currentfig,'CurrentAxes',haxes);
     elseif isequal(get(hplot,'Type'),'figure')% hplot is the handle of a figure 
         set(0,'CurrentFigure',hplot);%set the input figure as the current one
@@ -82,5 +76,4 @@
         haxes=haxes(1);
         currentfig=hplot;
-       % set(hplot,'CurrentAxes',haxes);%set the first found axis as the current one
     else
         currentfig=figure; %create new figure
@@ -103,18 +96,4 @@
      ObjectData.Coord=[0 0 0];%default
 end
-% if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi)
-%      ObjectData.Phi=0;%default
-% end
-% if ~isfield(ObjectData,'Range')
-%     ObjectData.Range(1,1)=0; %edfault
-% end
-% if size(ObjectData.Range,2)>=2
-%     YMax=ObjectData.Range(1,2);%default
-% end
-% if size(ObjectData.Range,2)>=2 & size(ObjectData.Range,1)>=2
-%     YMin=ObjectData.Range(2,2);
-% else
-%     YMin=0;
-% end
 if isfield(ObjectData,'RangeX') && ~isempty(ObjectData.RangeX)
     XMax=max(ObjectData.RangeX);
Index: /trunk/src/set_object.m
===================================================================
--- /trunk/src/set_object.m	(revision 431)
+++ /trunk/src/set_object.m	(revision 432)
@@ -414,5 +414,5 @@
 
 %------------------------------------------------------------------------
-% --- Executes on button press in PLOT: PLOT the defined object and its projected field
+% --- Executes on button press in PLOT: refresh the current object , plot the object and its projected field
 function PLOT_Callback(hObject, eventdata, handles)
 
@@ -430,16 +430,13 @@
 ObjectName=ObjectData.Name;%name of the current object defined in set_object
 if isempty(ObjectName)
-     ObjectName=ObjectData.Type;
-end
-
-%% read the object selection in the GUI uvmat
+     ObjectName=ObjectData.Type;% name the object by the object type type by default
+end
+
+%% read the current object selection in the GUI uvmat
 huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle
 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 
 hhuvmat=guidata(huvmat);%handles of the objects children of the  GUI uvmat
-ListObject=get(hhuvmat.ListObject_1,'String');% list of objects displayed in uvmat
-IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat
-if get(hhuvmat.ViewObject,'Value') && get(hhuvmat.edit_object,'Value')
-    IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field 
-end
+ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat
+IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat
 if ~get(hhuvmat.edit_object,'Value') %new object is being created
     detectname=1;
@@ -461,35 +458,15 @@
     ObjectName=ObjectNameNew;
     set(handles.Name,'String',ObjectName)% display the default name in set_object
-    IndexObj(2)=numel(ListObject)+1;% append an object to the list in uvmat
+    IndexObj=numel(ListObject)+1;% append an object to the list in uvmat
     set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
     set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list
-    set(hhuvmat.ListObject,'Value',IndexObj(2))
+    set(hhuvmat.ListObject,'Value',IndexObj)
     set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object
-    UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet)
-end
-
-%% naming the object
-% ListObject{IndexObj(end),1}=ObjectName;
-% set(hhuvmat.ListObject,'String',ListObject)
-% set(hhuvmat.ListObject_1,'String',ListObject)
-
-%% update the object plot 
-if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles
-    ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat;
-else
-    ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input
-end
-if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles
-    ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field;
-else
-    ObjectData.DisplayHandle_view_field=[];
-end
-UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties
-if numel(IndexObj)==2
-    UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
-end
-set(huvmat,'UserData',UvData)
+    UvData.Object{IndexObj}=[];%initiate a new object (empty yet)
+    UvData.Object{IndexObj}.DisplayHandle.uvmat=hhuvmat.axes3; %axes taken as object display handle by defualt
+end
 
 %% plot the field projected on the object
+hview_field=[];%default
 if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none')
     PlotType='text';
@@ -500,5 +477,6 @@
         return
     end   
-    if numel(IndexObj)==1   % if only one object is selected, the projection is in uvmat
+    IndexObj_1=get(hhuvmat.ListObject_1,'Value')
+    if isequal(IndexObj_1,IndexObj) % if only one object is selected, the projection is in uvmat
         PlotType=plot_field(ProjData,hhuvmat.axes3,read_GUI(get(hhuvmat.axes3,'parent')));%update the current uvmat plot
     else  % if a second object is selected, the projection is in view_field, and this second object is selected
@@ -525,4 +503,34 @@
     end
 end
+
+%% update the object plot 
+% if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle')% save the previous object graph handles
+%     ObjectData.DisplayHandle.uvmat=UvData.Object{IndexObj(end)}.DisplayHandle.uvmat;
+% else
+%     ObjectData.DisplayHandle.uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input
+% end
+% if isfield(UvData.Object{IndexObj},'DisplayHandle')% save the previous object graph handles
+%     ObjectData.DisplayHandle.view_field=UvData.Object{IndexObj(end)}.DisplayHandle.view_field;
+% else
+%     ObjectData.DisplayHandle.view_field=[];
+% end
+% UvData.Object{IndexObj}=ObjectData;%update the current object properties
+% if numel(IndexObj)==2
+hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat;
+if isempty(hobject)
+    hobject=hhuvmat.axes3;
+end
+UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(ObjectData,[],hobject,'m');%draw the object in uvmat
+if ~isempty(hview_field)
+    if isfield(UvData.Object{IndexObj}.DisplayHandle,'view_field')
+    hobject=UvData.Object{IndexObj}.DisplayHandle.view_field;
+    end
+    if isempty(hobject)
+        hobject=haxes;
+    end
+    UvData.Object{IndexObj}.DisplayHandle.view_field=plot_object(ObjectData,[],hobject,'m');%draw the object in view_field
+    %     UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
+end
+set(huvmat,'UserData',UvData)
 
 %% update the GUI uvmat
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 431)
+++ /trunk/src/uvmat.m	(revision 432)
@@ -237,5 +237,7 @@
 
 %% refresh projection plane
-UvData.Object{1}.ProjMode='projection';%main plotting plane
+% UvData.Object{1}.ProjMode='projection';%main plotting plane
+% UvData.Object{1}.DisplayHandle.uvmat=handles.axes3;
+% UvData.Object{1}.DisplayHandle.view_field=[];
 set(handles.ListObject,'Value',1)% default: empty projection objectproj_field
 set(handles.ListObject,'String',{'plane'})
@@ -2510,5 +2512,8 @@
     UvData.Field.Mesh=ord;
 end
-
+        UvData.Object{1}.Type='plane';%main plotting plane
+        UvData.Object{1}.ProjMode='projection';%main plotting plane
+        UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
+        UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
 
 %% 3D case (menuvolume)
@@ -2523,7 +2528,8 @@
     if test_set_object% reinitiate the GUI set_object
         delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.ListObject and 2
-        UvData.Object{1}.Type='plane';%main plotting plane
-        UvData.Object{1}.ProjMode='projection';%main plotting plane
-        UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
+%         UvData.Object{1}.Type='plane';%main plotting plane
+%         UvData.Object{1}.ProjMode='projection';%main plotting plane
+%         UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
+%         UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
         UvData.Object{1}.NbDim=NbDim;%test for 3D objects
         UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane
@@ -3985,12 +3991,26 @@
 % --- Executes on selection change in ListObject_1.
 function ListObject_1_Callback(hObject, eventdata, handles)
-list_str=get(handles.ListObject_1,'String');
+list_str=get(handles.ListObject,'String');
 UvData=get(handles.uvmat,'UserData');
 ObjectData=UvData.Object{get(handles.ListObject_1,'Value')};
 
 %% update the projection plot on uvmat
-ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on UvData.Object{IndexObj(1)}
-plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));%read plotting parameters on the uvmat interfacPlotHandles);
-Object_out=update_obj(UvData,get(handles.ListObject_1,'Value'),[]);
+ProjData= proj_field(UvData.Field,ObjectData);%project the current input field on object ObjectData
+plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));% plot the projected field;
+%replot all the objects within the new projected field
+for IndexObj=1:numel(list_str)
+    IndexObj
+        hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat
+        if isempty(hobject) || ~ishandle(hobject)
+            hobject=handles.axes3
+        end
+        if isequal(IndexObj,get(handles.ListObject,'Value'))
+            objectcolor='m'; %paint in magenta the currently selected object in ListObject
+        else
+            objectcolor='b';
+        end
+        UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(UvData.Object{IndexObj},ObjectData,hobject,objectcolor);%draw the object in uvmat      
+end
+set(handles.uvmat,'UserData',UvData)
 
 %% display the object parameters if the GUI set_object is already opened
@@ -4005,4 +4025,5 @@
     set(handles.ViewObject,'Value',1)% show that the selected object in ListObject_1 is currently visualised
 end
+
 %  desactivate the edit object mode
 set(handles.edit_object,'Value',0) 
@@ -4059,6 +4080,5 @@
 
 %% update the color of the graphic object representation: the selected object in magenta, others in blue
-update_object_color(handles.axes3,hhview_field.axes3,UvData.Object{IndexObj(end)}.DisplayHandle_uvmat)
-hview_field=findobj(allchild(0),'tag','view_field');
+update_object_color(handles.axes3,hhview_field.axes3,UvData.Object{IndexObj}.DisplayHandle.uvmat)
 
 %------------------------------------------------------------------------
@@ -4087,5 +4107,5 @@
     set(hother(iobj),'Selected','off')
 end
-if ~isempty(DisplayHandle)
+if ishandle(DisplayHandle)
     linetype=get(DisplayHandle,'Type');
     if isequal(linetype,'line')
@@ -4257,5 +4277,5 @@
     else
         Data=get(hview_field,'UserData');
-        set(hview_field,'Position',Data.GUISize)
+        set(hview_field,'Position',Data.GUISize)% restore the size of view_field for plots
     end
 else
@@ -4513,4 +4533,6 @@
 UvData=get(handles.uvmat,'UserData');
 UvData.Object{IndexObj}=[]; %create a new empty object
+UvData.Object{IndexObj}.DisplayHandle.uvmat=handles.axes3; % axes for plot_object
+UvData.Object{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
 data.Name=data.Type;% default name=type
 data.Coord=[0 0]; %default
@@ -4568,4 +4590,9 @@
     set(handles.ListObject,'String',ListObject)
 end
+UvData=get(handles.uvmat,'UserData');
+UvData.Object{IndexObj}=[]; %create a new empty object
+UvData.Object{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation
+UvData.Object{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
+set(handles.uvmat,'UserData',UvData)
 set(handles.ListObject,'Value',length(ListObject))
 hset_object=set_object(data);% call the set_object interface
@@ -4574,4 +4601,5 @@
 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])  
 set(handles.delete_object,'Visible','on')
+
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Index: /trunk/src/view_field.m
===================================================================
--- /trunk/src/view_field.m	(revision 431)
+++ /trunk/src/view_field.m	(revision 432)
@@ -64,27 +64,9 @@
 guidata(hObject, handles);
 
-dircur=pwd; %current working directory
-dir_opening=dircur;
-
-% set the position of colorbar and ancillary GUIs:
-set(hObject,'Units','Normalized')
-handles_mouse=handles;
-huvmat=findobj(allchild(0),'Name','uvmat');
-if ~isempty(huvmat)
-    hhuvmat=guidata(huvmat);
-    handles_mouse.edit=hhuvmat.edit_object;
-    pos_view_field=get(hObject,'Position');
-    pos_uvmat=get(huvmat,'Position');
-    pos_view_field(1)=pos_uvmat(1)+pos_uvmat(3)/2;
-    pos_view_field(2)=pos_uvmat(2)-pos_uvmat(3)/4;
-%      pos_view_field(3:4)=pos_uvmat(3:4);
-    set(hObject,'Position',pos_view_field)
-end
-
 %functions for the mouse and keyboard
-set(hObject,'KeyPressFcn',{'keyboard_callback',handles_mouse})%set keyboard action function
-set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles_mouse})%set mouse action functio
+set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function
+set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles})%set mouse action functio
 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
-set(hObject,'WindowButtonUpFcn',{'mouse_up',handles_mouse}) 
+set(hObject,'WindowButtonUpFcn',{'mouse_up',handles}) 
 set(hObject,'DeleteFcn',{@closefcn})%
 set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
@@ -103,4 +85,11 @@
     write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters
 end
+
+%put the GUI on the lower right of the sceen
+pos_view_field=get(hObject,'Position');
+ScreenSize=get(0,'ScreenSize');
+pos_view_field(1)=ScreenSize(1)+ScreenSize(3)-pos_view_field(3);
+pos_view_field(2)=ScreenSize(2);
+set(hObject,'Position',pos_view_field)
 
 %------------------------------------------------------------------------
@@ -827,2 +816,9 @@
 
 
+% 
+% 
+% % --- Executes when view_field is resized.
+% function view_field_ResizeFcn(hObject, eventdata, handles)
+% % hObject    handle to view_field (see GCBO)
+% % eventdata  reserved - to be defined in a future version of MATLAB
+% % handles    structure with handles and user data (see GUIDATA)
