Changeset 154


Ignore:
Timestamp:
Dec 9, 2010, 11:35:47 PM (13 years ago)
Author:
sommeria
Message:

bug repair for object creation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_up.m

    r150 r154  
    2626test_zoom=0;%default
    2727currentfig=hObject;
     28tagfig=get(currentfig,'tag');
    2829hhcurrentfig=guidata(currentfig);
    2930test_zoom=get(hhcurrentfig.zoom,'Value');
     
    4647test_drawing=0;%default
    4748
    48 %finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field
     49%% finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field
    4950if ~isempty(huvmat) & isfield(AxeData,'Drawing') & ~isequal(AxeData.Drawing,'off') & isfield(AxeData,'CurrentObject')...
    5051           & ishandle(AxeData.CurrentObject)
     
    5455    ObjectData=UvData.Object{IndexObj};   
    5556    ObjectData.enable_plot=1;
     57   
     58    % ending translation
    5659    if isequal(AxeData.Drawing,'translate')
    5760        XYData=AxeData.CurrentOrigin;
     
    6063        ObjectData.Coord(:,1)=ObjectData.Coord(:,1)+DX;
    6164        ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY;
     65       
     66    %ending object deformation
    6267    elseif isequal(AxeData.Drawing,'deform')
    6368        ind_move=AxeData.CurrentIndex;
    6469        ObjectData.Coord(ind_move,1)=xy(1,1);
    6570        ObjectData.Coord(ind_move,2)=xy(1,2);
    66     else   %creating object
     71       
     72    %creating object   
     73    else   
    6774        if strcmp(ObjectData.Style,'line')||strcmp(ObjectData.Style,'polyline')||...
    6875                strcmp(ObjectData.Style,'polygon')||strcmp(ObjectData.Style,'points')
     
    8491            DX=(xy(1,1)-ObjectData.Coord(1,1));
    8592            DY=(xy(1,2)-ObjectData.Coord(1,2));
    86             ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle widt
     93            ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width
    8794            if isfield(ObjectData,'RangeX')
    8895                XMax=sqrt(DX*DX+DY*DY);
     
    93100        end
    94101    end
    95     %set(AxeData.CurrentObject,'UserData',ObjectData); %update the object properties
    96102    if strcmp(ObjectData.Style,'rectangle')||strcmp(ObjectData.Style,'ellipse')
    97103        NbDefPoint=1; 
     
    117123       end
    118124       if  ~isempty(ObjectData)
    119              testmask=0;
    120              hmask=findobj(huvmat,'Tag','makemask');
    121              if ~isempty(hmask)
    122                 testmask=get(hmask,'Value');
    123              end
    124              if testmask
    125                  PlotHandles=[];%do not project data on the object during mask creation
    126              else
    127                  PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
    128              end
    129             UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles);
     125%              testmask=0;
     126%              hmask=findobj(huvmat,'Tag','makemask');
     127%              if ~isempty(hmask)
     128%                 testmask=get(hmask,'Value');
     129%              end
     130%              if testmask
     131%                  PlotHandles=[];%do not project data on the object during mask creation
     132%              else
     133            PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
     134%              end
     135            UvData.Object=update_obj(UvData,IndexObj,ObjectData,PlotHandles);
     136            if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen on view_field
     137%             if strcmp(projview,'view_field')
     138                hview_field=findobj(allchild(0),'tag','view_field');
     139                ViewFieldData=get(hview_field,'UserData');
     140                ViewFieldData.axes3=ObjectData;
     141                set(hview_field,'UserData',ViewFieldData)
     142            else
     143                UvData.axes3=ObjectData;
     144            end
    130145            if  isfield(UvData.Object{IndexObj},'PlotParam')
    131146                write_plot_param(PlotHandles,UvData.Object{IndexObj}.PlotParam); %update the display of plotting parameters for the current object
     
    148163    test_drawing=0;
    149164end
    150 %creation of a new zoom plot
     165
     166%% creation of a new zoom plot
    151167test_replot=0;
    152168if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed
     
    208224        end
    209225end
    210 %zoom in by a factor 2 if no new figure is created
     226
     227%% zoom in by a factor 2 if no new figure is created
    211228if test_zoom
    212229    xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     
    270287end
    271288
    272 % editing calibration point
    273 if ~test_zoom && strcmp(MouseAction,'calib') 
     289%% editing calibration point
     290if ~test_zoom && strcmp(MouseAction,'calib')
    274291    h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    275292    hh_geometry_calib=guidata(h_geometry_calib);
    276293    edit_test=get(hh_geometry_calib.edit_append,'Value');
    277     hh=findobj(currentaxes,'Tag','calib_points');%look for handle of calibration points           
     294    hh=findobj(currentaxes,'Tag','calib_points');%look for handle of calibration points
    278295    if ~isempty(hh) && edit_test
    279296        index_point=get(hh,'UserData');
     
    281298        h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list
    282299        Coord=get(h_ListCoord,'String');
    283 %         val=get(h_ListCoord,'Value');
    284         coord_str=Coord{index_point}; %current line (string)
    285         k=findstr('|',coord_str);%find separator indices on the string
    286         xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    287         if numel(k)>=3
    288             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
    289         else
    290             coord_str=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
    291         end
    292         Coord{index_point}=coord_str;       
    293         set(h_ListCoord,'String',Coord)
    294         data=read_geometry_calib(Coord);%transform char cell to numbers
     300        data=read_geometry_calib(Coord);
     301        %         val=get(h_ListCoord,'Value');
     302        xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     303        data.Coord(index_point,4)=xy(1,1);
     304        data.Coord(index_point,5)=xy(1,2);
     305        for ipoint=1:size(data.Coord,1)
     306            for jcoord=1:5
     307                Coord_cell{ipoint,jcoord}=num2str(data.Coord(ipoint,jcoord),4);%display coordiantes with 4 digits
     308            end
     309        end
     310        Tabchar=cell2tab(Coord_cell,' | ');
     311        Tabchar=[Tabchar ;{'......'}];
     312        set(h_ListCoord,'String',Tabchar)
     313        %         coord_str=Coord{index_point}; %current line (string)
     314        %         k=findstr('|',coord_str);%find separator indices on the string
     315        %         blanks=blank
     316        %         xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     317        %         if numel(k)>=3
     318        %             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
     319        %         else
     320        %             coord_str=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
     321        %         end
     322        %         Coord{index_point}=coord_str;
     323        %         set(h_ListCoord,'String',Coord)
     324        %         data=read_geometry_calib(Coord);%transform char cell to numbers
    295325        set(hh,'XData',data.Coord(:,4))
    296326        set(hh,'YData',data.Coord(:,5))
     
    298328end
    299329
    300 % finalising ruler
     330
     331%% finalising ruler
    301332if strcmp(MouseAction,'ruler')
    302333    UvData.MouseAction='none';
     
    315346end
    316347
    317 
    318 %display the data of the current object selected with the mouse right click
     348%% display the data of the current object selected with the mouse right click
    319349if isequal(get(currentfig,'SelectionType'),'alt') && ~test_zoom && (~isfield(AxeData,'Drawing')||~isequal(AxeData.Drawing,'create'))
    320350    hother=findobj('Tag','proj_object');%find all the proj objects
     
    350380    end
    351381end
     382
     383%% update
    352384if test_drawing==0
    353385        AxeData.Drawing='off';%stop current drawing action
Note: See TracChangeset for help on using the changeset viewer.