Changeset 741


Ignore:
Timestamp:
Apr 15, 2014, 9:06:46 AM (10 years ago)
Author:
sommeria
Message:

bugs corrected in browse_data and mouse_motion (z display)

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/browse_data.m

    r733 r741  
    7272set(hObject, 'Units', OldUnits);
    7373if exist('Campaign','var')
    74     [CampaignPath,CampaignName]=fileparts(Campaign);
     74    [tild,CampaignName]=fileparts(Campaign);
    7575    RootXml=fullfile(Campaign,[CampaignName '.xml']);
    7676    s=[];
     
    125125    if isempty(MirrorRoot)
    126126        return
     127    elseif strcmp(MirrorRoot,SourcePath)
     128        msgbox_uvmat('ERROR','The mirror folder must be different from the source')
     129        return
    127130    else
    128131        MirrorDir=fullfile(MirrorRoot,ProjectName);
    129132    end
    130     if ~exist(MirrorDir,'dir')
    131         mkdir(MirrorDir)
     133    if exist(MirrorDir,'dir')
     134        msgbox_uvmat('ERROR',['The folder ' MirrorDir ' chosen as new mirror campaign already exists'])
     135        return
     136    else
     137        [s,errormsg]=mkdir(MirrorDir)% create the mirror dir
     138        if s~=1
     139            msgbox_uvmat('ERROR',['error in creating ' MirrorDir ': ' errormsg])
     140            return
     141        end
    132142    end
    133143    MirrorDoc.SourceDir=SourceDir;
    134144    t=struct2xml(MirrorDoc);
    135145    set(t,1,'name','DataTree');
    136     save(t,fullfile(MirrorDir,[ProjectName '.xml']))
     146    save(t,fullfile(MirrorDir,[ProjectName '.xml']))% create an xml file in the mirror folder to indicate its source folder
    137147    set(handles.MirrorDir,'String',MirrorDir)
    138148    set(handles.MirrorDir,'Visible','on')
     149    set(handles.CreateMirror,'String','update_mirror')
    139150end
    140151ExpName={''};
     
    206217 function ListExperiments_Callback(hObject, eventdata, handles)
    207218
    208 MirrorPath='';
    209 CampaignPath=get(handles.SourceDir,'String');
    210219if strcmp(get(handles.MirrorDir,'Visible'),'on')
    211220    MirrorPath=get(handles.MirrorDir,'String');
     221else
     222    MirrorPath=get(handles.SourceDir,'String');
    212223end
    213224ListExperiments=get(handles.ListExperiments,'String');
     
    229240for iexp=1:numel(ListExperiments)
    230241    if strcmp(ListExperiments{iexp}(1),'+')% if the item is a directory
    231         ListExperiments{iexp}(1)=[];
     242        ListExperiments{iexp}(1)=[];%remove the first char '+' used to mark folders
    232243        ListStruct=dir(fullfile(MirrorPath,ListExperiments{iexp})); %list files and dir in the source experiment directory
    233244        ListCells=struct2cell(ListStruct);%transform dir struct to a cell arrray
     
    279290                if ~isempty(MirrorPath)
    280291                    mirror=fullfile(MirrorPath,ListExperiments{iexp},ListFiles{ilist});
    281                     if exist(mirror,'dir')||exist(mirror,'file')
     292                    if exist(mirror,'file')% if mirror already exists as a file or folder
    282293                        [tild,msg]=fileattrib(mirror);
    283294                        if strcmp(msg.Name,mirror)%if the mirror name already exists as a local file or dir
    284                             if msg.directory% case of a f
     295                            if msg.directory% case of a folder
    285296                                answer=msgbox_uvmat('INPUT_Y-N',['replace local folder ' msg.Name ' by a link to the source dir']);
    286297                                if strcmp(answer,'Yes')
     
    292303                                    end
    293304                                end
    294                             else
     305                            else % case of an existing mirror file
    295306                                answer=msgbox_uvmat('INPUT_Y-N',['replace local file ' msg.Name ' by a link to the source file']);
    296307                                if strcmp(answer,'Yes')
    297308                                    delete(mirror);
    298                                     system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder
    299                                    
     309                                    system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder                                 
    300310                                end
    301311                            end
    302                         else% create mirror to the data series if needed
    303                             system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder
    304312                        end
     313                    else% create mirror to the data series if needed
     314                        system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder                     
    305315                    end
    306316                    if isempty(find(strcmp(ListFiles{ilist},ListDevices), 1))% if the item is not already in ListDevices
     
    586596Device=Device(Value);
    587597Device=regexprep(Device,'^\+/','');% remove the +/ used to mark dir
     598Device=regexprep(Device,'^~','');% remove the ~ used to mark symbolic link
    588599handles.output.Experiment=Experiment;
    589600handles.output.DataSeries=Device;
  • trunk/src/mouse_motion.m

    r738 r741  
    2525function mouse_motion(hObject,eventdata,handles)
    2626
    27 % if ~exist('handles','var')
    28 %     set(hCurrentFig,'Pointer','arrow');
    29 %     return
    30 % end
    3127FigData=get(hObject,'UserData');
    3228if ishandle(FigData)% case of a zoom plot, the handle of the parent rectangle is stored in UserData, its parent is the plotting axes of the rectangle
     
    8480% AxeData=[];%default
    8581xy=[];%default
     82set(hCurrentFig,'Units','normalized')
    8683xy_fig=get(hObject,'CurrentPoint');% current point of the current figure (gcbo)
    8784pointershape='arrow';% default pointer is an arrow
     
    218215            end
    219216            %display the z coordinate if defined by the projection plane
    220             if isfield(Field,'ObjectType') && strcmp(Field.ObjectType,'plane') && isfield(Field,'ObjectCoord') && length(Field.ObjectCoord)>=3
     217            if isfield(Field,'ProjObjectType') && strcmp(Field.ProjObjectType,'plane') && isfield(Field,'ProjObjectCoord') && length(Field.ProjObjectCoord)>=3
    221218                pos=[xy(1,1) xy(1,2) 0];
    222                 if isfield(Field,'ObjectAngle')&&~isequal(Field.ObjectAngle,[0 0 0])
    223                     om=norm(Field.ObjectAngle);%norm of rotation angle in radians
    224                     OmAxis=Field.ObjectAngle/om; %unit vector marking the rotation axis
     219                if isfield(Field,'ProjObjectAngle')&&~isequal(Field.ProjObjectAngle,[0 0 0])
     220                    om=norm(Field.ProjObjectAngle);%norm of rotation angle in radians
     221                    OmAxis=Field.ProjObjectAngle/om; %unit vector marking the rotation axis
    225222                    cos_om=cos(pi*om/180);
    226223                    sin_om=sin(pi*om/180);
     
    228225                    pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis;
    229226                end
    230                 pos=pos+[Field.ObjectCoord 0];
     227               % pos=pos+[Field.ProjObjectCoord 0];
     228               pos=pos+Field.ProjObjectCoord;
    231229                text_displ_3=[text_displ_3 'x,y,z=' num2str(pos,4)];
    232230            end
Note: See TracChangeset for help on using the changeset viewer.