Changeset 307


Ignore:
Timestamp:
Nov 28, 2011, 8:43:30 PM (13 years ago)
Author:
sommeria
Message:

bug fixed in the browser of civ + bug fix for the plot of objects

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r304 r307  
    227227varargout{1} = handles.output;
    228228
    229 % %------------------------------------------------------------------------
    230 % % --- function activated by the Open/Browse... option in the upper menu bar.
    231 % function MenuBrowse_Callback(hObject, eventdata, handles)
    232 % %------------------------------------------------------------------------
    233 % %get the current input root file name to initiate the browser
    234 % filebase=get(handles.RootName,'String');
    235 % oldfile=''; %default
    236 % if isempty(filebase)|| isequal(filebase,'')%loads the previously stored root file name
    237 %     dir_perso=prefdir;
    238 %     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    239 %     if exist(profil_perso,'file')
    240 %         h=load (profil_perso);
    241 %         if isfield(h,'filebase')&& ischar(h.filebase)
    242 %             oldfile=h.filebase;
    243 %         end
    244 %         if isfield(h,'RootPath') && ischar(h.RootPath)
    245 %             oldfile=h.RootPath;
    246 %         end
    247 %     end
    248 % else
    249 %     oldfile=filebase;
    250 % end
    251 % ind_opening=1;%default
    252 % browse.incr_pair=[0 0]; %default
    253 % menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)';
    254 %        '*.xml',  '.xml files '; ...
    255 %         '*.civ',  '.civ files '; ...
    256 %         '*.png','.png image files'; ...
    257 %         '*.jpg',' jpeg image files'; ...
    258 %         '*.tif','.tif image files'; ...
    259 %         '*.avi;*.AVI','.avi movie files'; ...
    260 %         '*.nc','.netcdf files'; ...
    261 %         '*.*',  'All Files (*.*)'};
    262 % [FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile);
    263 % fileinput=[PathName FileName];%complete file name
    264 % sizf=size(fileinput);
    265 % if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
    266 %
    267 % %% prepare the GUI with parameters from the input file if opened from uvmat
    268 % errormsg=display_file_name(handles,fileinput);
    269 %     if ~isempty(errormsg)
    270 %         msgbox_uvmat('ERROR',erromsg)
    271 %     end
    272 
    273 %
    274 % [path,name,ext]=fileparts(fileinput);
    275 % testeditxml=0;
    276 % if isequal(ext,'.xml')
    277 %     testeditxml=1;
    278 %     t_browse=xmltree(fileinput);
    279 %     head_element=get(t_browse,1);
    280 %     if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc')
    281 %         testeditxml=0;
    282 %     end
    283 % end
    284 % if testeditxml==1 || isequal(ext,'.xls')
    285 %     heditxml=editxml({fileinput});
    286 %     set(heditxml,'Tag','browser')
    287 %     waitfor(heditxml,'Tag','idle')
    288 %     if ~ishandle(heditxml)
    289 %         return
    290 %     end
    291 %     attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes');
    292 %     set(handles.browse,'UserData',fileinput)% store for future opening with browser
    293 %     fileinput=get(attr,'UserData');
    294 %     if ~exist(fileinput,'file')
    295 %         return
    296 %     end
    297 % end
    298 % [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
    299 % filebase=fullfile(RootPath,RootFile);
    300 % num_i1=str2double(str1);
    301 % if isnan(num_i1),num_i1=1;end
    302 % num_i2=str2double(str2);
    303 % if isnan(num_i2),num_i2=num_i1;end
    304 % num_j1=stra2num(str_a);
    305 % if isnan(num_j1),num_j1=1;end
    306 % num_j2=stra2num(str_b);
    307 % if isnan(num_j2),num_j2=num_j1;end
    308 % if isequal(get(handles.ListCompareMode,'Value'),1)
    309 %     browse=[];%initialisation
    310 % else
    311 %     browse=get(handlesRootName,'UserData');
    312 % end
    313 % browse.num_i1=num_i1;
    314 % browse.num_i2=num_i2;
    315 % browse.num_j1=num_j1;
    316 % browse.num_j2=num_j2;
    317 % if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat
    318 %     browse.nom_type_ima=nom_type;
    319 %     browse.ext_ima=ext;
    320 %     set(handles.ImaExt,'String',ext)
    321 % end
    322 % set(handles.ImaDoc,'String',ext);
    323 %
    324 %
    325 % set(handles.RootName,'UserData',browse);% store information from browser
    326 % RootName_Callback(hObject, eventdata, handles);
     229%------------------------------------------------------------------------
     230% --- function activated by the Open/Browse... option in the upper menu bar.
     231function MenuBrowse_Callback(hObject, eventdata, handles)
     232%------------------------------------------------------------------------
     233%get the current input root file name to initiate the browser
     234filebase=get(handles.RootName,'String');
     235oldfile=''; %default
     236if isempty(filebase)|| isequal(filebase,'')%loads the previously stored root file name
     237    dir_perso=prefdir;
     238    profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     239    if exist(profil_perso,'file')
     240        h=load (profil_perso);
     241        if isfield(h,'filebase')&& ischar(h.filebase)
     242            oldfile=h.filebase;
     243        end
     244        if isfield(h,'RootPath') && ischar(h.RootPath)
     245            oldfile=h.RootPath;
     246        end
     247    end
     248else
     249    oldfile=filebase;
     250end
     251ind_opening=1;%default
     252browse.incr_pair=[0 0]; %default
     253menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)';
     254       '*.xml',  '.xml files '; ...
     255        '*.civ',  '.civ files '; ...
     256        '*.png','.png image files'; ...
     257        '*.jpg',' jpeg image files'; ...
     258        '*.tif','.tif image files'; ...
     259        '*.avi;*.AVI','.avi movie files'; ...
     260        '*.nc','.netcdf files'; ...
     261        '*.*',  'All Files (*.*)'};
     262[FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile);
     263fileinput=[PathName FileName];%complete file name
     264sizf=size(fileinput);
     265if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
     266
     267%% prepare the GUI with parameters from the input file if opened from uvmat
     268errormsg=display_file_name(handles,fileinput);
     269    if ~isempty(errormsg)
     270        msgbox_uvmat('ERROR',erromsg)
     271    end
     272
     273
     274[path,name,ext]=fileparts(fileinput);
     275testeditxml=0;
     276if isequal(ext,'.xml')
     277    testeditxml=1;
     278    t_browse=xmltree(fileinput);
     279    head_element=get(t_browse,1);
     280    if isfield(head_element,'name')&& isequal(head_element.name,'ImaDoc')
     281        testeditxml=0;
     282    end
     283end
     284if testeditxml==1 || isequal(ext,'.xls')
     285    heditxml=editxml({fileinput});
     286    set(heditxml,'Tag','browser')
     287    waitfor(heditxml,'Tag','idle')
     288    if ~ishandle(heditxml)
     289        return
     290    end
     291    attr=findobj(get(heditxml,'children'),'Tag','CurrentAttributes');
     292    set(handles.browse,'UserData',fileinput)% store for future opening with browser
     293    fileinput=get(attr,'UserData');
     294    if ~exist(fileinput,'file')
     295        return
     296    end
     297end
     298[RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
     299filebase=fullfile(RootPath,RootFile);
     300num_i1=str2double(str1);
     301if isnan(num_i1),num_i1=1;end
     302num_i2=str2double(str2);
     303if isnan(num_i2),num_i2=num_i1;end
     304num_j1=stra2num(str_a);
     305if isnan(num_j1),num_j1=1;end
     306num_j2=stra2num(str_b);
     307if isnan(num_j2),num_j2=num_j1;end
     308if isequal(get(handles.ListCompareMode,'Value'),1)
     309    browse=[];%initialisation
     310else
     311    browse=get(handlesRootName,'UserData');
     312end
     313browse.num_i1=num_i1;
     314browse.num_i2=num_i2;
     315browse.num_j1=num_j1;
     316browse.num_j2=num_j2;
     317if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat
     318    browse.nom_type_ima=nom_type;
     319    browse.ext_ima=ext;
     320    set(handles.ImaExt,'String',ext)
     321end
     322set(handles.ImaDoc,'String',ext);
     323
     324set(handles.RootName,'UserData',browse);% store information from browser
     325RootName_Callback(hObject, eventdata, handles);
    327326
    328327% -----------------------------------------------------------------------
     
    416415num_ref_j=num_j1;
    417416browse.incr_pair=[0 0];%default
    418 if ~isempty(imformats(ext_input(2:end)))||strcmpi(ext_input,'.avi')% if the extension corresponds to an image or movie format recognized by Matlab
     417
     418% form=imformats(ext_input(2:end));
     419if ~isempty(ext_input)&&(~isempty(imformats(ext_input(2:end)))||strcmpi(ext_input,'.avi'))% if the extension corresponds to an image or movie format recognized by Matlab
    419420    ext_ima=ext_input;
    420421    nom_type_ima=nom_type_input;
     
    967968% be performed, while the result is needed for next steps.
    968969displ_pair={''};
    969 select=ones(size(1:nbpair))%flag for displayed pairs =1 for display
     970select=ones(size(1:nbpair));%flag for displayed pairs =1 for display
    970971testpair=0;
    971972
     
    10611062
    10621063%% determine the default selection in the pair menu
    1063 ichoice=find(select,1)% index of selected pair
     1064ichoice=find(select,1);% index of selected pair
    10641065if (isempty(ichoice) || ichoice < 1); ichoice=1; end;
    1065 initial=get(handles.ListPairCiv1,'Value')%initial choice of pair
     1066initial=get(handles.ListPairCiv1,'Value');%initial choice of pair
    10661067if initial>nbpair || (numel(select)>=initial && ~isequal(select(initial),1))
    10671068    set(handles.ListPairCiv1,'Value',ichoice);% first valid pair proposed by default in the menu
  • trunk/src/plot_object.m

    r231 r307  
    3939%% default output
    4040hh=[];%default output
    41 if isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot
     41if ~isfield(ObjectDataIn,'Style')|| isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot
    4242    return
    4343end
  • trunk/src/set_object.m

    r292 r307  
    672672hhuvmat=guidata(huvmat);%handles in the uvmat GUI
    673673ObjectName=get(handles.TITLE,'String');%name of the current object
    674 ListObject=get(hhuvmat.list_object_1,'String');%position in the objet list
    675 IndexObj_1=get(hhuvmat.list_object_1,'Value');
    676 if isequal(get(hhuvmat.list_object_2,'Visible'),'on')
    677     IndexObj_2=get(hhuvmat.list_object_2,'Value');
    678     List2=get(hhuvmat.list_object_2,'String');
     674ListObject=get(hhuvmat.ListObject,'String');%position in the objet list
     675IndexObj=get(hhuvmat.ListObject,'Value');
     676IndexObj_1=IndexObj(1);
     677% if isequal(get(hhuvmat.list_object_2,'Visible'),'on')
     678%     IndexObj_2=get(hhuvmat.list_object_2,'Value');
     679%     List2=get(hhuvmat.list_object_2,'String');
     680if numel(IndexObj)==2
     681    IndexObj_2=IndexObj(2);
    679682else
    680683    IndexObj_2=[];
     
    729732end
    730733ListObject{IndexObj,1}=ObjectName;
    731 set(hhuvmat.list_object_1,'String',ListObject)
    732 set(hhuvmat.list_object_2,'String',ListObject)
     734set(hhuvmat.ListObject,'String',ListObject)
     735% set(hhuvmat.list_object_2,'String',ListObject)
    733736
    734737%% update the object plot and projection field
    735738if testnew
    736     set(hhuvmat.list_object_2,'Value',IndexObj)
     739   set(hhuvmat.ListObject,'Value',IndexObj)
     740%     set(hhuvmat.list_object_2,'Value',IndexObj)
    737741    ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;
    738742    ObjectData.DisplayHandle_view_field=[];
    739743else
    740     if isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles
     744    IndexObj
     745    UvData.Object{IndexObj}
     746    if IndexObj<=length(UvData.Object) && isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles
    741747        ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat;
    742748    else
  • trunk/src/uvmat.m

    r302 r307  
    48514851% set(handles.uvmat,'UserData',UvData)
    48524852set(handles.delete_object,'Visible','on')
    4853 set(handles.uvmat_title,'Visible','on')
    4854 set(handles.view_field_title,'Visible','on')
     4853% set(handles.uvmat_title,'Visible','on')
     4854% set(handles.view_field_title,'Visible','on')
    48554855
    48564856%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.