source: trunk/src/plot_object.m @ 655

Last change on this file since 655 was 655, checked in by sommeria, 11 years ago

various bugs corrected

File size: 21.3 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%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
23%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.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
38function [hh]=plot_object(ObjectData,ProjObject,hplot,col)
39
40%% default output
41hh=[];%default output
42% object representation is canceled if the field is not projected on a plane or is the same as the represented object
43if ~isfield(ObjectData,'Type')|| isequal(ProjObject,ObjectData)||~isfield(ProjObject,'Type')|| ~strcmp(ProjObject.Type,'plane')
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
55end
56XMin=0;%default range for the graph
57XMax=0;
58YMin=0;
59YMax=0;
60ZMin=0;
61ZMax=0;
62XMinRange=[];%default range set by input
63XMaxRange=[];
64YMinRange=[];
65YMaxRange=[];
66ZMinRange=[];
67ZMaxRange=[];
68
69%% determine the plotting axes (with handle 'haxes')
70test_newobj=1;
71if ishandle(hplot)
72    if isequal(get(hplot,'Tag'),'proj_object')% hplot is the handle of an object representation 
73        test_newobj=0;
74        haxes=get(hplot,'parent');
75        currentfig=get(haxes,'parent');
76    elseif isequal(get(hplot,'Type'),'axes')% hplot is the handle of an axis
77        haxes=hplot;
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
81        haxes=findobj(hplot,'Type','axes');%look for axes in the figure
82        haxes=haxes(1);
83        currentfig=hplot;
84    else
85        currentfig=figure; %create new figure
86        hplot=axes;%create new axes
87        haxes=hplot;
88    end
89else
90    currentfig=figure; %create new figure
91    hplot=axes;%create new axes
92    haxes=hplot;
93end
94set(0,'CurrentFigure',currentfig)%set the currentfigure as the current one
95set(currentfig,'CurrentAxes',haxes);%set the current axes in the current figure
96
97%% default input parameters
98if ~isfield(ObjectData,'ProjMode')||isempty(ObjectData.ProjMode)
99     ObjectData.ProjMode='projection';%default
100end
101if ~isfield(ObjectData,'Coord')||isempty(ObjectData.Coord)
102     ObjectData.Coord=[0 0 0];%default
103end
104if isfield(ObjectData,'RangeX') && ~isempty(ObjectData.RangeX)
105    XMax=max(ObjectData.RangeX);
106    XMin=min(ObjectData.RangeX);
107        XMaxRange=max(ObjectData.RangeX);
108        if numel(ObjectData.RangeX)==2
109    XMinRange=min(ObjectData.RangeX);
110        end
111end
112if isfield(ObjectData,'RangeY')&&~isempty(ObjectData.RangeY)
113    YMax=max(ObjectData.RangeY);
114    YMin=min(ObjectData.RangeY);
115        YMaxRange=max(ObjectData.RangeY);
116        if numel(ObjectData.RangeY)==2
117    YMinRange=min(ObjectData.RangeY);
118        end
119end
120if isfield(ObjectData,'RangeZ')&&~isempty(ObjectData.RangeZ)
121    ZMax=max(ObjectData.RangeZ);
122    ZMin=min(ObjectData.RangeZ);
123    ZMaxRange=max(ObjectData.RangeZ);
124    ZMinRange=min(ObjectData.RangeZ);
125end
126if strcmp(ObjectData.Type,'points') && strcmp(ObjectData.ProjMode,'projection')
127    YMax=max(XMax,YMax);
128    YMax=max(YMax,ZMax);
129end
130sizcoord=size(ObjectData.Coord);
131
132%% determine the coordinates xline, yline,xsup,xinf, yinf,ysup determining the new object plot
133test_line= isequal(ObjectData.Type,'points')||isequal(ObjectData.Type,'line')||...
134    isequal(ObjectData.Type,'polyline')||isequal(ObjectData.Type,'polygon')|| isequal(ObjectData.Type,'plane')|| isequal(ObjectData.Type,'volume');
135test_patch=isequal(ObjectData.ProjMode,'inside')||isequal(ObjectData.ProjMode,'outside')||isequal(ObjectData.Type,'volume')...
136    ||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside');
137if test_line
138    xline=ObjectData.Coord(:,1);
139    yline=ObjectData.Coord(:,2);
140    nbpoints=numel(xline);
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')
145        xline=[xline; ObjectData.Coord(1,1)];%closing the line
146        yline=[yline; ObjectData.Coord(1,2)];
147    elseif isequal(ObjectData.Type,'plane')|| isequal(ObjectData.Type,'volume')
148        if ~isfield(ObjectData,'Angle')
149            ObjectData.Angle=[0 0 0];
150        end
151        phi=ObjectData.Angle(3)*pi/180;%angle in radians
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)=x0-min(0,YMin)*sin(phi);% min end of the y axes
179        yline(8)=y0+min(0,YMin)*cos(phi);
180        xline(9)=x0-YMax*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(phi-pi/8);
186        yline(3)=yline(2)-arrow_scale*sin(phi-pi/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/2-pi/8);
194        yline(10)=yline(9)-arrow_scale*sin(phi+pi/2-pi/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
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')
234               ObjectData=rmfield(ObjectData,'DX');
235            end
236            if isfield (ObjectData,'DY')
237               ObjectData=rmfield(ObjectData,'DY');
238            end
239        elseif isequal(ObjectData.ProjMode,'filter')
240            SubLineStyle=':';%range of projection not visible
241        end
242    end
243    if isequal(ObjectData.Type,'line')||isequal(ObjectData.Type,'polyline')||isequal(ObjectData.Type,'polygon')
244        if length(xline)<2
245            theta=0;
246        else
247            theta=angle(diff(xline)+1i*diff(yline));
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(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
256            xinf(ip)=xline(ip)-YMax*sin((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
257            ysup(ip)=yline(ip)-YMax*cos((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
258            yinf(ip)=yline(ip)+YMax*cos((theta(ip)+theta(ip-1))/2)/cos((theta(ip-1)-theta(ip))/2);
259        end
260    end
261end
262
263%% shading image
264if test_patch
265    npMx=512;
266    npMy=512; 
267    flag=zeros(npMy,npMx);
268    if isequal(ObjectData.Type,'ellipse')
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*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];%create an image around the ellipse
274        ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.2*YimaMin];
275        scale_x=2*1.4*XMax/npMx;
276        scale_y=2*1.4*YMax/npMy;
277        xi=(0.5:npMx-0.5)*scale_x+xlim(1);
278        yi=(0.5:npMy-0.5)*scale_y+ylim(1);
279        [Xi,Yi]=meshgrid(xi,yi);
280        X2Max=XMax*XMax;
281        Y2Max=YMax*YMax;
282        distX=(Xi-ObjectData.Coord(1,1));
283        distY=(Yi-ObjectData.Coord(1,2));
284        flag=(distX.*distX/X2Max+distY.*distY/Y2Max)<1;
285    elseif isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'volume')
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*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];%create an image around the ellipse
291        ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.2*YimaMin];
292        scale_x=2*1.4*XMax/npMx;
293        scale_y=2*1.4*YMax/npMy;
294        xi=(0.5:npMx-0.5)*scale_x+xlim(1);
295        yi=(0.5:npMy-0.5)*scale_y+ylim(1);
296        [Xi,Yi]=meshgrid(xi,yi);
297        distX=abs(Xi-ObjectData.Coord(1,1));
298        distY=abs(Yi-ObjectData.Coord(1,2));
299        flag=distX<XMax & distY< YMax;
300    elseif isequal(ObjectData.Type,'polygon')
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*XimaMin-0.2*XimaMax 1.2*XimaMax-0.2*XimaMin];
306        ylim=[1.2*YimaMin-0.2*YimaMax 1.2*YimaMax-0.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;
321end
322
323PlotData=[];%default
324
325%% MODIFY AN EXISTING OBJECT PLOT
326if test_newobj==0;
327    hh=hplot;
328    PlotData=get(hplot,'UserData');
329    if test_line
330        set(hplot,'XData',xline)
331        set(hplot,'YData',yline)
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
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);
362            elseif length(PlotData.SubObject)==1
363                set(PlotData.SubObject(1),'XData',xsup);
364                set(PlotData.SubObject(1),'YData',ysup);
365            end
366        end
367        if isfield(PlotData,'DeformPoint')
368            NbDeformPoint=length(PlotData.DeformPoint);
369            if NbDeformPoint>nbpoints% fpoints in excess on the graph
370                for ii=nbpoints+1:NbDeformPoint;
371                    if ishandle(PlotData.DeformPoint(ii))
372                        delete(PlotData.DeformPoint(ii))
373                    end
374                end
375                NbDeformPoint=nbpoints;
376            end
377            for ipt=1:NbDeformPoint
378                if ishandle(PlotData.DeformPoint(ipt))
379                    if nbpoints>=ipt
380                        set(PlotData.DeformPoint(ipt),'XData',xline(ipt),'YData',yline(ipt));
381                    end
382                end
383            end
384            if nbpoints>length(PlotData.DeformPoint)
385                for ipt=length(PlotData.DeformPoint)+1:nbpoints
386                    PlotData.DeformPoint(ipt)=line(xline(ipt),yline(ipt),'Color',col,'LineStyle','.','Tag','DeformPoint',...
387                        'SelectionHighlight','off','UserData',hplot);
388                end
389                set(hplot,'UserData',PlotData)
390            end
391        end
392    elseif (isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse'))&&XMax>0 && YMax>0
393        set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax])
394    end
395    if test_patch
396        for iobj=1:length(PlotData.SubObject)
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
409            end
410        end     
411    else% no patch image requested, erase existing ones
412        for iobj=1:length(PlotData.SubObject)
413            if ishandle(PlotData.SubObject(iobj)) && strcmp(get(PlotData.SubObject(iobj),'Type'),'image')
414                delete(PlotData.SubObject(iobj))
415            end
416        end
417    end
418end
419
420%% create the object
421if test_newobj
422%     axes(haxes)
423    hother=findobj('Tag','proj_object');%find all the proj objects
424    for iobj=1:length(hother)
425        if strcmp(get(hother(iobj),'Type'),'rectangle')|| strcmp(get(hother(iobj),'Type'),'patch')
426            set(hother(iobj),'EdgeColor','b')
427            if isequal(get(hother(iobj),'FaceColor'),'m')
428                set(hother(iobj),'FaceColor','b')
429            end
430        elseif isequal(get(hother(iobj),'Type'),'image')
431               Acolor=get(hother(iobj),'CData');
432               Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2));
433               set(hother(iobj),'CData',Acolor);
434        else
435             set(hother(iobj),'Color','b')
436        end
437        set(hother(iobj),'Selected','off')
438    end
439    hother=findobj('Tag','DeformPoint');
440    set(hother,'Color','b');
441    set(hother,'Selected','off') 
442    switch ObjectData.Type
443        case 'points'
444            hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+');
445            for ipt=1:length(xline)
446                PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
447                    col,'LineStyle','.','SelectionHighlight','off','UserData',hh,'Tag','DeformPoint');
448                %create circle around each point
449                if ~isequal(YMax,0)
450                    PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
451                        'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
452                        'LineStyle',SubLineStyle,'Tag','proj_object');
453                end
454            end
455        case {'line','polyline','polygon'}
456            hh=line(xline,yline,'Color',col);
457                PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
458                PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
459                for ipt=1:sizcoord(1)
460                    PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
461                        col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
462                end
463        case {'plane','volume'}
464            hh=line(xline,yline,'Color',col);
465            PlotData.SubObject(1)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
466        case 'rectangle'
467            hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'LineWidth',2,'EdgeColor',col);
468        case 'ellipse'
469            hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);
470        otherwise
471            msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m')
472            return
473    end
474    set(hh,'Tag','proj_object')
475     if test_patch
476         hold on
477        hhh=image([xlim(1)+dx/2 xlim(2)-dx/2],[ylim(1)+dy/2 ylim(2)-dy/2],imflag,'Tag','proj_object','HitTest','off');
478       set(hhh,'AlphaData',(flag)*0.2)% set partial transparency to the filling color
479         PlotData.SubObject=hhh;   
480     end
481    if isfield(PlotData,'SubObject')
482        set(PlotData.SubObject,'UserData',hh)%record the parent handles in the SubObjects
483    end
484    if isfield(PlotData,'DeformPoint')
485        for ipt=1:sizcoord(1)
486            set(PlotData.DeformPoint(ipt),'UserData',hh);%record the parent handles in the SubObjects
487        end
488        set(PlotData.DeformPoint,'UserData',hh)%record the parent handles in the SubObjects
489    end
490end
491set(hh,'UserData',PlotData)
Note: See TracBrowser for help on using the repository browser.