source: trunk/src/mouse_motion.m @ 664

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

a few bugs corrected: import and retrival of parameters in series. mask in civ_series

File size: 23.1 KB
Line 
1%'mouse_motion': permanently called by mouse motion over a figure (Callback for 'WindowButtonMotionFcn' of the figure)
2%-----------------------------------------------------------------------
3%
4% function mouse_motion(hObject,eventdata,handles)
5% activated by the command:
6% set(hObject,'WindowButtonMotionFcn',{'mouse_motion',handles})
7% where hObject is the handle of the figure
8%
9%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
10%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
11%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
12%     This file is part of the toolbox UVMAT.
13%
14%     UVMAT is free software; you can redistribute it and/or modify
15%     it under the terms of the GNU General Public License as published by
16%     the Free Software Foundation; either version 2 of the License, or
17%     (at your option) any later version.
18%
19%     UVMAT is distributed in the hope that it will be useful,
20%     but WITHOUT ANY WARRANTY; without even the implied warranty of
21%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22%     GNU General Public License (file UVMAT/COPYING.txt) for more details.
23%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
24
25function mouse_motion(hObject,eventdata,handles)
26
27if ~exist('handles','var')
28    return
29end
30FigData=get(hObject,'UserData');
31if ishandle(FigData)% case of a zoom plot, the handle of the parent rectangle is stored in UserData, its parent is the plotting axes of the rectangle
32    hCurrentFig=get(get(FigData,'parent'),'parent');
33else
34    hCurrentFig=hObject;%usual plot
35end
36hhCurrentFig=guidata(hCurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)
37CheckZoom=get(hhCurrentFig.CheckZoom,'Value');% check for zoom on mode
38CheckZoomFig=get(hhCurrentFig.CheckZoomFig,'Value');% check for zoom sub fig creation mode
39hPlotAxes=hhCurrentFig.PlotAxes';% handles of the main plot axes
40AxeData=get(hPlotAxes,'UserData');% data attached to the axis
41htext_display(1)=handles.text_display;
42if isfield(AxeData,'htext_display')&&ishandle(AxeData.htext_display)
43    htext_display(2)=AxeData.htext_display;
44end
45test_draw=0;%test for mouse drawing of object, =0 by default
46if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing)
47    test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active
48end
49test_zoom_draw=0;
50test_object=0; %test for object editing or creation
51test_edit_object=0;% edit test for mouse shap: an arrow
52test_ruler=0;%test for active ruler
53test_transform=0;
54huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle
55if ~isempty(huvmat)
56    hhuvmat=guidata(huvmat);%handles of the elements in uvma
57    test_edit_object=get(hhuvmat.CheckEditObject,'Value');
58    test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');
59    test_transform=~isequal(get(hhuvmat.TransformName,'Value'),1);
60end
61test_piv=0;
62if isfield(FigData,'CivHandle')
63    if ~ishandle(FigData.CivHandle)
64        delete(hObject)
65        return
66    end
67    hhciv=guidata(FigData.CivHandle);
68    test_piv=1;
69end
70
71%find the current axe 'CurrentAxes' and display the current mouse position or uicontrol tag
72text_displ_1='';
73text_displ_2='';
74text_displ_3='';
75text_displ_4='';
76
77% AxeData=[];%default
78xy=[];%default
79xy_fig=get(hObject,'CurrentPoint');% current point of the current figure (gcbo)
80pointershape='arrow';% default pointer is an arrow
81
82%% loop on all the objects in the current figure, detect whether the mouse is over a plot  axes
83hchildren=get(hObject,'Children');%handles of all objects in the current figure
84check_visible=strcmp(get(hchildren,'Visible'),'on');% if visible='on', =0 otherwise
85hchildren=hchildren(check_visible); %kkep only the visible children
86PosChildren=get(hchildren,'Position');% set of object positions
87if iscell(PosChildren)% only one child
88    PosLength=cellfun('length',PosChildren);% set of vector lengths for object positions
89    hchildren=hchildren(PosLength==4);% keep only objects with position defined by a 4 element vector
90    PosChildren=cell2mat(PosChildren(PosLength==4));% convert cells to matrix of positions
91end
92if size(PosChildren,2)~=4
93    return
94end
95xy_fig_mat=ones(size(PosChildren,1),1)*xy_fig;% mouse position set to a matrix
96check_pos=xy_fig_mat >= PosChildren(:,1:2) & xy_fig_mat <= PosChildren(:,1:2)+PosChildren(:,3:4);% compare object to mouse position
97ind_object=find(check_pos(:,1) & check_pos(:,2),1);% select the index of the (first) object under the mouse
98hchild=hchildren(ind_object);% corresponding object handle
99CurrentAxes=[];
100
101%if the mouse is over an axis, look at the data
102if strcmp(get(hchild,'Type'),'axes')
103    CurrentAxes=hchild;
104    xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
105    test_zoom_draw=test_draw && isequal(AxeData.Drawing,'zoom')&& isfield(AxeData,'CurrentOrigin') && isequal(get(gcf,'SelectionType'),'normal');
106    test_object=test_draw && isfield(AxeData,'CurrentObject') && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject);
107    if ~test_edit_object  && ~test_ruler && ~CheckZoom
108        pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis)
109    end
110    FigData=get(hCurrentFig,'UserData');
111    tagaxes=get(CurrentAxes,'tag');
112    if isfield(FigData,tagaxes)
113        Field=FigData.(tagaxes);
114        if isfield(Field,'ListVarName')
115            [CellInfo,NbDimArray]=find_field_cells(Field);%analyse the physical fields contained in Field
116            text_displ_1='';
117            text_displ_2='';
118            text_displ_3='';
119            text_displ_4='';
120            text_displ_5='';
121            ivec=[];
122            xName='';
123            z=[];
124            for icell=1:numel(CellInfo)%look for all physical fields
125                if NbDimArray(icell)>=2 % select 2D field
126                    if  isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&& strcmp(CellInfo{icell}.CoordType,'scattered')%case of unstructured data
127                        X=Field.(Field.ListVarName{CellInfo{icell}.CoordIndex(end)});
128                        Y=Field.(Field.ListVarName{CellInfo{icell}.CoordIndex(end-1)});
129                        flag_vec=(X<(xy(1,1)+Field.CoordMesh/3) & X>(xy(1,1)-Field.CoordMesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse
130                            (Y<(xy(1,2)+Field.CoordMesh/3) & Y>(xy(1,2)-Field.CoordMesh/3));%f
131                        ivec=find(flag_vec,1);% search the (first) selected vector index ivec
132                        hhh=findobj(CurrentAxes,'Tag','vector_marker');
133                        if ~isempty(ivec)
134                            % mark the vectors with a circle in the absence of other operations
135                            if ~test_object && ~test_edit_object && ~test_ruler && ~CheckZoomFig
136                                pointershape='arrow'; %mouse indicates  the detection of a vector
137                                if isempty(hhh)
138                                    set(0,'CurrentFigure',hCurrentFig)
139                                    set(hCurrentFig,'CurrentAxes',CurrentAxes)
140                                    rectangle('Curvature',[1 1],...
141                                        'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh],'EdgeColor','m',...
142                                        'LineStyle','-','Tag','vector_marker');
143                                else
144                                    set(hhh,'Visible','on')
145                                    set(hhh,'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh])
146                                end
147                            end
148                            %display the field values
149                            for ivar=1:numel(CellInfo{icell}.VarIndex)
150                                VarName=Field.ListVarName{CellInfo{icell}.VarIndex(ivar)};
151                                VarVal=Field.(VarName)(ivec);
152                                var_text=[VarName '=' num2str(VarVal,4) ','];
153                                if isequal(ivar,CellInfo{icell}.CoordIndex(end))||isequal(ivar,CellInfo{icell}.CoordIndex(end-1))||isequal(ivar,CellInfo{icell}.CoordIndex(1))
154                                    text_displ_1=[text_displ_1 var_text];
155                                elseif (isfield(CellInfo{icell},'VarIndex_vector_x') && isequal(ivar,CellInfo{icell}.VarIndex_vector_x))||isequal(ivar,CellInfo{icell}.VarIndex_vector_y)||...
156                                        (isfield(CellInfo{icell},'VarIndex_vector_z') && isequal(ivar,CellInfo{icell}.VarIndex_vector_z))
157                                    text_displ_4=[text_displ_4 var_text];
158                                else
159                                    text_displ_5=[text_displ_5 var_text];
160                                end
161                            end
162                        else
163                            if ~isempty(hhh)
164                                set(hhh,'Visible','off')
165                            end
166                        end
167                    elseif strcmp(CellInfo{icell}.CoordType,'grid') %structured coordinates
168                        yName=Field.ListVarName{CellInfo{icell}.CoordIndex(1)};
169                        xName=Field.ListVarName{CellInfo{icell}.CoordIndex(2)};
170                        y=Field.(yName);
171                        x=Field.(xName);
172                        VarName=Field.ListVarName{CellInfo{icell}.VarIndex(1)};
173                        nxy=size(Field.(VarName));
174                        MaxAY=max(y(1),y(end));
175                        MinAY=min(y(1),y(end));
176                        if (xy(1,1)>x(1))&(xy(1,1)<x(end))&(xy(1,2)<MaxAY)&(xy(1,2)>MinAY)
177                            indx0=1+round((nxy(2)-1)*(xy(1,1)-x(1))/(x(end)-x(1))); % index x of pixel
178                            indy0=1+round((nxy(1)-1)*(xy(1,2)-y(1))/(y(end)-y(1))); % index y of pixel
179                            if indx0>=1 & indx0<=nxy(2) & indy0>=1 & indy0<=nxy(1)
180                                text_displ_2=['i='  num2str(indx0) ',j=' num2str(indy0) ','];
181                                for ivar=1:numel(CellInfo{icell}.VarIndex)
182                                    VarName=Field.ListVarName{CellInfo{icell}.VarIndex(ivar)};
183                                    VarVal=Field.(VarName)(indy0,indx0,:);
184                                    var_text=[VarName '=' num2str(VarVal) ','];
185                                    text_displ_4=[text_displ_4 var_text];
186                                end
187                            end
188                        end
189                    end
190                end
191            end
192            % display the current x,y plot coordinates in the absence of detected vector
193            if isempty(ivec)
194                if isempty(xName)
195                    xName='x';
196                    yName='y';
197                end
198                text_displ_1=[xName '=' num2str(xy(1,1),4) ', ' yName '=' num2str(xy(1,2),4) ','];
199            end
200            %display the z coordinate if defined by the projection plane
201            if isfield(Field,'ObjectType') && strcmp(Field.ObjectType,'plane') && isfield(Field,'ObjectCoord') && length(Field.ObjectCoord)>=3
202                pos=[xy(1,1) xy(1,2) 0];
203                if isfield(Field,'ObjectAngle')&&~isequal(Field.ObjectAngle,[0 0 0])
204                    om=norm(Field.ObjectAngle);%norm of rotation angle in radians
205                    OmAxis=Field.ObjectAngle/om; %unit vector marking the rotation axis
206                    cos_om=cos(pi*om/180);
207                    sin_om=sin(pi*om/180);
208                    pos=[xy(1,1) xy(1,2) 0];
209                    pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis;
210                end
211                pos=pos+[Field.ObjectCoord 0];
212                text_displ_3=[text_displ_3 'x,y,z=' num2str(pos,4)];
213            end
214            %                     if ~isempty(z)
215            %                         text_displ_1=[text_displ_1 ' z=' num2str(z,4)];
216            %                     end
217            % case of PIV correlation display
218            if test_piv
219                par=read_GUI(hhciv.Civ1);
220                [dd,ind_pt]=min(abs(Field.X-xy(1,1))+abs(Field.Y-xy(1,2)));
221                xround=Field.X(ind_pt);
222                yround=Field.Y(ind_pt);
223                %                         par.Grid=[xround size(Field.A,1)-yround+1];
224                par.Grid=[xround yround];
225                % mark the correlation box with a rectangle
226                par.ImageA=Field.A;
227                par.ImageB=Field.B;
228                par.ImageHeight=size(par.ImageA,1);
229                par.ImageWidth=size(par.ImageA,2);
230                Param.Civ1=par;
231                ibx2=floor((par.CorrBoxSize(1)-1)/2);
232                iby2=floor((par.CorrBoxSize(2)-1)/2);
233                isx2=floor((par.SearchBoxSize(1)-1)/2);
234                isy2=floor((par.SearchBoxSize(2)-1)/2);
235                shiftx=par.SearchBoxShift(1);
236                shifty=par.SearchBoxShift(2);
237                hhh=findobj(CurrentAxes,'Tag','PIV_box_marker');
238                hhhh=findobj(CurrentAxes,'Tag','PIV_search_marker');
239                if isempty(hhh)
240                    set(0,'CurrentFigure',hCurrentFig)
241                    set(hCurrentFig,'CurrentAxes',CurrentAxes)
242                    rectangle('Curvature',[0 0],...
243                        'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2],'EdgeColor','m',...
244                        'LineStyle','-','Tag','PIV_box_marker');
245                    rectangle('Curvature',[0 0],...
246                        'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2],'EdgeColor','m',...
247                        'LineStyle','- -','Tag','PIV_search_marker');
248                else
249                    set(hhh,'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2])
250                    set(hhhh,'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2])
251                end
252                [Data,errormsg,result_conv]= civ_matlab(Param);
253                if ~isempty(errormsg)
254                    text_displ_5=errormsg;
255                else
256                    rangx(1)=-(isx2-ibx2)+shiftx;
257                    rangx(2)=isx2-ibx2+shiftx;
258                    rangy(1)=-(isy2-iby2)-shifty;
259                    rangy(2)=(isy2-iby2)-shifty;
260                    hcorr=[];
261                    if isfield(AxeData,'CurrentCorrImage')
262                        hcorr=AxeData.CurrentCorrImage;
263                        if ~ishandle(hcorr)
264                            hcorr=[];
265                        end
266                    end
267                    if isempty(hcorr)
268                        corrfig=findobj(allchild(0),'tag','corrfig');
269                        if ~isempty(corrfig)
270                            set(0,'CurrentFigure',corrfig(1))
271                            AxeData.CurrentCorrImage=imagesc(rangx,-rangy,result_conv,[0 1]);
272                            AxeData.CurrentVector=line([0 Data.Civ1_U],[0 Data.Civ1_V],'Tag','vector');
273                            AxeData.TitleHandle=title(num2str(par.Grid));
274                            colorbar
275                            set(CurrentAxes,'UserData',AxeData)
276                            set(get(AxeData.CurrentCorrImage,'parent'),'YDir','normal')
277                        end
278                    else
279                        set(AxeData.CurrentCorrImage,'CData',result_conv)
280                        set(AxeData.CurrentCorrImage,'XData',rangx)
281                        set(AxeData.CurrentCorrImage,'YData',-rangy)
282                        set(AxeData.CurrentVector,'XData',[0 Data.Civ1_U],'YData',[0 Data.Civ1_V])
283                        set(AxeData.TitleHandle,'String',num2str(par.Grid))
284                    end
285                end
286            end
287        end
288    end
289end
290if ~isempty(text_displ_1)
291    text_displ=[{text_displ_1};{text_displ_2};{text_displ_3};{text_displ_4};{text_displ_5}];
292    ind_blank=find(strcmp('',text_displ));
293    if ~isempty(ind_blank)
294        text_displ(ind_blank)=[];
295    end
296    %set(handles.text_display,'String',text_displ)
297    set(htext_display,'String',text_displ)
298else
299   %set(handles.text_display,'String',get(handles.text_display,'UserData'))
300   set(htext_display,'String',get(handles.text_display,'UserData'))
301end
302
303%%%%%%%%%%%%%
304%% draw a zoom rectangle if checkZoomFig has been selected
305if test_zoom_draw
306   xy_rect=AxeData.CurrentOrigin;% mark the previous position from mouse down
307   if ~isempty(xy_rect)
308        rect(1)=min(xy(1,1),xy_rect(1));%origin rectangle, x coordinate
309        rect(2)=min(xy(1,2),xy_rect(2));%origin rectangle, y coordinate
310        rect(3)=abs(xy(1,1)-xy_rect(1));%rectangle width
311        rect(4)=abs(xy(1,2)-xy_rect(2));%rectangle height
312        if rect(3)>0 && rect(4)>0
313            if isfield(AxeData,'CurrentRectZoom')&& ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom)
314                set(AxeData.CurrentRectZoom,'Position',rect);%update the rectangle position
315            else
316                AxeData.CurrentRectZoom=rectangle('Position',rect,'Tag','rect_zoom','EdgeColor','b');
317                set(CurrentAxes,'UserData',AxeData)
318            end
319        end
320   end
321end
322
323%%%%%%%%%%%%%%%%%
324%% create or modify an object
325if ~isempty(huvmat) && test_object
326    UvData=get(huvmat,'UserData');
327    PlotData=get(AxeData.CurrentObject,'UserData');
328    if ~isfield(PlotData,'IndexObj')
329        return
330    end
331    ObjectData=UvData.ProjObject{PlotData.IndexObj};
332    if isequal(hObject,huvmat)% if the mouse ifs over the GUI uvmat
333        ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')};
334    else
335        ProjObject=UvData.ProjObject{get(hhuvmat.ListObject,'Value')};
336    end
337    XYData=AxeData.CurrentOrigin;
338    if isequal(AxeData.Drawing,'create') && isfield(AxeData,'CurrentOrigin') && ~isempty(AxeData.CurrentOrigin)
339        if strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||strcmp(ObjectData.Type,'polygon')||strcmp(ObjectData.Type,'points')
340            ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];
341            % ObjectData.Coord(end,:)=xy(1,:);
342        elseif strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')||strcmp(ObjectData.Type,'volume')
343                ObjectData.Coord=(AxeData.CurrentOrigin+xy(1,1:2))/2;% keep only the first point coordinate     
344                ObjectData.RangeX=abs(ObjectData.Coord(1,1)-xy(1,1));%rectangle width
345                ObjectData.RangeY=abs(ObjectData.Coord(1,2)-xy(1,2));%rectangle height
346        elseif isequal(ObjectData.Type,'plane') %case of 'plane'
347            DX=(xy(1,1)-ObjectData.Coord(1,1));
348            DY=(xy(1,2)-ObjectData.Coord(1,2));
349            ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle widt
350            if isfield(ObjectData,'RangeX')
351                XMax=sqrt(DX*DX+DY*DY);
352                if XMax>max(ObjectData.RangeX)
353                    ObjectData.RangeX=[min(ObjectData.RangeX) XMax];
354                end
355            end
356        end
357        plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m');
358        pointershape='crosshair';
359    elseif  isequal(AxeData.Drawing,'translate')
360        DX=xy(1,1)-XYData(1);%translation from initial position
361        DY=xy(1,2)-XYData(2);
362        ObjectData.Coord(:,1)=ObjectData.Coord(:,1)+DX;
363        ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY;
364        plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m');
365        pointershape='fleur';
366    elseif  isequal(AxeData.Drawing,'deform')
367        ind_move=AxeData.CurrentIndex;
368        ObjectData.Coord(ind_move,1)=xy(1,1);
369        ObjectData.Coord(ind_move,2)=xy(1,2);
370        plot_object(ObjectData,ProjObject,AxeData.CurrentObject,'m');
371        pointershape='circle';
372    end
373end
374
375%% detect calibration points if the GUI geometry_calib is opened
376h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
377if ~CheckZoom && ~isempty(h_geometry_calib)
378    pointershape='crosshair';%default for geometry_calib: ready to create new points
379    hh_geometry_calib=guidata(h_geometry_calib);
380    if  ~isempty(xy) && isfield(hh_geometry_calib,'ListCoord')
381        h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
382        data.Coord=get(h_ListCoord,'Data');
383        if isnumeric(data.Coord)&&~isempty(data.Coord)
384            if test_transform
385                            XCoord=(data.Coord(:,1));
386            YCoord=(data.Coord(:,2));
387            else
388            XCoord=(data.Coord(:,4));
389            YCoord=(data.Coord(:,5));
390            end
391            xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
392            if ~isempty(xy)
393                xlim=get(CurrentAxes,'XLim');
394                ind_range_x=abs((xlim(2)-xlim(1))/50);
395                ylim=get(CurrentAxes,'YLim');
396                ind_range_y=abs((ylim(2)-ylim(1))/50);
397                ind_range=sqrt(ind_range_x*ind_range_y);
398                index_point=find((XCoord<xy(1,1)+ind_range) & (XCoord>xy(1,1)-ind_range) & ...%flagx=1 for the vectors with x position selected by the mouse
399                              (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse
400                if ~isempty(index_point)
401                    pointershape='arrow';% default pointer is an arrow
402                end
403                hh=findobj('Tag','calib_points');%look for handle of calibration points
404               if ~isempty(hh) && ~isempty(get(hh,'UserData')) %&& get(hh_geometry_calib.CheckEnableMouse,'Value')
405                   %set(hh,'UserData',index_point)
406                    index_point=get(hh,'UserData');
407                    XCoord(index_point)=xy(1,1);
408                    YCoord(index_point)=xy(1,2);
409                    set(hh,'XData',XCoord)
410                    set(hh,'YData',YCoord)
411               end
412                if ~isempty(index_point)
413                    Data=get(h_ListCoord,'Data');
414                    Data(:,6)=zeros(size(Data,1),1);
415                    Data(index_point,6)=1;%mrk the point on the GUI geometry_calib
416                    set(h_ListCoord,'Data',Data);
417                   % set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib
418                    hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
419                    if ~isempty(hhh)
420                        set(hhh,'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range])
421                    else
422                                    rectangle('Curvature',[1 1],...
423                'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',...
424                'LineStyle','-','Tag','calib_marker');
425                    end
426                end
427            end
428        end
429    end
430end
431
432%% draw ruler
433if test_ruler && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'ruler')
434    if isfield(AxeData,'RulerHandle')
435        pointershape='crosshair'; %give  the mouse pointer a cross shape
436        RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)]; %coordinates defining the ruler segment
437        set(AxeData.RulerHandle,'XData',RulerCoord(:,1));% updtate the x coordinates for the ruler graphic object
438        set(AxeData.RulerHandle,'YData',RulerCoord(:,2));% updtate the y coordinates for the ruler graphic object
439    end
440end
441
442%% update the mouse pointer
443set(hCurrentFig,'Pointer',pointershape);
Note: See TracBrowser for help on using the repository browser.