Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 747)
+++ trunk/src/uvmat.m	(revision 748)
@@ -83,8 +83,8 @@
 % velocity vectors. The scalar values in the first case is represented by
 % UvData.Field.A, and by UvData.Field.C in the second case. The corresponding set of X
-% and Y coordinates are represented by UvData.Field.AX and UvData.Field.AY, and .X and
+% and Y axes are represented by UvData.Field.AX and UvData.Field.AY, and .X and
 % .Y for C (the same as velocity vectors). If A is a nxxny matrix (scalar
 % on a regtular grid), then .AX andf.AY contains only two elements, represneting the
-% coordinates of the four image corners. The scalar name is represented by
+% axes of the four image corners. The scalar name is represented by
 % the strings .AName and/or .CName.
 % If the scalar exists in an input open (image or scalar stored under its
@@ -95,5 +95,5 @@
 % Properties attached to plotting figures (standard Matlab properties):
 %    'CurrentAxes'= gca or get(gcf,'CurrentAxes');
-%    'CurrentPoint'=get(gcf,'CurrentPoint'): figure coordinates of the point over which the mouse is positioned
+%    'CurrentPoint'=get(gcf,'CurrentPoint'): figure axes of the point over which the mouse is positioned
 %    'CurrentCharacter'=get(gcf,'CurrentCharacter'): last character typed  over the figure where the mouse is positioned
 %    'WindowButtonMotionFcn': function permanently called by mouse motion over the figure
@@ -103,5 +103,5 @@
 
 % Properties attached to plotting axes:
-%    'CurrentPoint'=get(gca,'CurrentPoint'); (standard Matlab) same as for the figure, but position in plot coordinates.
+%    'CurrentPoint'=get(gca,'CurrentPoint'); (standard Matlab) same as for the figure, but position in plot axes.
 %     AxeData:=get(gca,'UserData');
 %     AxeData.Drawing  = create: create a new object 
@@ -120,5 +120,5 @@
 %    ObjectData.Type=...: style of projection object:
 %              .ProjMode
-%              .Coord: defines the position of the object
+%              .Coordinates: defines the position of the object
 %              .XMin,YMin....
 %              .XMax,YMax....
@@ -191,5 +191,4 @@
 set(hObject,'Position',[LeftX LowY Width Height])
 UvData.OpenParam.PosColorbar=[0.80 0.02 0.018 0.445];
-% UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib 
 AxeData.LimEditBox=1; %initialise AxeData
 set(handles.PlotAxes,'UserData',AxeData)
@@ -396,5 +395,5 @@
 % set(handles.CheckHold,'Position',pos_CheckHold)
 
-%% reset position of Coordinates
+%% reset position of Coordinates panel
 set(handles.Coordinates,'Units','pixels')
 pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates'
@@ -404,27 +403,35 @@
 set(handles.Coordinates,'Position',pos_2)
 
+%% reset position of Axes panel
+set(handles.Axes,'Units','pixels')
+pos_3=get(handles.Axes,'Position');% [lower x lower y width height] for frame 'Coordinates'
+pos_3(3)=ColumnWidth;
+pos_3(1)=size_fig(3)-pos_3(3);       % set 'Coordinates' to the right of the fig
+pos_3(2)=pos_2(2)-pos_3(4);          % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
+set(handles.Axes,'Position',pos_3)
+
 %% reset position of  Scalar
 set(handles.Scalar,'Units','pixels')
-pos_3=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
-pos_3(3)=ColumnWidth;
-pos_3(1)=size_fig(3)-pos_3(3);         % set 'Scalar' to the right of the fig
+pos_4=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
+pos_4(3)=ColumnWidth;
+pos_4(1)=size_fig(3)-pos_4(3);         % set 'Scalar' to the right of the fig
 if strcmp(get(handles.Scalar,'Visible'),'on')
-    pos_3(2)=pos_2(2)-pos_3(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
-else
-    pos_3(2)=pos_2(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
-end
-set(handles.Scalar,'Position',pos_3)
+    pos_4(2)=pos_3(2)-pos_4(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
+else
+    pos_4(2)=pos_3(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
+end
+set(handles.Scalar,'Position',pos_4)
 
 %% reset position of  Vectors
 set(handles.Vectors,'Units','pixels')
-pos_4=get(handles.Vectors,'Position');
-pos_4(3)=ColumnWidth;
-pos_4(1)=size_fig(3)-pos_4(3);
+pos_5=get(handles.Vectors,'Position');
+pos_5(3)=ColumnWidth;
+pos_5(1)=size_fig(3)-pos_5(3);
 if strcmp(get(handles.Vectors,'visible'),'on')
-    pos_4(2)=pos_3(2)-pos_4(4);
-else
-    pos_4(2)=pos_3(2);
-end
-set(handles.Vectors,'Position',pos_4)
+    pos_5(2)=pos_4(2)-pos_5(4);
+else
+    pos_5(2)=pos_4(2);
+end
+set(handles.Vectors,'Position',pos_5)
 
 %% reset position and scale of axis
@@ -2626,9 +2633,12 @@
             break
         end
-        if UvData.Field.NbDim==3% TO GENERALISE
+        if UvData.Field.NbDim==3
             UvData.ProjObject{iobj}.NbDim=3;%test for 3D objects
+            if ~isfield(UvData.ProjObject{iobj},'RangeZ')
             UvData.ProjObject{iobj}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
-            UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
-            UvData.ProjObject{iobj}.Angle=[0 0 0];
+            end
+            if ~(isfield(UvData.ProjObject{iobj},'Coord') && UvData.ProjObject{iobj}.Coord(1,3)<UvData.Field.ZMax && UvData.ProjObject{iobj}.Coord(1,3)>UvData.Field.ZMin)
+                 UvData.ProjObject{iobj}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
+            end          
         end
         [ObjectData,errormsg]=proj_field(UvData.Field,UvData.ProjObject{iobj});% project field on the object
@@ -2639,6 +2649,6 @@
             PlotParam{imap}.Scalar.CheckBW=[]; %B/W option depends on the input field (image or scalar)
             if isfield(ObjectData,'CoordUnit')
-                PlotParam{imap}.Coordinates.CheckFixAspectRatio=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y)
-                PlotParam{imap}.Coordinates.AspectRatio=1; %set aspect ratio to 1
+                PlotParam{imap}.Axes.CheckFixAspectRatio=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y)
+                PlotParam{imap}.Axes.AspectRatio=1; %set aspect ratio to 1
             end
         end
@@ -2706,5 +2716,5 @@
     Ustring='';
     Vstring='';
-    % suppress coordinates from the histogram menu
+    % suppress axes from the histogram menu
     for ivar=1:numel(menu_histo)%l loop on field variables:
         if isfield(UvData.Field,'VarAttribute') && numel(UvData.Field.VarAttribute)>=ivar && isfield(UvData.Field.VarAttribute{ivar},'Role')
@@ -2748,4 +2758,5 @@
 
 if UvData.Field.NbDim==3
+    set(handles.CheckEditObject,'Value',1)
     CheckEditObject_Callback(handles.uvmat, [], handles)
 end   
@@ -2809,6 +2820,6 @@
 else
     nxy=size(FieldHisto);
-    Amin=double(min(min(min(FieldHisto))));%min of field value
-    Amax=double(max(max(max(FieldHisto))));%max of field value
+    Amin=double(min(min(min(min(FieldHisto)))));%min of field value
+    Amax=double(max(max(max(max(FieldHisto)))));%max of field value
     if isequal(Amin,Amax)
         cla(handles.HistoAxes)
@@ -3110,5 +3121,5 @@
 switch field  
     case 'get_field...'
-        %% fill the coordinates and variables from selections in get_field
+        %% fill the axes and variables from selections in get_field
         ParamIn=[];
         % in case of civ data, we use the civ choice as default input for the GUI get_field
@@ -3274,5 +3285,5 @@
 switch field_1
     case 'get_field...'
-         %% fill the coordinates and variables from selections in get_field
+         %% fill the axes and variables from selections in get_field
         ParamIn=[];
         % in case of civ data, we use the civ choice as default input for the GUI get_field
@@ -3867,5 +3878,5 @@
 %-------------------------------------------------
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Plot coordinates
+% Plot axes
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %------------------------------------------------------------------------
@@ -4303,5 +4314,5 @@
     haxes=findobj(hview_field,'tag','axes3');
     pos=get(hview_field,'Position');  
-    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
+    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Axes)% case of no plot display (pure text table)
         h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
         pos_table=get(h_TableDisplay,'Position');
@@ -4480,5 +4491,5 @@
     haxes=findobj(hview_field,'tag','axes3');
     pos=get(hview_field,'Position');
-    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
+    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Axes)% case of no plot display (pure text table)
         h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
         pos_table=get(h_TableDisplay,'Position');
@@ -5232,5 +5243,5 @@
 XmlData.PolarCentre=[x0 y0];
 
-%% display the current image in polar coordinates with origin at the  illumination source
+%% display the current image in polar axes with origin at the  illumination source
 currentdir=pwd;  
 uvmatpath=fileparts(which('uvmat'));
@@ -5558,12 +5569,12 @@
 %'write_plot_param': update the plotting parameters on the uvmat or view_field interface after a plotting operation
 function write_plot_param(handles,PlotParam)
-%% coordinates
-if isempty(PlotParam.Coordinates)
-    set(handles.Coordinates,'Visible','off')
+%% axes
+if isempty(PlotParam.Axes)
+    set(handles.Axes,'Visible','off')
     set(handles.PlotAxes,'Visible','off')
     set(handles.text_display,'Visible','off')
     set(handles.TableDisplay,'Visible','on')
 else
-    set(handles.Coordinates,'Visible','on')
+    set(handles.Axes,'Visible','on')
     set(handles.PlotAxes,'Visible','on')
     set(handles.text_display,'Visible','on')
@@ -5571,5 +5582,5 @@
     set(handles.TableDisplay,'Visible','off')
     end
-    Coordinates=PlotParam.Coordinates;
+    Coordinates=PlotParam.Axes;
     if isfield(Coordinates,'CheckFixAspectRatio')
         if Coordinates.CheckFixAspectRatio
@@ -5666,23 +5677,10 @@
 
 
-
-function Coord_z_Callback(hObject, eventdata, handles)
-% hObject    handle to Coord_z (see GCBO)
+% --- Executes on selection change in SwitchCoordIndex.
+function SwitchCoordIndex_Callback(hObject, eventdata, handles)
+% hObject    handle to SwitchCoordIndex (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
 
-% Hints: get(hObject,'String') returns contents of Coord_z as text
-%        str2double(get(hObject,'String')) returns contents of Coord_z as a double
-
-
-% --- Executes during object creation, after setting all properties.
-function Coord_z_CreateFcn(hObject, eventdata, handles)
-% hObject    handle to Coord_z (see GCBO)
-% eventdata  reserved - to be defined in a future version of MATLAB
-% handles    empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-%       See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
-    set(hObject,'BackgroundColor','white');
-end
+% Hints: contents = cellstr(get(hObject,'String')) returns SwitchCoordIndex contents as cell array
+%        contents{get(hObject,'Value')} returns selected item from SwitchCoordIndex
