Changeset 413 for trunk/src/view_field.m
- Timestamp:
- May 8, 2012, 2:27:50 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/view_field.m
r408 r413 92 92 AxeData.LimEditBox=1; %initialise AxeData, the parent figure sets plot parameters 93 93 set(handles.axes3,'UserData',AxeData) 94 if ~exist('Field','var') 95 return 96 end 97 [PlotType,PlotParamOut]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar) 98 99 if isfield(PlotParamOut,'Vectors') 100 set(handles.Vectors,'Visible','on') 101 end 102 write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters 103 94 if exist('Field','var') 95 [PlotType,PlotParamOut]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar) 96 set(handles.Coordinates,'Visible','on') 97 if isfield(PlotParamOut,'Vectors') 98 set(handles.Vectors,'Visible','on') 99 end 100 write_plot_param(handles,PlotParamOut);% update the display of the plotting parameters 101 end 104 102 %------------------------------------------------------------------------ 105 103 % --- Outputs from this function are returned to the command menuline. … … 140 138 end 141 139 end 140 end 141 hciv=findobj(allchild(0),'Tag','civ');%find the current civ GUI 142 if ~isempty(hciv) 143 hhciv=guidata(hciv); 144 set(hhciv.TestCiv1,'Value',0)% desactivate TestCiv1 if on 145 set(hhciv.TestCiv1,'BackgroundColor',[1 0 0])% 146 end 147 corrfig=findobj(allchild(0),'tag','corrfig');% look for a civ correlation window used with TesCiv1 148 if ~isempty(corrfig) 149 delete(corrfig) 142 150 end 143 151 … … 317 325 if test 318 326 set(handles.CheckFixEqual,'BackgroundColor',[1 1 0]) 319 cla(handles.axes3)320 327 else 321 328 set(handles.CheckFixEqual,'BackgroundColor',[0.7 0.7 0.7]) … … 328 335 % --- Executes on button press in 'zoom'. 329 336 %------------------------------------------------------------------- 330 function zoom_Callback(hObject, eventdata, handles)331 if (get(handles. zoom,'Value') == 1);332 set(handles. zoom,'BackgroundColor',[1 1 0])333 set(handles. FixLimits,'Value',1)% propose by default fixed limits for the plotting axes334 set(handles. FixLimits,'BackgroundColor',[1 1 0])335 else 336 set(handles. zoom,'BackgroundColor',[0.7 0.7 0.7])337 end 338 339 % -------------------------------------------------------------------340 % ----Executes on button press in 'record': records the current flags of manual correction.341 % -------------------------------------------------------------------342 function record_Callback(hObject, eventdata, handles)343 % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);344 filename=read_file_boxes(handles);345 AxeData=get(gca,'UserData');346 [erread,message]=fileattrib(filename);347 if ~isempty(message) && ~isequal(message.UserWrite,1)348 msgbox_view_field('ERROR',['no writting access to ' filename])349 return350 end351 test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);352 test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]);353 if ~test_civ2 && ~test_civ1354 msgbox_view_field('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')355 end356 if test_civ2357 nbname='nb_vectors2';358 flagname='vec2_FixFlag';359 attrname='fix2';360 end361 if test_civ1362 nbname='nb_vectors';363 flagname='vec_FixFlag';364 attrname='fix';365 end366 % write fix flags in the netcdf file367 hhh=which('netcdf.open');% look for built-in matlab netcdf library368 if ~isequal(hhh,'')% case of new builtin Matlab netcdf library369 nc=netcdf.open(filename,'NC_WRITE');370 netcdf.reDef(nc)371 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1)372 dimid = netcdf.inqDimID(nc,nbname);373 try374 varid = netcdf.inqVarID(nc,flagname);% look for already existing fixflag variable375 catch376 varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist377 end378 netcdf.endDef(nc)379 netcdf.putVar(nc,varid,AxeData.FF);380 netcdf.close(nc)381 else %old netcdf library382 netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)383 end384 385 function netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)386 nc=netcdf(filename,'write'); %open netcdf file387 result=redef(nc);388 eval(['nc.' attrname '=1;']);389 theDim=nc(nbname) ;% get the number of velocity vectors390 nb_vectors=size(theDim);391 var_FixFlag=ncvar(flagname,nc);% var_FixFlag will be written as the netcdf variable vec_FixFlag392 var_FixFlag(1:nb_vectors)=AxeData.FF;%393 fin=close(nc);337 function CheckZoom_Callback(hObject, eventdata, handles) 338 if (get(handles.CheckZoom,'Value') == 1); 339 set(handles.CheckZoom,'BackgroundColor',[1 1 0]) 340 set(handles.CheckFixLimits,'Value',1)% propose by default fixed limits for the plotting axes 341 set(handles.CheckFixLimits,'BackgroundColor',[1 1 0]) 342 else 343 set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7]) 344 end 345 346 % %------------------------------------------------------------------- 347 % %----Executes on button press in 'record': records the current flags of manual correction. 348 % %------------------------------------------------------------------- 349 % function record_Callback(hObject, eventdata, handles) 350 % % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles); 351 % filename=read_file_boxes(handles); 352 % AxeData=get(gca,'UserData'); 353 % [erread,message]=fileattrib(filename); 354 % if ~isempty(message) && ~isequal(message.UserWrite,1) 355 % msgbox_view_field('ERROR',['no writting access to ' filename]) 356 % return 357 % end 358 % test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]); 359 % test_civ1=isequal(get(handles.civ1,'BackgroundColor'),[1 1 0]); 360 % if ~test_civ2 && ~test_civ1 361 % msgbox_view_field('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields') 362 % end 363 % if test_civ2 364 % nbname='nb_vectors2'; 365 % flagname='vec2_FixFlag'; 366 % attrname='fix2'; 367 % end 368 % if test_civ1 369 % nbname='nb_vectors'; 370 % flagname='vec_FixFlag'; 371 % attrname='fix'; 372 % end 373 % %write fix flags in the netcdf file 374 % hhh=which('netcdf.open');% look for built-in matlab netcdf library 375 % if ~isequal(hhh,'')% case of new builtin Matlab netcdf library 376 % nc=netcdf.open(filename,'NC_WRITE'); 377 % netcdf.reDef(nc) 378 % netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1) 379 % dimid = netcdf.inqDimID(nc,nbname); 380 % try 381 % varid = netcdf.inqVarID(nc,flagname);% look for already existing fixflag variable 382 % catch 383 % varid=netcdf.defVar(nc,flagname,'double',dimid);%create fixflag variable if it does not exist 384 % end 385 % netcdf.endDef(nc) 386 % netcdf.putVar(nc,varid,AxeData.FF); 387 % netcdf.close(nc) 388 % else %old netcdf library 389 % netcdf_toolbox(filename,AxeData,attrname,nbname,flagname) 390 % end 391 % 392 % function netcdf_toolbox(filename,AxeData,attrname,nbname,flagname) 393 % nc=netcdf(filename,'write'); %open netcdf file 394 % result=redef(nc); 395 % eval(['nc.' attrname '=1;']); 396 % theDim=nc(nbname) ;% get the number of velocity vectors 397 % nb_vectors=size(theDim); 398 % var_FixFlag=ncvar(flagname,nc);% var_FixFlag will be written as the netcdf variable vec_FixFlag 399 % var_FixFlag(1:nb_vectors)=AxeData.FF;% 400 % fin=close(nc); 394 401 395 402 … … 500 507 set_vec_col_bar(handles) 501 508 update_plot(handles) 502 %------------------------------------------------------------503 %update the slider values after displaying vectors504 %--------------------------------------------------------505 % function slider_update(handles,auto,minC,colcode1,colcode2,maxC)506 % set(handles.slider1,'Min',minC)507 % set(handles.slider1,'Max',maxC)508 % set(handles.slider2,'Min',minC)509 % set(handles.slider2,'Max',maxC)510 % set(handles.min_C_title_vec,'String',num2str(minC))511 % set(handles.max_vec,'String',num2str(maxC))512 % if auto513 % set(handles.colcode1,'String',num2str(colcode1,3))%update display514 % set(handles.colcode2,'String',num2str(colcode2,3))515 % end516 % set(handles.slider1,'Value',colcode1)%update slider with constant display517 % set(handles.slider2,'Value',colcode2)518 % set_vec_col_bar(handles)519 520 509 521 510 %------------------------------------------------------- … … 719 708 set(handles.vec_col_bar,'Cdata',A) 720 709 721 % %------------------------------------------------------------------------722 % function PlotType=update_plot(handles)723 % %------------------------------------------------------------------------724 % haxes= handles.axes3;725 %726 % %ProjField=get(haxes,'UserData');727 % ViewFieldData=get(handles.view_field,'UserData');728 % ProjField=ViewFieldData.axes3;729 % %ProjField=get(haxes,'UserData');730 % PlotParam=read_GUI(handles.view_field);731 % [PlotType,PlotParamOut]= plot_field(ProjField,haxes,PlotParam,1);732 % write_plot_param(handles,PlotParamOut); %update the auto plot parameters733 734 710 %------------------------------------------------------------------- 735 711 function update_plot(handles) … … 768 744 769 745 770 771 772 746 % --- Executes on selection change in ColorCode. 773 747 function ColorCode_Callback(hObject, eventdata, handles)
Note: See TracChangeset
for help on using the changeset viewer.