Index: trunk/src/plot_object.m
===================================================================
--- trunk/src/plot_object.m	(revision 156)
+++ trunk/src/plot_object.m	(revision 177)
@@ -92,11 +92,11 @@
 
 %% default input parameters
-if ~isfield(ObjectData,'ProjMode')|isempty(ObjectData.ProjMode)
+if ~isfield(ObjectData,'ProjMode')||isempty(ObjectData.ProjMode)
      ObjectData.ProjMode='projection';%default
 end
-if ~isfield(ObjectData,'Coord')|isempty(ObjectData.Coord)
+if ~isfield(ObjectData,'Coord')||isempty(ObjectData.Coord)
      ObjectData.Coord=[0 0 0];%default
 end
-if ~isfield(ObjectData,'Phi')|isempty(ObjectData.Phi)
+if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi)
      ObjectData.Phi=0;%default
 end
@@ -131,5 +131,5 @@
     YMax=max(XMax,YMax);
     YMax=max(YMax,ZMax);
-elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'ellipse')|isequal(ObjectData.Style,'volume')
+elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'ellipse')||isequal(ObjectData.Style,'volume')
     if  isequal(YMax,0)
         ylim=get(haxes,'YLim');
@@ -159,8 +159,9 @@
     xline=ObjectData.Coord(:,1);
     yline=ObjectData.Coord(:,2);
+    nbpoints=numel(xline);
     if isequal(ObjectData.Style,'polygon')
         xline=[xline; ObjectData.Coord(1,1)];%closing the line
         yline=[yline; ObjectData.Coord(1,2)];
-    elseif isequal(ObjectData.Style,'plane')| isequal(ObjectData.Style,'volume') 
+    elseif isequal(ObjectData.Style,'plane')|| isequal(ObjectData.Style,'volume') 
         phi=ObjectData.Phi*pi/180;%angle in radians
         Xend_x=xline(1)+XMax*cos(phi);
@@ -180,8 +181,8 @@
             SubLineStyle='--'; %range of projection marked by dash
             if isfield (ObjectData,'DX')
-               rmfield(ObjectData,'DX');
+               ObjectData=rmfield(ObjectData,'DX');
             end
             if isfield (ObjectData,'DY')
-               rmfield(ObjectData,'DY');
+               ObjectData=rmfield(ObjectData,'DY');
             end
         elseif isequal(ObjectData.ProjMode,'filter')
@@ -189,5 +190,5 @@
         end
     end 
-    if isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|isequal(ObjectData.Style,'polygon')
+    if isequal(ObjectData.Style,'line')||isequal(ObjectData.Style,'polyline')||isequal(ObjectData.Style,'polygon')
         if length(xline)<2
             theta=0;
@@ -223,6 +224,6 @@
         scale_x=2*1.4*XMax/npMx;
         scale_y=2*1.4*YMax/npMy;
-        xi=[0.5:npMx-0.5]*scale_x+xlim(1);
-        yi=[0.5:npMy-0.5]*scale_y+ylim(1);
+        xi=(0.5:npMx-0.5)*scale_x+xlim(1);
+        yi=(0.5:npMy-0.5)*scale_y+ylim(1);
         [Xi,Yi]=meshgrid(xi,yi);
         X2Max=XMax*XMax;
@@ -231,5 +232,5 @@
         distY=(Yi-ObjectData.Coord(1,2));
         flag=(distX.*distX/X2Max+distY.*distY/Y2Max)<1;
-    elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'volume')
+    elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'volume')
         XimaMin=ObjectData.Coord(1,1)-XMax;
         XimaMax=ObjectData.Coord(1,1)+XMax;
@@ -240,6 +241,6 @@
         scale_x=2*1.4*XMax/npMx;
         scale_y=2*1.4*YMax/npMy;
-        xi=[0.5:npMx-0.5]*scale_x+xlim(1);
-        yi=[0.5:npMy-0.5]*scale_y+ylim(1);
+        xi=(0.5:npMx-0.5)*scale_x+xlim(1);
+        yi=(0.5:npMy-0.5)*scale_y+ylim(1);
         [Xi,Yi]=meshgrid(xi,yi);
         distX=abs(Xi-ObjectData.Coord(1,1));
@@ -270,4 +271,5 @@
 
 PlotData=[];%default
+
 %% MODIFY AN EXISTING OBJECT PLOT
 if test_newobj==0;
@@ -301,11 +303,11 @@
            for ipt=1:length(PlotData.DeformPoint)
                if ishandle(PlotData.DeformPoint(ipt))
-                   if length(xline)>=ipt &   length(yline)>=ipt    
+                   if nbpoints>=ipt  
                         set(PlotData.DeformPoint(ipt),'XData',xline(ipt),'YData',yline(ipt));
                     end
                end
            end
-           if length(xline)>length(PlotData.DeformPoint)
-               for ipt=length(PlotData.DeformPoint)+1:length(xline)
+           if nbpoints>length(PlotData.DeformPoint)
+               for ipt=length(PlotData.DeformPoint)+1:nbpoints
                     PlotData.DeformPoint(ipt)=line(xline(ipt),yline(ipt),'Color',col,'LineStyle','.','Tag','DeformPoint',...
                         'SelectionHighlight','off','UserData',hplot);
@@ -314,5 +316,5 @@
            end
         end
-    elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'ellipse')
+    elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'ellipse')
         set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax])          
     end
@@ -334,5 +336,5 @@
     hother=findobj('Tag','proj_object');%find all the proj objects
     for iobj=1:length(hother)
-        if isequal(get(hother(iobj),'Type'),'rectangle')|isequal(get(hother(iobj),'Type'),'patch')
+        if strcmp(get(hother(iobj),'Type'),'rectangle')|| strcmp(get(hother(iobj),'Type'),'patch')
             set(hother(iobj),'EdgeColor','b')
             if isequal(get(hother(iobj),'FaceColor'),'m')
@@ -363,19 +365,19 @@
               end
         end
-    elseif  isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|...        
-          isequal(ObjectData.Style,'polygon') |isequal(ObjectData.Style,'plane')|isequal(ObjectData.Style,'volume')%  (isequal(ObjectData.Style,'polygon') & ~test_patch) |isequal(ObjectData.Style,'plane')
+    elseif  strcmp(ObjectData.Style,'line')||strcmp(ObjectData.Style,'polyline')||...        
+          strcmp(ObjectData.Style,'polygon') ||strcmp(ObjectData.Style,'plane')||strcmp(ObjectData.Style,'volume')%  (isequal(ObjectData.Style,'polygon') & ~test_patch) |isequal(ObjectData.Style,'plane')
         hh=line(xline,yline,'Color',col);
-        if ~isequal(ObjectData.Style,'plane')& ~isequal(ObjectData.Style,'volume')
+        if ~strcmp(ObjectData.Style,'plane') && ~strcmp(ObjectData.Style,'volume')
+            PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
+            PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
             for ipt=1:sizcoord(1)
                 PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
                       col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
             end
-            PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
-            PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
         end
     
-    elseif isequal(ObjectData.Style,'rectangle')
+    elseif strcmp(ObjectData.Style,'rectangle')
         hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);   
-    elseif isequal(ObjectData.Style,'ellipse')
+    elseif strcmp(ObjectData.Style,'ellipse')
         hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);
     else
@@ -387,5 +389,5 @@
         hold on
         hhh=image([xlim(1)+dx/2 xlim(2)-dx/2],[ylim(1)+dy/2 ylim(2)-dy/2],imflag,'Tag','proj_object','HitTest','off');
-        set(hhh,'AlphaData',(flag)*0.2)
+        set(hhh,'AlphaData',(flag)*0.2)% set partial transparency to the filling color
         PlotData.SubObject=hhh;    
     end
