[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


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


[650]  134  isequal(ObjectData.Type,'polyline')isequal(ObjectData.Type,'polygon') isequal(ObjectData.Type,'plane') isequal(ObjectData.Type,'volume');


[379]  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);


[650]  141  if isequal(ObjectData.Type,'line_x')


 142  xline=[xline; ObjectData.RangeX(2)];%creating the line


 143  yline=[yline; ObjectData.RangeY(2)];%creating the line


 144  elseif isequal(ObjectData.Type,'polygon')


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


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


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


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


 149  ObjectData.Angle=[0 0 0];


 150  end


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


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


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


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


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


 156  XMax=graph_scale;


 157  YMax=graph_scale;


 158  XMin=graph_scale;


 159  YMin=graph_scale;


 160  if ~isempty(XMaxRange)


 161  XMax=XMaxRange;


 162  end


 163  if ~isempty(XMinRange)


 164  XMin=XMinRange;


 165  end


 166  if ~isempty(YMaxRange)


 167  YMax=YMaxRange;


 168  end


 169  if ~isempty(YMinRange)


 170  YMin=YMinRange;


 171  end


 172  % axes lines


 173  xline=NaN(1,13);


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


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


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


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


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


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


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


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


 182 


 183  %arrows on x axis


 184  arrow_scale=graph_scale/20;


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


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


 187  xline(5)=xline(2);


 188  yline(5)=yline(2);


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


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


 191 


 192  %arrows on y axis


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


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


 195  xline(12)=xline(9);


 196  yline(12)=yline(9);


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


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


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


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


 201  % dashed lines indicating bounds


 202  xsup=NaN(1,5);


 203  ysup=NaN(1,5);


 204  if ~isempty(XMaxRange)


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


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


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


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


 209  end


 210  if ~isempty(YMaxRange)


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


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


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


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


 215  end


 216  if ~isempty(XMinRange)


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


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


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


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


 221  end


 222  if ~isempty(YMinRange)


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


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


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


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


 227  end


[8]  228  end


 229  SubLineStyle='none';%default


 230  if isfield(ObjectData,'ProjMode')


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


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


 233  if isfield (ObjectData,'DX')


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


[8]  235  end


 236  if isfield (ObjectData,'DY')


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


[8]  238  end


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


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


 241  end


 242  end


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


[8]  244  if length(xline)<2


 245  theta=0;


 246  else


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


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


 249  end


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


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


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


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


 254  for ip=2:length(xline)


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


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


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


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


 259  end


 260  end


 261  end


 262 


[156]  263  %% shading image


[8]  264  if test_patch


 265  npMx=512;


 266  npMy=512;


 267  flag=zeros(npMy,npMx);


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


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


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


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


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


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


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


 275  scale_x=2*1.4*XMax/npMx;


 276  scale_y=2*1.4*YMax/npMy;


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


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


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


 280  X2Max=XMax*XMax;


 281  Y2Max=YMax*YMax;


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


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


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


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


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


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


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


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


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


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


 292  scale_x=2*1.4*XMax/npMx;


 293  scale_y=2*1.4*YMax/npMy;


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


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


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


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


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


 299  flag=distX<XMax & distY< YMax;


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


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


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


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


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


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


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


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


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


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


 310  end


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


 312  flag=~flag;


 313  end


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


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


 316  if isequal(col,'m')


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


 318  end


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


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


 321  end


 322 


 323  PlotData=[];%default


[177]  324 


[156]  325  %% MODIFY AN EXISTING OBJECT PLOT


[8]  326  if test_newobj==0;


 327  hh=hplot;


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


[8]  329  if test_line


 330  set(hplot,'XData',xline)


 331  set(hplot,'YData',yline)


[625]  332  %modify subobjects


 333  if isfield(PlotData,'SubObject')


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


 335  if ~isequal(YMax,0)


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


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


 338  end


 339  %complement missing points


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


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


 342  if ishandle(PlotData.SubObject(ii))


 343  delete(PlotData.SubObject(ii))


 344  end


 345  end


 346  end


 347  % NbDeformPoint=nbpoints;


 348 


 349  if nbpoints>length(PlotData.SubObject)


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


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


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


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


 354  end


 355  end


 356  end


 357  elseif length(PlotData.SubObject)==2


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


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


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


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


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


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


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


 365  end


[8]  366  end


 367  if isfield(PlotData,'DeformPoint')


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


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


 370  for ii=nbpoints+1:NbDeformPoint;


 371  if ishandle(PlotData.DeformPoint(ii))


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


[625]  373  end


 374  end


 375  NbDeformPoint=nbpoints;


 376  end


 377  for ipt=1:NbDeformPoint


 378  if ishandle(PlotData.DeformPoint(ipt))


 379  if nbpoints>=ipt


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


 381  end


[625]  382  end


 383  end


 384  if nbpoints>length(PlotData.DeformPoint)


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


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


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


[625]  388  end


 389  set(hplot,'UserData',PlotData)


 390  end


[8]  391  end


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


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


[8]  394  end


[625]  395  if test_patch


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


[655]  397  if ~ishandle(PlotData.SubObject(iobj))


 398  hold on


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


 400  set(hhh,'AlphaData',(flag)*0.2)% set partial transparency to the filling color


 401  PlotData.SubObject(iobj)=hhh;


 402  else


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


 404  if isequal(objtype,'image')


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


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


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


 408  end


[8]  409  end


[655]  410  end


 411  else% no patch image requested, erase existing ones


[680]  412  if isfield(PlotData,'SubObject')


[655]  413  for iobj=1:length(PlotData.SubObject)


 414  if ishandle(PlotData.SubObject(iobj)) && strcmp(get(PlotData.SubObject(iobj),'Type'),'image')


 415  delete(PlotData.SubObject(iobj))


 416  end


[8]  417  end


[680]  418  end


[8]  419  end


 420  end


 421 


[156]  422  %% create the object


[8]  423  if test_newobj


[231]  424  % axes(haxes)


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


 426  for iobj=1:length(hother)


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


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


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


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


 431  end


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


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


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


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


 436  else


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


 438  end


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


 440  end


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


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


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


[625]  444  switch ObjectData.Type


 445  case 'points'


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


 447  for ipt=1:length(xline)


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


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


 450  %create circle around each point


 451  if ~isequal(YMax,0)


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


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


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


 455  end


[8]  456  end


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


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


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


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


 461  for ipt=1:sizcoord(1)


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


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


 464  end


 465  case {'plane','volume'}


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


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


 468  case 'rectangle'


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


 470  case 'ellipse'


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


[625]  472  otherwise


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


 474  return


[8]  475  end


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


[187]  477  if test_patch


 478  hold on


[8]  479  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]  480  set(hhh,'AlphaData',(flag)*0.2)% set partial transparency to the filling color


 481  PlotData.SubObject=hhh;


 482  end


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


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


 485  end


 486  if isfield(PlotData,'DeformPoint')


 487  for ipt=1:sizcoord(1)


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


 489  end


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


 491  end


 492  end


 493  set(hh,'UserData',PlotData)

