[8]  1  %'plot_object': draws a projection object (points, line, plane...)


 2  %


[432]  3  % function hh=plot_object(ObjectData,ProjObject,hplot,col)


[8]  4  %


 5  %OUTPUT


 6  % hh: handles of the graphic object (core part)


 7  %


 8  %INPUT:


 9  %


[432]  10  % ObjectData: structure representing the object properties:


[379]  11  % .Type : style of projection object


[8]  12  % .Coord: set of coordinates defining the object position;


 13  % .ProjMode=type of projection ;


 14  % .ProjAngle=angle of projection;


 15  % .DX,.DY,.DZ=increments;


 16  % .YMax,YMin: min and max Y


 17  % ProjObject: projection object corresponding to the current plot (e. g. plane)


 18  % hplot: handle of the object plot to modify or if it is an axis, the axis


 19  % where the object must be plotted, or if it is a figure the plotting figure


 20  % col: color of the plot, e;g; 'm', 'b' ..;


 21 


 22  %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


 23  % Copyright Joel Sommeria, 2008, LEGI / CNRSUJFINPG, sommeria@coriolislegi.org.


 24  %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


 25  % This file is part of the toolbox UVMAT.


 26  %


 27  % UVMAT is free software; you can redistribute it and/or modify


 28  % it under the terms of the GNU General Public License as published by


 29  % the Free Software Foundation; either version 2 of the License, or


 30  % (at your option) any later version.


 31  %


 32  % UVMAT is distributed in the hope that it will be useful,


 33  % but WITHOUT ANY WARRANTY; without even the implied warranty of


 34  % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the


 35  % GNU General Public License (file UVMAT/COPYING.txt) for more details.


 36  %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


 37 


[432]  38  function [hh]=plot_object(ObjectData,ProjObject,hplot,col)


 39 


[156]  40  %% default output


[8]  41  hh=[];%default output


[432]  42  % object representation is canceled if the field is not projected on a plane or is the same as the represented object


[534]  43  if ~isfield(ObjectData,'Type') isequal(ProjObject,ObjectData)~isfield(ProjObject,'Type') ~strcmp(ProjObject.Type,'plane')


[432]  44  if ~isempty(hplot) && ishandle(hplot) && ~strcmp(get(hplot,'Type'),'axes')


 45  ObjectPlotData=get(hplot,'UserData');


 46  if isfield(ObjectPlotData,'SubObject') & ishandle(ObjectPlotData.SubObject)


 47  delete(ObjectPlotData.SubObject);


 48  end


 49  if isfield(ObjectPlotData,'DeformPoint') & ishandle(ObjectPlotData.DeformPoint)


 50  delete(ObjectPlotData.DeformPoint);


 51  end


 52  delete(hplot)


 53  end


 54  return


[8]  55  end


[625]  56  XMin=0;%default range for the graph


[8]  57  XMax=0;


 58  YMin=0;


 59  YMax=0;


 60  ZMin=0;


 61  ZMax=0;


[625]  62  XMinRange=[];%default range set by input


 63  XMaxRange=[];


 64  YMinRange=[];


 65  YMaxRange=[];


 66  ZMinRange=[];


 67  ZMaxRange=[];


[8]  68 


[156]  69  %% determine the plotting axes (with handle 'haxes')


[8]  70  test_newobj=1;


 71  if ishandle(hplot)


[156]  72  if isequal(get(hplot,'Tag'),'proj_object')% hplot is the handle of an object representation


[8]  73  test_newobj=0;


 74  haxes=get(hplot,'parent');


[231]  75  currentfig=get(haxes,'parent');


[156]  76  elseif isequal(get(hplot,'Type'),'axes')% hplot is the handle of an axis


[231]  77  haxes=hplot;


[156]  78  currentfig=get(hplot,'parent');


 79  elseif isequal(get(hplot,'Type'),'figure')% hplot is the handle of a figure


 80  set(0,'CurrentFigure',hplot);%set the input figure as the current one


[8]  81  haxes=findobj(hplot,'Type','axes');%look for axes in the figure


 82  haxes=haxes(1);


[231]  83  currentfig=hplot;


[8]  84  else


[231]  85  currentfig=figure; %create new figure


[8]  86  hplot=axes;%create new axes


 87  haxes=hplot;


 88  end


 89  else


[231]  90  currentfig=figure; %create new figure


[8]  91  hplot=axes;%create new axes


 92  haxes=hplot;


 93  end


[231]  94  set(0,'CurrentFigure',currentfig)%set the currentfigure as the current one


 95  set(currentfig,'CurrentAxes',haxes);%set the current axes in the current figure


[8]  96 


[156]  97  %% default input parameters


[177]  98  if ~isfield(ObjectData,'ProjMode')isempty(ObjectData.ProjMode)


[8]  99  ObjectData.ProjMode='projection';%default


 100  end


[177]  101  if ~isfield(ObjectData,'Coord')isempty(ObjectData.Coord)


[8]  102  ObjectData.Coord=[0 0 0];%default


 103  end


[379]  104  if isfield(ObjectData,'RangeX') && ~isempty(ObjectData.RangeX)


 105  XMax=max(ObjectData.RangeX);


 106  XMin=min(ObjectData.RangeX);


[625]  107  XMaxRange=max(ObjectData.RangeX);


 108  if numel(ObjectData.RangeX)==2


 109  XMinRange=min(ObjectData.RangeX);


 110  end


[8]  111  end


[379]  112  if isfield(ObjectData,'RangeY')&&~isempty(ObjectData.RangeY)


 113  YMax=max(ObjectData.RangeY);


 114  YMin=min(ObjectData.RangeY);


[625]  115  YMaxRange=max(ObjectData.RangeY);


 116  if numel(ObjectData.RangeY)==2


 117  YMinRange=min(ObjectData.RangeY);


 118  end


[8]  119  end


[379]  120  if isfield(ObjectData,'RangeZ')&&~isempty(ObjectData.RangeZ)


 121  ZMax=max(ObjectData.RangeZ);


 122  ZMin=min(ObjectData.RangeZ);


[625]  123  ZMaxRange=max(ObjectData.RangeZ);


 124  ZMinRange=min(ObjectData.RangeZ);


[8]  125  end


[625]  126  if strcmp(ObjectData.Type,'points') && strcmp(ObjectData.ProjMode,'projection')


 127  YMax=max(XMax,YMax);


 128  YMax=max(YMax,ZMax);


[8]  129  end


 130  sizcoord=size(ObjectData.Coord);


 131 


[156]  132  %% determine the coordinates xline, yline,xsup,xinf, yinf,ysup determining the new object plot


[379]  133  test_line= isequal(ObjectData.Type,'points')isequal(ObjectData.Type,'line')isequal(ObjectData.Type,'polyline')...


 134  isequal(ObjectData.Type,'polygon') isequal(ObjectData.Type,'plane') isequal(ObjectData.Type,'volume');


 135  test_patch=isequal(ObjectData.ProjMode,'inside')isequal(ObjectData.ProjMode,'outside')isequal(ObjectData.Type,'volume')...


[8]  136  isequal(ObjectData.ProjMode,'mask_inside')isequal(ObjectData.ProjMode,'mask_outside');


 137  if test_line


 138  xline=ObjectData.Coord(:,1);


 139  yline=ObjectData.Coord(:,2);


[177]  140  nbpoints=numel(xline);


[379]  141  if isequal(ObjectData.Type,'polygon')


[8]  142  xline=[xline; ObjectData.Coord(1,1)];%closing the line


 143  yline=[yline; ObjectData.Coord(1,2)];


[379]  144  elseif isequal(ObjectData.Type,'plane') isequal(ObjectData.Type,'volume')


[625]  145  if ~isfield(ObjectData,'Angle')


 146  ObjectData.Angle=[0 0 0];


 147  end


[397]  148  phi=ObjectData.Angle(3)*pi/180;%angle in radians


[625]  149  x0=xline(1); y0=yline(1);


 150  xlim=get(haxes,'XLim');


 151  ylim=get(haxes,'YLim');


 152  graph_scale=max(abs(xlim(2)xlim(1)),abs(ylim(2)ylim(1)))/2;% estimate the length of axes plots


 153  XMax=graph_scale;


 154  YMax=graph_scale;


 155  XMin=graph_scale;


 156  YMin=graph_scale;


 157  if ~isempty(XMaxRange)


 158  XMax=XMaxRange;


 159  end


 160  if ~isempty(XMinRange)


 161  XMin=XMinRange;


 162  end


 163  if ~isempty(YMaxRange)


 164  YMax=YMaxRange;


 165  end


 166  if ~isempty(YMinRange)


 167  YMin=YMinRange;


 168  end


 169  % axes lines


 170  xline=NaN(1,13);


 171  xline(1)=x0+min(0,XMin)*cos(phi); % min end of the x axes


 172  yline(1)=y0+min(0,XMin)*sin(phi);


 173  xline(2)=x0+XMax*cos(phi);% max end of the x axes


 174  yline(2)=y0+XMax*sin(phi);


 175  xline(8)=x0min(0,YMin)*sin(phi);% min end of the y axes


 176  yline(8)=y0+min(0,YMin)*cos(phi);


 177  xline(9)=x0YMax*sin(phi);% max end of the y axes


 178  yline(9)=y0+YMax*cos(phi);


 179 


 180  %arrows on x axis


 181  arrow_scale=graph_scale/20;


 182  xline(3)=xline(2)arrow_scale*cos(phipi/8);


 183  yline(3)=yline(2)arrow_scale*sin(phipi/8);


 184  xline(5)=xline(2);


 185  yline(5)=yline(2);


 186  xline(6)=xline(2)arrow_scale*cos(phi+pi/8);


 187  yline(6)=yline(2)arrow_scale*sin(phi+pi/8);


 188 


 189  %arrows on y axis


 190  xline(10)=xline(9)arrow_scale*cos(phi+pi/2pi/8);


 191  yline(10)=yline(9)arrow_scale*sin(phi+pi/2pi/8);


 192  xline(12)=xline(9);


 193  yline(12)=yline(9);


 194  xline(13)=xline(9)arrow_scale*cos(phi+pi/2+pi/8);


 195  yline(13)=yline(9)arrow_scale*sin(phi+pi/2+pi/8);


 196  %xline=[Xbeg_x Xend_x NaN Ybeg_x Yend_x];


 197  %yline=[Xbeg_y Xend_y NaN Ybeg_y Yend_y];


 198  % dashed lines indicating bounds


 199  xsup=NaN(1,5);


 200  ysup=NaN(1,5);


 201  if ~isempty(XMaxRange)


 202  xsup(1)=xline(2)YMin*sin(phi);


 203  ysup(1)=yline(2)+YMin*cos(phi);


 204  xsup(2)=xline(2)YMax*sin(phi);


 205  ysup(2)=yline(2)+YMax*cos(phi);


 206  end


 207  if ~isempty(YMaxRange)


 208  xsup(2)=xline(2)YMax*sin(phi);


 209  ysup(2)=yline(2)+YMax*cos(phi);


 210  xsup(3)=xline(9)+XMin*cos(phi);


 211  ysup(3)=yline(9)+XMin*sin(phi);


 212  end


 213  if ~isempty(XMinRange)


 214  xsup(3)=xline(9)+XMin*cos(phi);


 215  ysup(3)=yline(9)+XMin*sin(phi);


 216  xsup(4)=x0+XMin*cos(phi)YMin*sin(phi);


 217  ysup(4)=y0+XMin*sin(phi)+YMin*cos(phi);


 218  end


 219  if ~isempty(YMinRange)


 220  xsup(4)=x0+XMin*cos(phi)YMin*sin(phi);


 221  ysup(4)=y0+XMin*sin(phi)+YMin*cos(phi);


 222  xsup(5)=xline(8)YMin*sin(phi);


 223  ysup(5)=yline(8)+YMin*cos(phi);


 224  end


[8]  225  end


 226  SubLineStyle='none';%default


 227  if isfield(ObjectData,'ProjMode')


 228  if isequal(ObjectData.ProjMode,'projection')


 229  SubLineStyle=''; %range of projection marked by dash


 230  if isfield (ObjectData,'DX')


[177]  231  ObjectData=rmfield(ObjectData,'DX');


[8]  232  end


 233  if isfield (ObjectData,'DY')


[177]  234  ObjectData=rmfield(ObjectData,'DY');


[8]  235  end


 236  elseif isequal(ObjectData.ProjMode,'filter')


 237  SubLineStyle=':';%range of projection not visible


 238  end


 239  end


[379]  240  if isequal(ObjectData.Type,'line')isequal(ObjectData.Type,'polyline')isequal(ObjectData.Type,'polygon')


[8]  241  if length(xline)<2


 242  theta=0;


 243  else


[187]  244  theta=angle(diff(xline)+1i*diff(yline));


[8]  245  theta(length(xline))=theta(length(xline)1);


 246  end


 247  xsup(1)=xline(1)+YMax*sin(theta(1));


 248  xinf(1)=xline(1)YMax*sin(theta(1));


 249  ysup(1)=yline(1)YMax*cos(theta(1));


 250  yinf(1)=yline(1)+YMax*cos(theta(1));


 251  for ip=2:length(xline)


 252  xsup(ip)=xline(ip)+YMax*sin((theta(ip)+theta(ip1))/2)/cos((theta(ip1)theta(ip))/2);


 253  xinf(ip)=xline(ip)YMax*sin((theta(ip)+theta(ip1))/2)/cos((theta(ip1)theta(ip))/2);


 254  ysup(ip)=yline(ip)YMax*cos((theta(ip)+theta(ip1))/2)/cos((theta(ip1)theta(ip))/2);


 255  yinf(ip)=yline(ip)+YMax*cos((theta(ip)+theta(ip1))/2)/cos((theta(ip1)theta(ip))/2);


 256  end


 257  end


 258  end


 259 


[156]  260  %% shading image


[8]  261  if test_patch


 262  npMx=512;


 263  npMy=512;


 264  flag=zeros(npMy,npMx);


[379]  265  if isequal(ObjectData.Type,'ellipse')


[8]  266  XimaMin=ObjectData.Coord(1,1)XMax;


 267  XimaMax=ObjectData.Coord(1,1)+XMax;


 268  YimaMin=ObjectData.Coord(1,2)YMax;


 269  YimaMax=ObjectData.Coord(1,2)+YMax;


 270  xlim=[1.2*XimaMin0.2*XimaMax 1.2*XimaMax0.2*XimaMin];%create an image around the ellipse


 271  ylim=[1.2*YimaMin0.2*YimaMax 1.2*YimaMax0.2*YimaMin];


 272  scale_x=2*1.4*XMax/npMx;


 273  scale_y=2*1.4*YMax/npMy;


[177]  274  xi=(0.5:npMx0.5)*scale_x+xlim(1);


 275  yi=(0.5:npMy0.5)*scale_y+ylim(1);


[8]  276  [Xi,Yi]=meshgrid(xi,yi);


 277  X2Max=XMax*XMax;


 278  Y2Max=YMax*YMax;


 279  distX=(XiObjectData.Coord(1,1));


 280  distY=(YiObjectData.Coord(1,2));


 281  flag=(distX.*distX/X2Max+distY.*distY/Y2Max)<1;


[379]  282  elseif isequal(ObjectData.Type,'rectangle')isequal(ObjectData.Type,'volume')


[8]  283  XimaMin=ObjectData.Coord(1,1)XMax;


 284  XimaMax=ObjectData.Coord(1,1)+XMax;


 285  YimaMin=ObjectData.Coord(1,2)YMax;


 286  YimaMax=ObjectData.Coord(1,2)+YMax;


 287  xlim=[1.2*XimaMin0.2*XimaMax 1.2*XimaMax0.2*XimaMin];%create an image around the ellipse


 288  ylim=[1.2*YimaMin0.2*YimaMax 1.2*YimaMax0.2*YimaMin];


 289  scale_x=2*1.4*XMax/npMx;


 290  scale_y=2*1.4*YMax/npMy;


[177]  291  xi=(0.5:npMx0.5)*scale_x+xlim(1);


 292  yi=(0.5:npMy0.5)*scale_y+ylim(1);


[8]  293  [Xi,Yi]=meshgrid(xi,yi);


 294  distX=abs(XiObjectData.Coord(1,1));


 295  distY=abs(YiObjectData.Coord(1,2));


 296  flag=distX<XMax & distY< YMax;


[379]  297  elseif isequal(ObjectData.Type,'polygon')


[8]  298  XimaMin=min(ObjectData.Coord(:,1));


 299  XimaMax=max(ObjectData.Coord(:,1));


 300  YimaMin=min(ObjectData.Coord(:,2));


 301  YimaMax=max(ObjectData.Coord(:,2));


 302  xlim=[1.2*XimaMin0.2*XimaMax 1.2*XimaMax0.2*XimaMin];


 303  ylim=[1.2*YimaMin0.2*YimaMax 1.2*YimaMax0.2*YimaMin];


 304  [Xlim,Ylim]=meshgrid(linspace(xlim(1),xlim(2),npMx),linspace(ylim(1),ylim(2),npMy));


 305  %flag=roipoly(xlim,ylim,flag,ObjectData.Coord(:,1),ObjectData.Coord(:,2));%=1 inside the polygon, 0 outsid


 306  flag=inpolygon(Xlim,Ylim,ObjectData.Coord(:,1),ObjectData.Coord(:,2));%=1 inside the polygon, 0 outsid


 307  end


 308  if isequal(ObjectData.ProjMode,'outside')isequal(ObjectData.ProjMode,'mask_outside')


 309  flag=~flag;


 310  end


 311  imflag=zeros(npMx,npMy,3);


 312  imflag(:,:,3)=flag; % blue color


 313  if isequal(col,'m')


 314  imflag(:,:,1)=flag; % magenta color


 315  end


 316  dx=(xlim(2)xlim(1))/npMx;


 317  dy=(ylim(2)ylim(1))/npMy;


 318  end


 319 


 320  PlotData=[];%default


[177]  321 


[156]  322  %% MODIFY AN EXISTING OBJECT PLOT


[8]  323  if test_newobj==0;


 324  hh=hplot;


[625]  325  PlotData=get(hplot,'UserData');


[8]  326  if test_line


 327  set(hplot,'XData',xline)


 328  set(hplot,'YData',yline)


[625]  329  %modify subobjects


 330  if isfield(PlotData,'SubObject')


 331  if isequal(ObjectData.Type,'points')


 332  if ~isequal(YMax,0)


 333  for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1))


 334  set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)YMax ObjectData.Coord(ipt,2)YMax 2*YMax 2*YMax])


 335  end


 336  %complement missing points


 337  if length(PlotData.SubObject)>nbpoints% fpoints in excess on the graph


 338  for ii=nbpoints+1: length(PlotData.SubObject);


 339  if ishandle(PlotData.SubObject(ii))


 340  delete(PlotData.SubObject(ii))


 341  end


 342  end


 343  end


 344  % NbDeformPoint=nbpoints;


 345 


 346  if nbpoints>length(PlotData.SubObject)


 347  for ipt=length(PlotData.SubObject)+1:nbpoints


 348  PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...


 349  'Position',[ObjectData.Coord(ipt,1)YMax ObjectData.Coord(ipt,2)YMax 2*YMax 2*YMax],'EdgeColor',col,...


 350  'LineStyle',SubLineStyle,'Tag','proj_object');


 351  end


 352  end


 353  end


 354  elseif length(PlotData.SubObject)==2


[8]  355  set(PlotData.SubObject(1),'XData',xinf);


 356  set(PlotData.SubObject(1),'YData',yinf);


 357  set(PlotData.SubObject(2),'XData',xsup);


 358  set(PlotData.SubObject(2),'YData',ysup);


[625]  359  elseif length(PlotData.SubObject)==1


 360  set(PlotData.SubObject(1),'XData',xsup);


 361  set(PlotData.SubObject(1),'YData',ysup);


 362  end


[8]  363  end


 364  if isfield(PlotData,'DeformPoint')


[622]  365  NbDeformPoint=length(PlotData.DeformPoint);


[625]  366  if NbDeformPoint>nbpoints% fpoints in excess on the graph


 367  for ii=nbpoints+1:NbDeformPoint;


 368  if ishandle(PlotData.DeformPoint(ii))


[622]  369  delete(PlotData.DeformPoint(ii))


[625]  370  end


 371  end


 372  NbDeformPoint=nbpoints;


 373  end


 374  for ipt=1:NbDeformPoint


 375  if ishandle(PlotData.DeformPoint(ipt))


 376  if nbpoints>=ipt


[8]  377  set(PlotData.DeformPoint(ipt),'XData',xline(ipt),'YData',yline(ipt));


 378  end


[625]  379  end


 380  end


 381  if nbpoints>length(PlotData.DeformPoint)


 382  for ipt=length(PlotData.DeformPoint)+1:nbpoints


[8]  383  PlotData.DeformPoint(ipt)=line(xline(ipt),yline(ipt),'Color',col,'LineStyle','.','Tag','DeformPoint',...


 384  'SelectionHighlight','off','UserData',hplot);


[625]  385  end


 386  set(hplot,'UserData',PlotData)


 387  end


[8]  388  end


[622]  389  elseif (isequal(ObjectData.Type,'rectangle')isequal(ObjectData.Type,'ellipse'))&&XMax>0 && YMax>0


[625]  390  set(hplot,'Position',[ObjectData.Coord(1,1)XMax ObjectData.Coord(1,2)YMax 2*XMax 2*YMax])


[8]  391  end


[625]  392  if test_patch


[8]  393  for iobj=1:length(PlotData.SubObject)


 394  objtype=get(PlotData.SubObject(iobj),'Type');


 395  if isequal(objtype,'image')


 396  set(PlotData.SubObject(iobj),'CData',imflag,'AlphaData',(flag)*0.2)


 397  set(PlotData.SubObject(iobj),'XData',[xlim(1)+dx/2 xlim(2)dx/2])


 398  set(PlotData.SubObject(iobj),'YData',[ylim(1)+dy/2 ylim(2)dy/2])


 399  end


 400  end


 401  end


 402  end


 403 


[156]  404  %% create the object


[8]  405  if test_newobj


[231]  406  % axes(haxes)


[8]  407  hother=findobj('Tag','proj_object');%find all the proj objects


 408  for iobj=1:length(hother)


[177]  409  if strcmp(get(hother(iobj),'Type'),'rectangle') strcmp(get(hother(iobj),'Type'),'patch')


[8]  410  set(hother(iobj),'EdgeColor','b')


 411  if isequal(get(hother(iobj),'FaceColor'),'m')


 412  set(hother(iobj),'FaceColor','b')


 413  end


 414  elseif isequal(get(hother(iobj),'Type'),'image')


 415  Acolor=get(hother(iobj),'CData');


 416  Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));


 417  set(hother(iobj),'CData',Acolor);


 418  else


 419  set(hother(iobj),'Color','b')


 420  end


 421  set(hother(iobj),'Selected','off')


 422  end


 423  hother=findobj('Tag','DeformPoint');


 424  set(hother,'Color','b');


 425  set(hother,'Selected','off')


[625]  426  switch ObjectData.Type


 427  case 'points'


 428  hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+');


 429  for ipt=1:length(xline)


[8]  430  PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...


[625]  431  col,'LineStyle','.','SelectionHighlight','off','UserData',hh,'Tag','DeformPoint');


 432  %create circle around each point


 433  if ~isequal(YMax,0)


 434  PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...


 435  'Position',[ObjectData.Coord(ipt,1)YMax ObjectData.Coord(ipt,2)YMax 2*YMax 2*YMax],'EdgeColor',col,...


 436  'LineStyle',SubLineStyle,'Tag','proj_object');


 437  end


[8]  438  end


[625]  439  case {'line','polyline','polygon'}


 440  hh=line(xline,yline,'Color',col);


 441  PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sublines


 442  PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');


 443  for ipt=1:sizcoord(1)


 444  PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...


 445  col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);


 446  end


 447  case {'plane','volume'}


 448  hh=line(xline,yline,'Color',col);


 449  PlotData.SubObject(1)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');


 450  case 'rectangle'


 451  hh=rectangle('Position',[ObjectData.Coord(1,1)XMax ObjectData.Coord(1,2)YMax 2*XMax 2*YMax],'LineWidth',2,'EdgeColor',col);


 452  case 'ellipse'


 453  hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)XMax ObjectData.Coord(1,2)YMax 2*XMax 2*YMax],'EdgeColor',col);


 454  otherwise


 455  msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m')


 456  return


[8]  457  end


 458  set(hh,'Tag','proj_object')


[187]  459  if test_patch


 460  hold on


[8]  461  hhh=image([xlim(1)+dx/2 xlim(2)dx/2],[ylim(1)+dy/2 ylim(2)dy/2],imflag,'Tag','proj_object','HitTest','off');


[187]  462  set(hhh,'AlphaData',(flag)*0.2)% set partial transparency to the filling color


 463  PlotData.SubObject=hhh;


 464  end


[8]  465  if isfield(PlotData,'SubObject')


 466  set(PlotData.SubObject,'UserData',hh)%record the parent handles in the SubObjects


 467  end


 468  if isfield(PlotData,'DeformPoint')


 469  for ipt=1:sizcoord(1)


 470  set(PlotData.DeformPoint(ipt),'UserData',hh);%record the parent handles in the SubObjects


 471  end


 472  set(PlotData.DeformPoint,'UserData',hh)%record the parent handles in the SubObjects


 473  end


 474  end


 475  set(hh,'UserData',PlotData)

