source: trunk/src/plot_object.m @ 1039

Last change on this file since 1039 was 1027, checked in by g7moreau, 6 years ago
  • Update Copyright 2017 -> 2018
File size: 21.8 KB
Line 
1%'plot_object': draws a projection object (points, line, plane...)
2%-------------------------------------------------------------------
3% function hh=plot_object(ObjectData,ProjObject,hplot,col)
4%
5%OUTPUT
6%             hh: handles of the graphic object (core part)
7%
8%INPUT:
9%
10% ObjectData: structure representing the object properties:
11%        .Type : style of projection object
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%=======================================================================
23% Copyright 2008-2018, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
24%   http://www.legi.grenoble-inp.fr
25%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
26%
27%     This file is part of the toolbox UVMAT.
28%
29%     UVMAT is free software; you can redistribute it and/or modify
30%     it under the terms of the GNU General Public License as published
31%     by the Free Software Foundation; either version 2 of the license,
32%     or (at your option) any later version.
33%
34%     UVMAT is distributed in the hope that it will be useful,
35%     but WITHOUT ANY WARRANTY; without even the implied warranty of
36%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37%     GNU General Public License (see LICENSE.txt) for more details.
38%=======================================================================
39
40function [hh]=plot_object(ObjectData,ProjObject,hplot,col)
41
42%% default output
43hh=[];%default output
44% object representation is canceled if the field is not projected on a plane or is the same as the represented object
45if ~isfield(ObjectData,'Type')|| isequal(ProjObject,ObjectData)||~isfield(ProjObject,'Type')|| ~strcmp(ProjObject.Type,'plane')
46    if ~isempty(hplot) && ishandle(hplot) && ~strcmp(get(hplot,'Type'),'axes')
47        ObjectPlotData=get(hplot,'UserData');
48        if isfield(ObjectPlotData,'SubObject') & ishandle(ObjectPlotData.SubObject)
49            delete(ObjectPlotData.SubObject);
50        end
51        if isfield(ObjectPlotData,'DeformPoint') & ishandle(ObjectPlotData.DeformPoint)
52            delete(ObjectPlotData.DeformPoint);
53        end
54        delete(hplot)
55    end
56    return
57end
58XMin=0;%default range for the graph
59XMax=0;
60YMin=0;
61YMax=0;
62ZMin=0;
63ZMax=0;
64XMinRange=[];%default range set by input
65XMaxRange=[];
66YMinRange=[];
67YMaxRange=[];
68ZMinRange=[];
69ZMaxRange=[];
70
71%% determine the plotting axes (with handle 'haxes')
72test_newobj=1;
73if ishandle(hplot)
74    if isequal(get(hplot,'Tag'),'proj_object')% hplot is the handle of an object representation 
75        test_newobj=0;
76        haxes=get(hplot,'parent');
77        currentfig=get(haxes,'parent');
78    elseif isequal(get(hplot,'Type'),'axes')% hplot is the handle of an axis
79        haxes=hplot;
80        currentfig=get(hplot,'parent');
81    elseif isequal(get(hplot,'Type'),'figure')% hplot is the handle of a figure
82        set(0,'CurrentFigure',hplot);%set the input figure as the current one
83        haxes=findobj(hplot,'Type','axes');%look for axes in the figure
84        haxes=haxes(1);
85        currentfig=hplot;
86    else
87        currentfig=figure; %create new figure
88        hplot=axes;%create new axes
89        haxes=hplot;
90    end
91else
92    currentfig=figure; %create new figure
93    hplot=axes;%create new axes
94    haxes=hplot;
95end
96set(0,'CurrentFigure',currentfig)%set the currentfigure as the current one
97set(currentfig,'CurrentAxes',haxes);%set the current axes in the current figure
98
99%% default input parameters
100if ~isfield(ObjectData,'ProjMode')||isempty(ObjectData.ProjMode)
101     ObjectData.ProjMode='projection';%default
102end
103if ~isfield(ObjectData,'Coord')||isempty(ObjectData.Coord)
104     ObjectData.Coord=[0 0 0];%default
105end
106if isfield(ObjectData,'RangeX') && ~isempty(ObjectData.RangeX)
107    XMax=max(ObjectData.RangeX);
108    XMin=min(ObjectData.RangeX);
109        XMaxRange=max(ObjectData.RangeX);
110        if numel(ObjectData.RangeX)==2
111    XMinRange=min(ObjectData.RangeX);
112        end
113end
114if isfield(ObjectData,'RangeY')&&~isempty(ObjectData.RangeY)
115    YMax=max(ObjectData.RangeY);
116    YMin=min(ObjectData.RangeY);
117        YMaxRange=max(ObjectData.RangeY);
118        if numel(ObjectData.RangeY)==2
119    YMinRange=min(ObjectData.RangeY);
120        end
121end
122if isfield(ObjectData,'RangeZ')&&~isempty(ObjectData.RangeZ)
123    ZMax=max(ObjectData.RangeZ);
124    ZMin=min(ObjectData.RangeZ);
125    ZMaxRange=max(ObjectData.RangeZ);
126    ZMinRange=min(ObjectData.RangeZ);
127end
128if strcmp(ObjectData.Type,'points') && strcmp(ObjectData.ProjMode,'projection')
129    YMax=max(XMax,YMax);
130    YMax=max(YMax,ZMax);
131end
132sizcoord=size(ObjectData.Coord);
133
134%% determine the coordinates xline, yline,xsup,xinf, yinf,ysup determining the new object plot
135%test_line= isequal(ObjectData.Type,'points')||isequal(ObjectData.Type,'line')||...
136%   isequal(ObjectData.Type,'polyline')||isequal(ObjectData.Type,'polygon')|| isequal(ObjectData.Type,'plane')|| isequal(ObjectData.Type,'volume');
137%test_patch=isequal(ObjectData.ProjMode,'inside')||isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData.Type,'volume')...
138%    ||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside');
139test_line=ismember(ObjectData.Type,{'points','line','polyline','polygon','plane','plane_z','volume'});
140test_patch=ismember(ObjectData.ProjMode,{'inside','outside','mask_inside','mask_outside'});
141if test_line
142    xline=ObjectData.Coord(:,1);
143    yline=ObjectData.Coord(:,2);
144    nbpoints=numel(xline);
145    switch ObjectData.Type
146        case 'line_x'
147            xline=[xline; ObjectData.RangeX(2)];%creating the line
148            yline=[yline; ObjectData.RangeY(2)];%creating the line
149        case 'polygon'
150            xline=[xline; ObjectData.Coord(1,1)];%closing the line
151            yline=[yline; ObjectData.Coord(1,2)];
152        case {'plane','plane_z','volume'}
153            if ~isfield(ObjectData,'Angle')
154                ObjectData.Angle=[0 0];
155            end
156            cosphi=cos(ObjectData.Angle(1)*pi/180);%angle in radians
157            sinphi=sin(ObjectData.Angle(1)*pi/180);%angle in radians
158            x0=xline(1); y0=yline(1);
159            xlim=get(haxes,'XLim');
160            ylim=get(haxes,'YLim');
161            graph_scale=max(abs(xlim(2)-xlim(1)),abs(ylim(2)-ylim(1)))/2;% estimate the length of axes plots
162            XMax=graph_scale;
163            YMax=graph_scale;
164            XMin=-graph_scale;
165            YMin=-graph_scale;
166            if  ~isempty(XMaxRange)
167                XMax=XMaxRange;
168            end
169            if  ~isempty(XMinRange)
170                XMin=XMinRange;
171            end
172            if  ~isempty(YMaxRange)
173                YMax=YMaxRange;
174            end
175            if  ~isempty(YMinRange)
176                YMin=YMinRange;
177            end
178            % axes lines
179            xline=NaN(1,13);
180            xline(1)=x0+min(0,XMin)*cosphi; % min end of the x axes
181            yline(1)=y0+min(0,XMin)*sinphi;
182            xline(2)=x0+XMax*cosphi;% max end of the x axes
183            yline(2)=y0+XMax*sinphi;
184            xline(8)=x0-min(0,YMin)*sinphi;% min end of the y axes
185            yline(8)=y0+min(0,YMin)*cosphi;
186            xline(9)=x0-YMax*sinphi;% max end of the y axes
187            yline(9)=y0+YMax*cosphi;
188           
189            %arrows on x axis
190            arrow_scale=graph_scale/20;
191            phi=acos(cosphi);
192            xline(3)=xline(2)-arrow_scale*cos(phi-pi/8);
193            yline(3)=yline(2)-arrow_scale*sin(phi-pi/8);
194            xline(5)=xline(2);
195            yline(5)=yline(2);
196            xline(6)=xline(2)-arrow_scale*cos(phi+pi/8);
197            yline(6)=yline(2)-arrow_scale*sin(phi+pi/8);
198           
199            %arrows on y axis
200            xline(10)=xline(9)-arrow_scale*cos(phi+pi/2-pi/8);
201            yline(10)=yline(9)-arrow_scale*sin(phi+pi/2-pi/8);
202            xline(12)=xline(9);
203            yline(12)=yline(9);
204            xline(13)=xline(9)-arrow_scale*cos(phi+pi/2+pi/8);
205            yline(13)=yline(9)-arrow_scale*sin(phi+pi/2+pi/8);
206            %xline=[Xbeg_x Xend_x NaN Ybeg_x Yend_x];
207            %yline=[Xbeg_y Xend_y NaN Ybeg_y Yend_y];
208            %  dashed lines indicating bounds
209            xsup=NaN(1,5);
210            ysup=NaN(1,5);
211            if ~isempty(XMaxRange)
212                xsup(1)=xline(2)-YMin*sin(phi);
213                ysup(1)=yline(2)+YMin*cos(phi);
214                xsup(2)=xline(2)-YMax*sin(phi);
215                ysup(2)=yline(2)+YMax*cos(phi);
216            end
217            if ~isempty(YMaxRange)
218                xsup(2)=xline(2)-YMax*sin(phi);
219                ysup(2)=yline(2)+YMax*cos(phi);
220                xsup(3)=xline(9)+XMin*cos(phi);
221                ysup(3)=yline(9)+XMin*sin(phi);
222            end
223            if ~isempty(XMinRange)
224                xsup(3)=xline(9)+XMin*cos(phi);
225                ysup(3)=yline(9)+XMin*sin(phi);
226                xsup(4)=x0+XMin*cos(phi)-YMin*sin(phi);
227                ysup(4)=y0+XMin*sin(phi)+YMin*cos(phi);
228            end
229            if ~isempty(YMinRange)
230                xsup(4)=x0+XMin*cos(phi)-YMin*sin(phi);
231                ysup(4)=y0+XMin*sin(phi)+YMin*cos(phi);
232                xsup(5)=xline(8)-YMin*sin(phi);
233                ysup(5)=yline(8)+YMin*cos(phi);
234            end
235    end
236end
237SubLineStyle='none';%default
238if isfield(ObjectData,'ProjMode')
239    if isequal(ObjectData.ProjMode,'projection')
240        SubLineStyle='--'; %range of projection marked by dash
241        if isfield (ObjectData,'DX')
242            ObjectData=rmfield(ObjectData,'DX');
243        end
244        if isfield (ObjectData,'DY')
245            ObjectData=rmfield(ObjectData,'DY');
246        end
247    elseif isequal(ObjectData.ProjMode,'filter')
248        SubLineStyle=':';%range of projection not visible
249    end
250end
251if ismember(ObjectData.Type,{'line','polyline','polygon'})
252    if length(xline)<2
253        theta=0;
254    else
255        theta=angle(diff(xline)+1i*diff(yline));
256        theta(length(xline))=theta(length(xline)-1);
257    end
258    xsup(1)=xline(1)+YMax*sin(theta(1));
259    xinf(1)=xline(1)-YMax*sin(theta(1));
260    ysup(1)=yline(1)-YMax*cos(theta(1));
261    yinf(1)=yline(1)+YMax*cos(theta(1));
262    for ip=2:length(xline)
263        xsup(ip)=xline(ip)+YMax*sin((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
264        xinf(ip)=xline(ip)-YMax*sin((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
265        ysup(ip)=yline(ip)-YMax*cos((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
266        yinf(ip)=yline(ip)+YMax*cos((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
267    end
268end
269
270%% shading image
271if test_patch
272    npMx=512;
273    npMy=512; 
274    flag=zeros(npMy,npMx);
275    if isequal(ObjectData.Type,'ellipse')
276        XimaMin=ObjectData.Coord(1,1)-XMax;
277        XimaMax=ObjectData.Coord(1,1)+XMax;
278        YimaMin=ObjectData.Coord(1,2)-YMax;
279        YimaMax=ObjectData.Coord(1,2)+YMax;
280        xlim=[1.2*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];%create an image around the ellipse
281        ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.2*YimaMin];
282        scale_x=2*1.4*XMax/npMx;
283        scale_y=2*1.4*YMax/npMy;
284        xi=(0.5:npMx-0.5)*scale_x+xlim(1);
285        yi=(0.5:npMy-0.5)*scale_y+ylim(1);
286        [Xi,Yi]=meshgrid(xi,yi);
287        X2Max=XMax*XMax;
288        Y2Max=YMax*YMax;
289        distX=(Xi-ObjectData.Coord(1,1));
290        distY=(Yi-ObjectData.Coord(1,2));
291        flag=(distX.*distX/X2Max+distY.*distY/Y2Max)<1;
292    elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'volume')
293        XimaMin=ObjectData.Coord(1,1)-XMax;
294        XimaMax=ObjectData.Coord(1,1)+XMax;
295        YimaMin=ObjectData.Coord(1,2)-YMax;
296        YimaMax=ObjectData.Coord(1,2)+YMax;
297        xlim=[1.2*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];%create an image around the ellipse
298        ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.2*YimaMin];
299        scale_x=2*1.4*XMax/npMx;
300        scale_y=2*1.4*YMax/npMy;
301        xi=(0.5:npMx-0.5)*scale_x+xlim(1);
302        yi=(0.5:npMy-0.5)*scale_y+ylim(1);
303        [Xi,Yi]=meshgrid(xi,yi);
304        distX=abs(Xi-ObjectData.Coord(1,1));
305        distY=abs(Yi-ObjectData.Coord(1,2));
306        flag=distX<XMax & distY< YMax;
307    elseif isequal(ObjectData.Type,'polygon')
308        XimaMin=min(ObjectData.Coord(:,1));
309        XimaMax=max(ObjectData.Coord(:,1));
310        YimaMin=min(ObjectData.Coord(:,2));
311        YimaMax=max(ObjectData.Coord(:,2));
312        xlim=[1.2*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];
313        ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.2*YimaMin];
314        [Xlim,Ylim]=meshgrid(linspace(xlim(1),xlim(2),npMx),linspace(ylim(1),ylim(2),npMy));
315        %flag=roipoly(xlim,ylim,flag,ObjectData.Coord(:,1),ObjectData.Coord(:,2));%=1 inside the polygon, 0 outsid
316        flag=inpolygon(Xlim,Ylim,ObjectData.Coord(:,1),ObjectData.Coord(:,2));%=1 inside the polygon, 0 outsid
317    end
318    if isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData.ProjMode,'mask_outside')
319        flag=~flag;
320    end
321    imflag=zeros(npMx,npMy,3);
322    imflag(:,:,3)=flag; % blue color
323    if isequal(col,'m')
324         imflag(:,:,1)=flag; % magenta color
325    end
326    dx=(xlim(2)-xlim(1))/npMx;
327    dy=(ylim(2)-ylim(1))/npMy;
328end
329
330PlotData=[];%default
331
332%% MODIFY AN EXISTING OBJECT PLOT
333if test_newobj==0;
334    hh=hplot;
335    PlotData=get(hplot,'UserData');
336    if test_line
337        set(hplot,'XData',xline)
338        set(hplot,'YData',yline)
339        %modify subobjects
340        if isfield(PlotData,'SubObject')
341            if isequal(ObjectData.Type,'points')
342                if ~isequal(YMax,0)
343                    for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1))
344                        set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax])
345                    end
346                    %complement missing points
347                    if length(PlotData.SubObject)>nbpoints% fpoints in excess on the graph
348                        for ii=nbpoints+1: length(PlotData.SubObject);
349                            if ishandle(PlotData.SubObject(ii))
350                                delete(PlotData.SubObject(ii))
351                            end
352                        end
353                    end
354                    %                NbDeformPoint=nbpoints;
355                   
356                    if nbpoints>length(PlotData.SubObject)
357                        for ipt=length(PlotData.SubObject)+1:nbpoints
358                            PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
359                                'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
360                                'LineStyle',SubLineStyle,'Tag','proj_object');
361                        end
362                    end
363                end
364            elseif length(PlotData.SubObject)==2
365                set(PlotData.SubObject(1),'XData',xinf);
366                set(PlotData.SubObject(1),'YData',yinf);
367                set(PlotData.SubObject(2),'XData',xsup);
368                set(PlotData.SubObject(2),'YData',ysup);
369            elseif length(PlotData.SubObject)==1
370                set(PlotData.SubObject(1),'XData',xsup);
371                set(PlotData.SubObject(1),'YData',ysup);
372            end
373        end
374        if isfield(PlotData,'DeformPoint')
375            NbDeformPoint=length(PlotData.DeformPoint);
376            if NbDeformPoint>nbpoints% fpoints in excess on the graph
377                for ii=nbpoints+1:NbDeformPoint;
378                    if ishandle(PlotData.DeformPoint(ii))
379                        delete(PlotData.DeformPoint(ii))
380                    end
381                end
382                NbDeformPoint=nbpoints;
383            end
384            for ipt=1:NbDeformPoint
385                if ishandle(PlotData.DeformPoint(ipt))
386                    if nbpoints>=ipt
387                        set(PlotData.DeformPoint(ipt),'XData',xline(ipt),'YData',yline(ipt));
388                    end
389                end
390            end
391            if nbpoints>length(PlotData.DeformPoint)
392                for ipt=length(PlotData.DeformPoint)+1:nbpoints
393                    PlotData.DeformPoint(ipt)=line(xline(ipt),yline(ipt),'Color',col,'LineStyle','-','Tag','DeformPoint',...
394                        'SelectionHighlight','off','UserData',hplot);
395                end
396                set(hplot,'UserData',PlotData)
397            end
398        end
399    elseif (isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse'))&&XMax>0 && YMax>0
400        set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax])
401    end
402    if test_patch
403        if isfield(PlotData,'SubObject')
404        for iobj=1:length(PlotData.SubObject)
405            if ~ishandle(PlotData.SubObject(iobj))
406                hold on
407                hhh=image([xlim(1)+dx/2 xlim(2)-dx/2],[ylim(1)+dy/2 ylim(2)-dy/2],imflag,'Tag','proj_object','HitTest','off');
408                set(hhh,'AlphaData',(flag)*0.2)% set partial transparency to the filling color
409                PlotData.SubObject(iobj)=hhh;
410            else
411                objtype=get(PlotData.SubObject(iobj),'Type');
412                if isequal(objtype,'image')
413                    set(PlotData.SubObject(iobj),'CData',imflag,'AlphaData',(flag)*0.2)
414                    set(PlotData.SubObject(iobj),'XData',[xlim(1)+dx/2 xlim(2)-dx/2])
415                    set(PlotData.SubObject(iobj),'YData',[ylim(1)+dy/2 ylim(2)-dy/2])
416                end
417            end
418        end
419        end
420    else% no patch image requested, erase existing ones
421        if isfield(PlotData,'SubObject')
422            for iobj=1:length(PlotData.SubObject)
423                if ishandle(PlotData.SubObject(iobj)) && strcmp(get(PlotData.SubObject(iobj),'Type'),'image')
424                    delete(PlotData.SubObject(iobj))
425                end
426            end
427        end
428    end
429end
430
431%% create the object
432if test_newobj
433%     axes(haxes)
434    hother=findobj('Tag','proj_object');%find all the proj objects
435    for iobj=1:length(hother)
436        if strcmp(get(hother(iobj),'Type'),'rectangle')|| strcmp(get(hother(iobj),'Type'),'patch')
437            set(hother(iobj),'EdgeColor','b')
438            if isequal(get(hother(iobj),'FaceColor'),'m')
439                set(hother(iobj),'FaceColor','b')
440            end
441        elseif isequal(get(hother(iobj),'Type'),'image')
442               Acolor=get(hother(iobj),'CData');
443               Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));
444               set(hother(iobj),'CData',Acolor);
445        else
446             set(hother(iobj),'Color','b')
447        end
448        set(hother(iobj),'Selected','off')
449    end
450    hother=findobj('Tag','DeformPoint');
451    set(hother,'Color','b');
452    set(hother,'Selected','off') 
453    switch ObjectData.Type
454        case 'points'
455            hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','none','Marker','+');
456            for ipt=1:length(xline)
457                PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
458                    col,'LineStyle','none','SelectionHighlight','off','UserData',hh,'Tag','DeformPoint');
459                %create circle around each point
460                if ~isequal(YMax,0)
461                    PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
462                        'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
463                        'LineStyle',SubLineStyle,'Tag','proj_object');
464                end
465            end
466        case {'line','polyline','polygon'}
467            hh=line(xline,yline,'Color',col);
468                PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
469                PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
470                for ipt=1:sizcoord(1)
471                    PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
472                        col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
473                end
474        case {'plane','volume','plane_z'}
475            hh=line(xline,yline,'Color',col);
476            PlotData.SubObject(1)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
477        case 'rectangle'
478            hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'LineWidth',2,'EdgeColor',col);
479        case 'ellipse'
480            hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col,'LineWidth',2);
481        otherwise
482            msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m')
483            return
484    end
485    set(hh,'Tag','proj_object')
486     if test_patch
487         hold on
488        hhh=image([xlim(1)+dx/2 xlim(2)-dx/2],[ylim(1)+dy/2 ylim(2)-dy/2],imflag,'Tag','proj_object','HitTest','off');
489       set(hhh,'AlphaData',(flag)*0.2)% set partial transparency to the filling color
490         PlotData.SubObject=hhh;   
491     end
492    if isfield(PlotData,'SubObject')
493        set(PlotData.SubObject,'UserData',hh)%record the parent handles in the SubObjects
494    end
495    if isfield(PlotData,'DeformPoint')
496        for ipt=1:sizcoord(1)
497            set(PlotData.DeformPoint(ipt),'UserData',hh);%record the parent handles in the SubObjects
498        end
499        set(PlotData.DeformPoint,'UserData',hh)%record the parent handles in the SubObjects
500    end
501end
502set(hh,'UserData',PlotData)
Note: See TracBrowser for help on using the repository browser.