source: trunk/src/mouse_motion.m @ 625

Last change on this file since 625 was 625, checked in by sommeria, 8 years ago

system of object creation by mouse ilmproved

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