Ignore:
Timestamp:
Mar 25, 2010, 6:48:48 PM (11 years ago)
Author:
sommeria
Message:

civ: RUN civ lounched out of the Matlab work space. RUN and BATCH now runned by a unique sub-function lounch.m.
FiLE PARAM.xml modified to provide different paths for Batch and Run !!!!!
RUN_FIX: minor error message modif
geometry_calib: calib point editing by the mouse
improvement of the interactions between the different GUIs. Close function...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_motion.m

    r65 r67  
    2727    return
    2828end
    29 % if ~isfield(handles, 'mouse_coord')
    30 %     'TEST'
    31 %     return
    32 % end
    33 % if ~ishandle(handles.mouse_coord)
    34 %     return
    35 % end
    36 % proj_coord=get(handles.mouse_coord,'String');
    37 % choice=get(handles.mouse_coord,'Value');
    38 % if ~isempty(proj_coord); proj_coord=proj_coord{choice};else;proj_coord=[];end;
    3929test_create=0;%default
    4030test_edit=0;%default
    41 % if isfield(handles,'VOLUME') % mouse_motion not applied to the uvmat figure, no object creation
    42 %     test_create=get(handles.create,'Value');   
    43 % end
    4431test_edit=isfield(handles,'edit') & get(handles.edit,'Value');% edit test for mouse shap: an arrow
    4532test_zoom=isfield(handles,'zoom')& get(handles.zoom,'Value');% edit test for mouse shap: an arrow
     
    5441AxeData=[];%default
    5542mouse=[];
     43xy=[];%default
    5644
    5745pointershape='arrow';% default pointer is an arrow
    58 
    59 xy_fig=get(gcbo,'CurrentPoint');% current point of the current figure (gcbo)
    60 hchild=get(gcbo,'Children');%handles of all objects in the current figure
    6146currentfig=gcbo;%store gcbo as variable currentfig
     47xy_fig=get(currentfig,'CurrentPoint');% current point of the current figure (gcbo)
     48hchild=get(currentfig,'Children');%handles of all objects in the current figure
     49
    6250% loop on all the objects in the current figure (selected by the last mouse click)
    6351for ichild=1:length(hchild)
     
    8876                    flag_vec=(AxeData.X<(xy(1,1)+AxeData.Mesh/3) & AxeData.X>(xy(1,1)-AxeData.Mesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse
    8977                          (AxeData.Y<(xy(1,2)+AxeData.Mesh/3) & AxeData.Y>(xy(1,2)-AxeData.Mesh/3));%f
    90                     ivec=find(flag_vec);% search the selected vector index ivec
     78                    ivec=find(flag_vec,1);% search the (first) selected vector index ivec
    9179                    hhh=findobj(haxes,'Tag','vector_marker');
    92                     if length(ivec)>0
     80                    if ~isempty(ivec)
    9381                        %ivec=ivec(1);%choice the first selected vector if several are selected
    9482                        if ~test_create
    9583                            pointershape='arrow'; %mouse indicates  the detection of a vector
    96  
    9784                            if isempty(hhh)
    9885                                set(currentfig,'CurrentAxes',haxes)
     
    262249    end
    263250end   
     251
    264252%%%%%%%%%%%%%
    265 %draw a rectangle if no object creation is selected
     253%draw a zoom rectangle if no object creation is selected
    266254if ~isempty(haxes) & isfield(AxeData,'Drawing')& isequal(AxeData.Drawing,'zoom')& isfield(AxeData,'CurrentOrigin')...
    267255        & isequal(get(gcf,'SelectionType'),'normal')%
     
    281269        end
    282270   end
    283 end
    284 if test_zoom
     271% end
     272% if test_zoom
    285273    pointershape='arrow';
     274end
     275
     276% detect calibration points if the GUI geometry_calib is opened
     277h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
     278if ~test_zoom && ~isempty(h_geometry_calib)
     279    pointershape='crosshair';%default for geometry_calib: ready to create new points
     280    hh_geometry_calib=guidata(h_geometry_calib);
     281    if get(hh_geometry_calib.edit_append,'Value')  && ~isempty(xy)
     282        h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
     283        Coord=get(h_ListCoord,'String');
     284        data=read_geometry_calib(Coord);%transform char cell to numbers
     285        if size(data.Coord,2)>=5
     286            XCoord=(data.Coord(:,4));
     287            YCoord=(data.Coord(:,5));
     288            xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     289            if ~isempty(xy)
     290                ind_range=10;
     291                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
     292                              (YCoord<xy(1,2)+ind_range) & (YCoord>xy(1,2)-ind_range),1);%find the first calibration point in the neighborhood of the mouse
     293                if ~isempty(index_point)
     294                    pointershape='arrow';% default pointer is an arrow
     295                    set(h_ListCoord,'Value',index_point)%mrk the point on the GUI geometry_calib
     296                    hh=findobj('Tag','calib_points');%look for handle of calibration points
     297                    if ~isempty(hh) && strcmp(get(hh,'UserData'),'edit_mode')
     298                        XCoord(index_point)=xy(1,1);
     299                        YCoord(index_point)=xy(1,2);
     300                        set(hh,'XData',XCoord)
     301                        set(hh,'YData',YCoord)
     302                    end
     303                    hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
     304                    if ~isempty(hhh)
     305                        set(hhh,'XData',XCoord(index_point))
     306                        set(hhh,'YData',YCoord(index_point))
     307                    end
     308                end         
     309            end
     310        end
     311    end
    286312end
    287313
     
    291317    if isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler')
    292318           if isfield(UvData,'RulerHandle')
     319               pointershape='crosshair';
    293320                RulerCoord=[UvData.RulerCoord ;xy(1,1:2)];
    294321                set(UvData.RulerHandle,'XData',RulerCoord(:,1));
Note: See TracChangeset for help on using the changeset viewer.