Changeset 71 for trunk/src/mouse_down.m


Ignore:
Timestamp:
Mar 29, 2010, 6:34:55 PM (15 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_down.m

    r67 r71  
    2525
    2626MouseAction='none'; %default
    27 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
     27huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
    2828if isempty(huvmat)
    2929    return
     
    4949%edit an existing point or line if found
    5050hcurrentobject=gco;% current object handle (selected by the mouse)
    51 hcurrentfig=gcbo;% current figure handle
     51hcurrentfig=hObject;% current figure handle
    5252fig_tag=get(hcurrentfig,'Tag');
    5353tag_obj=get(gco,'Tag');
     
    105105end   
    106106
     107% zoom has first priority
    107108if testzoom %&& ~test_create && ~test_edit && ~test_edit_vect && exist('xy','var')
    108109     AxeData.Drawing='zoom'; %initiate drawing mode
    109110     AxeData.CurrentObject=[];%unselect objects
     111     set(haxes,'UserData',AxeData);
    110112     return
    111113end
    112114if isempty(huvmat)
     115    return
     116end
     117
     118%ruler has second priority
     119if test_ruler
     120    UvData.RulerCoord(1,1)=xy(1,1);
     121    UvData.RulerCoord(1,2)=xy(1,2);
     122    UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler');
     123    set(huvmat,'UserData',UvData)
     124    AxeData.Drawing='ruler';
     125    set(haxes,'UserData',AxeData);
    113126    return
    114127end
     
    163176            end
    164177            IndexObj=ObjectData.IndexObj;
    165             set(hhuvmat.list_object_1,'Value',IndexObj);
    166             set(hhuvmat.list_object_2,'Value',IndexObj);
     178                    %indicate on the list of the GUI uvmat which object has been selected
     179            if strcmp(get(hcurrentfig,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field
     180                set(hhuvmat.list_object_2,'Value',IndexObj);
     181            else
     182                set(hhuvmat.list_object_1,'Value',IndexObj);
     183            end
    167184            testdeform=0;
    168185            set(gcbo,'Pointer','circle');
     
    207224        set(huvmat,'UserData',UvData)
    208225        list_str=get(hhuvmat.list_object_1,'String');
    209         list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
    210         if ~isequal(list_str{end},'...')
    211              list_str{end+1}='...';
    212         end
     226        list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
    213227        set(hhuvmat.list_object_1,'String',list_str)
     228        list_str{end+1}='...';
    214229        set(hhuvmat.list_object_2,'String',list_str)
    215230        if strcmp(fig_tag,'view_field')%we are in view_field plot
    216               set(hhuvmat.list_object_1,'Value',IndexObj)
     231              set(hhuvmat.list_object_1,'Value',IndexObj)% the projection field will be plotted in uvmat frame
    217232        else%we are in uvmat plot
    218233            set(hhuvmat.list_object_2,'Value',IndexObj)
     
    234249        if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys)
    235250            set(hhuvmat.transform_fct,'Value',1)
     251            uvmat('transform_fct_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
    236252            set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off'
    237253            set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
    238             uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
    239254            return
    240255        end
    241256        Coord=get(h_ListCoord,'String');
    242         data=read_geometry_calib(Coord)%transform char cell to numbers
     257        data=read_geometry_calib(Coord);%transform char cell to numbers
    243258        ind_range=10;%range of research around each existing point
    244259        test_newpoint=1;
     
    255270             val=get(h_ListCoord,'Value');
    256271             if length(Coord)>=val
    257                  Coord(val+1:length(Coord)+1)=Coord(val:length(Coord))% push the list forward beyond the current point
     272                 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point
    258273             end
    259274             Coord{val}=strline;
    260275             set(h_ListCoord,'String',Coord)
    261             set(h_ListCoord,'Value',val+1)
     276            % set(h_ListCoord,'Value',val+1)
    262277             data=read_geometry_calib(Coord);%transform char cell to numbers
    263278             XCoord=data.Coord(:,4);
     
    274289        hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
    275290        if ~isempty(hhh)
    276             set(hhh,'XData',xy(1,1))
    277             set(hhh,'YData',xy(1,2))
     291            set(hhh,'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range])
    278292        else
    279             line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20);
    280         end
     293            rectangle('Curvature',[1 1],...
     294                  'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',...
     295                  'LineStyle','-','Tag','calib_marker');
     296           % line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',ind_range);
     297        end
     298        AxeData.Drawing='calibration';
    281299    end
    282300end
     
    296314end   
    297315
    298 %create ruler
    299 if test_ruler
    300     UvData.RulerCoord(1,1)=xy(1,1);
    301     UvData.RulerCoord(1,2)=xy(1,2);
    302     UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler');
    303     set(huvmat,'UserData',UvData)
    304 end
     316
    305317set(haxes,'UserData',AxeData);
    306318
Note: See TracChangeset for help on using the changeset viewer.