Changeset 71 for trunk/src/mouse_up.m


Ignore:
Timestamp:
Mar 29, 2010, 6:34:55 PM (11 years ago)
Author:
sommeria
Message:

civ3D updated: introduction of image size
imadoc2struct: reding of image size from the xml file
set_object, view_field and related functions: improvement of projection object editing
mouse: possibility of adjusting the calibrations points with the mouse

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_up.m

    r67 r71  
    11%'mouse_up': function  activated when the mouse button is released
    22%----------------------------------------------------------------
    3 % function mouse_up(ggg,eventdata,handles)
     3% function mouse_up(hObject,eventdata,handles)
    44% activated by the command:
    55% set(hObject,'WindowButtonUpFcn',{'mouse_up'}),
     
    2222%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    2323
    24 function mouse_up(ggg,eventdata,handles)
     24function mouse_up(hObject,eventdata,handles)
    2525MouseAction='none'; %default
    2626zoomstate=0;%default
     
    3737    zoomstate=get(hhuvmat.zoom,'Value');
    3838end
    39 % if isequal(MouseAction,'calib') && ~zoomstate
    40 %     return
    41 % end
    42 currentfig=gcbo;
    43 AxeData=get(gca,'UserData');
     39currentfig=hObject;
    4440currentaxes=gca; %store the current axes handle
     41AxeData=get(currentaxes,'UserData');
     42
    4543test_drawing=0;%default
    4644
     
    5250    IndexObj=PlotData.IndexObj;
    5351    ObjectData=UvData.Object{IndexObj};   
     52    ObjectData.enable_plot=1;
    5453    if isequal(AxeData.Drawing,'translate')
    5554        XYData=AxeData.CurrentOrigin;
     
    264263% editing calibration point
    265264if strcmp(MouseAction,'calib')
    266     xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    267     hh=findobj('Tag','calib_points')%look for handle of calibration points           
     265    hh=findobj(currentaxes,'Tag','calib_points')%look for handle of calibration points           
    268266    if ~isempty(hh)
    269267        set(hh,'UserData',[])%remove edit mode
    270     end   
    271     strline=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
    272     h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    273     hh_geometry_calib=guidata(h_geometry_calib);
    274     h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
    275     Coord=get(h_ListCoord,'String');
    276     val=get(h_ListCoord,'Value');
    277 %     if length(Coord)>=val
    278 %         Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point
    279 %     end
    280     Coord{val}=strline;
    281     set(h_ListCoord,'String',Coord)
    282     %set(h_ListCoord,'Value',val+1)
    283     %geometry_calib('ListCoord_Callback',hObject,eventdata,hh_geometry_calib)
    284     %data=read_geometry_calib(Coord);%transform char cell to numbers
    285     %XCoord=data.Coord(:,4);
    286     %YCoord=data.Coord(:,5)
     268        h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
     269        hh_geometry_calib=guidata(h_geometry_calib);
     270        h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list
     271        Coord=get(h_ListCoord,'String');
     272        val=get(h_ListCoord,'Value');
     273        coord_str=Coord{val}; %current line (string)
     274        k=findstr('|',coord_str);%find separator indices on the string
     275        xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     276        if numel(k)>=3
     277            coord_str=[coord_str(1:k(3)-1) '|    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord
     278        else
     279            coord_str=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
     280        end
     281        Coord{val}=coord_str;       
     282        set(h_ListCoord,'String',Coord)
     283    end
    287284end
    288285
     
    301298    hruler=findobj(currentaxes,'Tag','ruler');
    302299    delete(hruler)
     300    AxeData.Drawing='off';%stop current drawing a
    303301end
    304302
Note: See TracChangeset for help on using the changeset viewer.