Changeset 627 for trunk/src/mouse_down.m


Ignore:
Timestamp:
May 3, 2013, 10:11:43 AM (11 years ago)
Author:
sommeria
Message:

a few bugs repaired, display of the local mouse indication in a separate window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_down.m

    r625 r627  
    118118                if isfield(FigData,tagaxes)
    119119                    Field=FigData.(tagaxes);
    120                     [CellVarIndex,NbDim,VarType]=find_field_cells(Field);%analyse the physical fields contained in Field
    121                     for icell=1:numel(CellVarIndex)%look for all physical fields
     120                    [CellInfo,NbDim,errormsg]=find_field_cells(Field);%analyse the physical fields contained in Field
     121                    if isempty(errormsg)
     122                    for icell=1:numel(CellInfo)%look for all physical fields
    122123                        if NbDim(icell)==2 % select 2D field
    123                             if  isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data
    124                                 X=Field.(Field.ListVarName{VarType{icell}.coord_x});
    125                                 Y=Field.(Field.ListVarName{VarType{icell}.coord_y});
     124                            if  isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&&...
     125                                    ~isempty(CellInfo{icell}.VarIndex_coord_x) && ~isempty(CellInfo{icell}.VarIndex_coord_y)%case of unstructured data
     126                                X=Field.(Field.ListVarName{CellInfo{icell}.VarIndex_coord_x});
     127                                Y=Field.(Field.ListVarName{CellInfo{icell}.VarIndex_coord_y});
    126128                                flag_vec=(X<(xy(1,1)+Field.CoordMesh/4) & X>(xy(1,1)-Field.CoordMesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse
    127129                                    (Y<(xy(1,2)+Field.CoordMesh/4) & Y>(xy(1,2)-Field.CoordMesh/4));%f
     
    129131                            end
    130132                        end
     133                    end
    131134                    end
    132135                end
     
    173176end
    174177
    175 %% delete the current zoom rectangle
    176 % if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom)
    177 %     delete(AxeData.CurrentRectZoom)
    178 %     AxeData.CurrentRectZoom=[];
    179 % end
    180 
    181178%% zoom has first priority, stop here
    182179if CheckZoom
    183180    return
     181end
     182
     183%% Creation of a display window zoom of text_display
     184if isequal(get(hObject,'SelectionType'),'alt') && strcmp(htype,'axes') && ~test_edit && ~test_create
     185    set(0,'Unit','pixels')
     186    GUISize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right   
     187    Width=300;% fig width in points (1/72 inch)
     188    Height=200;
     189    Left=GUI_pos(1)+GUI_pos(3)-Width; %right edge close to the right, with margin=40
     190    Bottom=GUI_pos(2)+GUI_pos(4)-Height; %put fig at top right
     191    hfig_text=figure('Name','text_display','MenuBar','none','NumberTitle','off','Position',[Left,Bottom,Width,Height]);
     192    AxeData.htext_display=uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.05 0.9 0.9],'Max',2,'BackgroundColor',[1 1 1],...
     193        'FontUnits','points','FontSize',14);
     194    set(hchild,'UserData',AxeData);
     195    return %leave the function once a uicontrol has been selected
    184196end
    185197
     
    380392    set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
    381393    AxeData.Drawing='create';% flag for mouse motion
    382    
    383    
    384     %initiate a new object (no data .Coord yet recorded)
    385     %if ~isfield(UvData.ProjObject{IndexObj},'Coord');
    386     %     ObjectData.Coord=[];
    387    
    388     %             if isempty(ListObject)
    389     %                 ListObject={ObjectName};
    390     %             else
    391     %                 ListObject{end}=ObjectName;
    392     %             end
    393     %                 UvData.ProjObject{IndexObj}=[]; %create a new empty object
    394     %     UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object
    395     %     UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
    396    
    397     %         PlotData=get(AxeData.CurrentObject,'UserData');
    398     %         PlotData.IndexObj=IndexObj;
    399     %         set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
    400     %         AxeData.Drawing='create';% flag for mouse motion
     394
    401395    %show object coordinates in the GUI set_object
    402396    h_set_object=findobj(allchild(0),'Tag','set_object');
     
    475469    if ~isfield(Field,'FF')
    476470        Field.ListVarName=[Field.ListVarName 'FF'];
    477         Field.VarDimName=[Field.VarDimName Field.VarDimName{VarType{icell}.coord_x}];
     471        Field.VarDimName=[Field.VarDimName Field.VarDimName{CellInfo{icell}.VarIndex_coord_x}];
    478472        nbvar=length(Field.ListVarName);
    479473        Field.VarAttribute{nbvar}.Role='errorflag';
Note: See TracChangeset for help on using the changeset viewer.