Changeset 41 for trunk/src/set_object.m
- Timestamp:
- Mar 10, 2010, 11:03:36 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r40 r41 67 67 % parameters on the uvmat interface (obtained by 'get_plot_handle.m') 68 68 function set_object_OpeningFcn(hObject, eventdata, handles, data, PlotHandles,ZBounds) 69 69 %------------------------------------------------------------------- 70 70 % Choose default command line output for set_object 71 71 handles.output = hObject; … … 94 94 % fill the interface as set in the input data: 95 95 if exist('data','var') 96 if isfield(data,'desable_open')97 desable_open=data.desable_open;%test to desable button OPEN (edit or display mode)98 end96 % if isfield(data,'desable_open') 97 % desable_open=data.desable_open;%test to desable button OPEN (edit or display mode) 98 % end 99 99 if isfield(data,'desable_plot') 100 100 desable_plot=data.desable_plot;%test to desable button PLOT (display mode) … … 110 110 end 111 111 end 112 if isfield(data,'ProjMode') && isfield(data,'Style')113 data.TITLE=set_title(data.Style,data.ProjMode);% define TITLE in set_object (POINTS, LINE, PATCH,...)114 end115 if isfield(data,'TITLE')116 menutitle=get(handles.TITLE,'String');117 for iline=1:length(menutitle)118 strmenu=menutitle{iline};119 if isequal(data.TITLE,strmenu)120 set(handles.TITLE,'Value',iline)121 break122 end123 end124 TITLE_Callback(hObject, eventdata, handles)% enable edit boxes depending on TITLE125 end126 if isfield(data,'fixedtitle')&isequal(data.fixedtitle,1)127 set(handles.TITLE,'enable','off')128 end112 % if isfield(data,'ProjMode') && isfield(data,'Style') 113 % data.TITLE=set_title(data.Style,data.ProjMode);% define TITLE in set_object (POINTS, LINE, PATCH,...) 114 % end 115 % if isfield(data,'TITLE') 116 % menutitle=get(handles.TITLE,'String'); 117 % for iline=1:length(menutitle) 118 % strmenu=menutitle{iline}; 119 % if isequal(data.TITLE,strmenu) 120 % set(handles.TITLE,'Value',iline) 121 % break 122 % end 123 % end 124 % TITLE_Callback(hObject, eventdata, handles)% enable edit boxes depending on TITLE 125 % end 126 % if isfield(data,'fixedtitle')&isequal(data.fixedtitle,1) 127 % set(handles.TITLE,'enable','off') 128 % end 129 129 if isfield(data,'Style') 130 130 menu=get(handles.ObjectStyle,'String'); … … 136 136 end 137 137 end 138 ObjectStyle_Callback(hObject, eventdata, handles) 138 139 if isfield(data,'ProjMode') 139 140 menu=get(handles.ProjMode,'String'); … … 145 146 end 146 147 end 148 ProjMode_Callback(hObject, eventdata, handles) 147 149 if isfield(data,'Coord') & size(data.Coord,2)>=2 148 150 sizcoord=size(data.Coord); … … 226 228 end 227 229 end 228 if desable_open229 set(handles.OPEN,'Visible','off')230 else231 set(handles.OPEN,'Visible','on')232 end230 % if desable_open 231 % set(handles.OPEN,'Visible','off') 232 % else 233 % set(handles.OPEN,'Visible','on') 234 % end 233 235 if desable_plot 234 236 set(handles.PLOT,'Visible','off') … … 252 254 % --- Executes on selection change in ObjectStyle. 253 255 function ObjectStyle_Callback(hObject, eventdata, handles) 254 style_prev=get(handles.ObjectStyle,'UserData'); 256 style_prev=get(handles.ObjectStyle,'UserData');%previous object style 255 257 str=get(handles.ObjectStyle,'String'); 256 258 val=get(handles.ObjectStyle,'Value'); 259 style=str{val}; 257 260 % make correspondance between different object styles 258 261 % if ~isequal(str{val},style_prev) … … 287 290 z_new{1}=Zcolumn{1}; 288 291 end 289 if isequal(st r{val},'line')292 if isequal(style,'line') 290 293 if isequal(style_prev,'rectangle')|isequal(style_prev,'ellipse') 291 294 XMax=get(handles.XMax,'String'); … … 297 300 set(handles.ZObject,'String',z_new) 298 301 end 299 elseif isequal(st r{val},'polyline')300 elseif isequal(st r{val},'rectangle')| isequal(str{val},'ellipse')302 elseif isequal(style,'polyline') 303 elseif isequal(style,'rectangle')| isequal(style,'ellipse') 301 304 set(handles.XObject,'String',x_new) 302 305 set(handles.YObject,'String',y_new) … … 304 307 end 305 308 % end 306 307 308 309 switch style 310 case {'points','line','polyline','plane'} 311 menu_proj={'projection';'interp';'filter';'none'}; 312 case {'polygon','rectangle','ellipse'} 313 menu_proj={'inside';'outside';'mask_inside';'mask_outside'}; 314 case 'volume' 315 menu_proj={'none'}; 316 end 317 proj_index=get(handles.ProjMode,'Value'); 318 if proj_index<numel(menu_proj) 319 set(handles.ProjMode,'Value',1);% value index must not exceed the menu length 320 end 321 set(handles.ProjMode,'String',menu_proj) 309 322 ProjMode_Callback(hObject, eventdata, handles) 310 323 %store the current option 311 324 str=get(handles.ObjectStyle,'String'); 312 325 val=get(handles.ObjectStyle,'Value'); 313 set(handles.ObjectStyle,'UserData',st r{val})326 set(handles.ObjectStyle,'UserData',style) 314 327 315 328 %---------------------------------------------- … … 334 347 ObjectStyle=menu{value}; 335 348 test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case 336 if isequal(ObjectStyle,'plane')|isequal(ObjectStyle,'volume') 337 set(handles.Phi,'Visible','on') 338 if test3D%3D case 339 set(handles.Theta,'Visible','on') 340 set(handles.Psi,'Visible','on') 341 end 342 set(handles.XMin,'Visible','on') 349 350 %default setting 351 set(handles.Phi,'Visible','off') 352 set(handles.Theta,'Visible','off') 353 set(handles.Psi,'Visible','off') 354 set(handles.XMin,'Visible','off') 355 set(handles.XMax,'Visible','off') 356 set(handles.YMin,'Visible','off') 357 if isequal(ProjMode,'interp') 358 set(handles.YMax,'Visible','off') 359 else 360 set(handles.YMax,'Visible','on') 361 end 362 if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse') 343 363 set(handles.XMax,'Visible','on') 344 set(handles.YMin,'Visible','on')345 set(handles.YMax,'Visible','on')346 if test3D347 set(handles.Theta,'Visible','on')348 set(handles.Psi,'Visible','on')349 set(handles.ZMin,'Visible','on')350 set(handles.ZMax,'Visible','on')351 end352 364 else 353 set(handles.Phi,'Visible','off') 354 set(handles.Theta,'Visible','off') 355 set(handles.Psi,'Visible','off') 356 set(handles.XMin,'Visible','off') 357 set(handles.XMax,'Visible','off') 358 set(handles.YMin,'Visible','off') 359 if isequal(ProjMode,'interp') 360 set(handles.YMax,'Visible','off') 361 else 362 set(handles.YMax,'Visible','on') 363 end 364 if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse') 365 set(handles.XMax,'Visible','on') 366 else 367 set(handles.XMax,'Visible','off') 368 end 369 set(handles.ZMin,'Visible','off') 370 set(handles.ZMax,'Visible','off') 371 end 372 TITLE_list=get(handles.TITLE,'String'); 373 val=get(handles.TITLE,'Value'); 374 TITLE=TITLE_list{val}; 375 switch TITLE 376 case {'POINTS','PATCH','MASK'} 377 set(handles.DX,'Visible','off') 378 set(handles.DY,'Visible','off') 379 set(handles.DZ,'Visible','off') 380 case {'LINE'} 365 set(handles.XMax,'Visible','off') 366 end 367 set(handles.ZMin,'Visible','off') 368 set(handles.ZMax,'Visible','off') 369 set(handles.DX,'Visible','off') 370 set(handles.DY,'Visible','off') 371 set(handles.DZ,'Visible','off') 372 373 switch ObjectStyle 374 case 'points' 375 set(handles.YMax,'TooltipString','YMax: range of averaging around each point') 376 set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points') 377 set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points') 378 set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points') 379 case {'line','polyline','polygon'} 380 set(handles.YMax,'TooltipString','YMax: range of averaging around the line') 381 set(handles.XObject,'TooltipString','XObject: set of x coordinates defining the line') 382 set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line') 383 set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line') 381 384 if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') 382 385 set(handles.DX,'Visible','on') 383 else 384 set(handles.DX,'Visible','off') 385 end 386 case {'PLANE'} 386 set(handles.DX,'TooltipString','DX: mesh for the interpolated field along the line') 387 end 388 case {'rectangle','ellipse'} 389 set(handles.XMax,'TooltipString',['XMax: half length of the ' ObjectStyle]) 390 set(handles.YMax,'TooltipString',['YMax: half width of the ' ObjectStyle]) 391 set(handles.XObject,'TooltipString',['XObject: x coordinate of the ' ObjectStyle ' centre']) 392 set(handles.YObject,'TooltipString',['YObject: y coordinate of the ' ObjectStyle ' centre']) 393 case {'plane','volume'} 394 set(handles.Phi,'Visible','on') 395 set(handles.XMin,'Visible','on') 396 set(handles.XMax,'Visible','on') 397 set(handles.YMin,'Visible','on') 398 set(handles.YMax,'Visible','on') 399 set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' ObjectStyle]) 400 set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' ObjectStyle]) 401 if test3D 402 set(handles.Theta,'Visible','on') 403 set(handles.Psi,'Visible','on') 404 set(handles.ZMin,'Visible','on') 405 set(handles.ZMax,'Visible','on') 406 end 387 407 if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') 388 408 set(handles.DX,'Visible','on') … … 392 412 set(handles.DY,'Visible','off') 393 413 end 394 case {'VOLUME'} 395 if isequal(ProjMode,'interp') 396 set(handles.DX,'Visible','on') 397 set(handles.DY,'Visible','on') 398 set(handles.DZ,'Visible','on') 399 else 400 set(handles.DX,'Visible','off') 401 set(handles.DY,'Visible','off') 402 set(handles.DZ,'Visible','off') 403 end 404 end 405 406 %--------------------------------------------- 407 % --- Executes on selection change in TITLE. 408 function TITLE_Callback(hObject, eventdata, handles) 409 %--------------------------------------------- 410 hsetobject=get(handles.TITLE,'parent'); 411 SetData=get(hsetobject,'UserData');%get the hidden interface data 412 % function named CALLBACK in UNTITLED.M with the given input arguments. 413 menu=get(handles.TITLE,'String'); 414 value=get(handles.TITLE,'Value'); 415 titl=menu{value}; 416 if isequal(titl,'POINTS'); 417 menu_style={'points'}; 418 menu_proj={'projection';'interp';'filter';'none'}; 419 elseif isequal(titl,'LINE') 420 menu_style={'line';'polyline';'rectangle';'polygon';'ellipse'};%'line' =default 421 menu_proj={'projection';'interp';'filter';'none'}; 422 elseif isequal(titl,'PATCH') 423 menu_style={'rectangle';'polygon';'ellipse'};%'line' =default 424 menu_proj={'inside';'outside'}; 425 elseif isequal(titl,'MASK') 426 menu_style={'polygon'};%'line' =default 427 menu_proj={'mask_inside';'mask_outside'}; 428 elseif isequal(titl,'PLANE') 429 menu_style={'plane'}; 430 menu_proj={'projection';'interp';'filter';'none'}; 431 elseif isequal(titl,'VOLUME') 432 menu_style={'volume'}; 433 menu_proj={'none'}; 434 435 end 436 old_menu=get(handles.ObjectStyle,'String'); 437 value=get(handles.ObjectStyle,'Value'); 438 old_style=old_menu{value}; 439 teststyle=0; 440 for iline=1:length(menu_style) 441 if isequal(menu_style{iline},old_style) 442 styleval=iline; 443 teststyle=1; 444 break 445 end 446 end 447 if ~teststyle 448 new_style=[];%default 449 switch old_style 450 case 'polyline' 451 new_style='polygon'; 452 case 'polygon' 453 new_style='polyline'; 454 end 455 if ~isempty(new_style) 456 for iline=1:length(menu_style) 457 if isequal(menu_style{iline},new_style) 458 styleval=iline; 459 teststyle=1; 460 break 461 end 462 end 463 end 464 end 465 if ~teststyle 466 styleval=1; 467 end 468 set(handles.ObjectStyle,'String',menu_style) 469 set(handles.ObjectStyle,'Value',styleval) 470 set(handles.ProjMode,'String',menu_proj) 471 set(handles.ProjMode,'Value',1) 472 ObjectStyle_Callback(hObject, eventdata, handles) 414 if isequal(ObjectStyle,'volume') && isequal(ProjMode,'interp') 415 set(handles.DZ,'Visible','on') 416 end 417 end 418 % 419 % %--------------------------------------------- 420 % % --- Executes on selection change in TITLE. 421 % function TITLE_Callback(style, handles) 422 % %--------------------------------------------- 423 % switch style 424 % case {'points','line','polyline','plane'} 425 % menu_proj={'projection';'interp';'filter';'none'}; 426 % case {'polygon','rectangle','ellipse'} 427 % menu_proj={'inside';'outside';'mask_inside';'mask_outside'}; 428 % case 'volume' 429 % menu_proj={'none'}; 430 % end 431 % 432 % 433 % old_menu=get(handles.ObjectStyle,'String'); 434 % value=get(handles.ObjectStyle,'Value'); 435 % old_style=old_menu{value}; 436 % teststyle=0; 437 % for iline=1:length(menu_style) 438 % if isequal(menu_style{iline},old_style) 439 % styleval=iline; 440 % teststyle=1; 441 % break 442 % end 443 % end 444 % if ~teststyle 445 % new_style=[];%default 446 % switch old_style 447 % case 'polyline' 448 % new_style='polygon'; 449 % case 'polygon' 450 % new_style='polyline'; 451 % end 452 % if ~isempty(new_style) 453 % for iline=1:length(menu_style) 454 % if isequal(menu_style{iline},new_style) 455 % styleval=iline; 456 % teststyle=1; 457 % break 458 % end 459 % end 460 % end 461 % end 462 % if ~teststyle 463 % styleval=1; 464 % end 465 % set(handles.ObjectStyle,'String',menu_style) 466 % set(handles.ObjectStyle,'Value',styleval) 467 % set(handles.ProjMode,'String',menu_proj) 468 % set(handles.ProjMode,'Value',1) 469 % ObjectStyle_Callback(hObject, eventdata, handles) 473 470 474 471 %--------------------------------------------- … … 546 543 end 547 544 %Display title 548 title=set_title(s.Style,s.ProjMode);%update the title549 if ~isempty(huvmat)550 hhuvmat=guidata(huvmat);551 end552 menu=get(handles.TITLE,'String');553 for iline=1:length(menu)554 if isequal(menu{iline},title)555 set(handles.TITLE,'Value',iline)556 break557 end558 end559 TITLE_Callback(hObject, eventdata, handles)545 % title=set_title(s.Style,s.ProjMode);%update the title 546 % if ~isempty(huvmat) 547 % hhuvmat=guidata(huvmat); 548 % end 549 % menu=get(handles.TITLE,'String'); 550 % for iline=1:length(menu) 551 % if isequal(menu{iline},title) 552 % set(handles.TITLE,'Value',iline) 553 % break 554 % end 555 % end 556 %TITLE_Callback(hObject, eventdata, handles) 560 557 teststyle=0; 561 % if isfield(s,'Style') 558 559 switch s.Style 560 case {'points','line','polyline','plane'} 561 menu_proj={'projection';'interp';'filter';'none'}; 562 case {'polygon','rectangle','ellipse'} 563 menu_proj={'inside';'outside';'mask_inside';'mask_outside'}; 564 case 'volume' 565 menu_proj={'none'}; 566 end 567 set(handles.ObjectStyle,'String',menu_proj) 562 568 menu=get(handles.ObjectStyle,'String'); 563 569 for iline=1:length(menu) … … 569 575 end 570 576 testmode=0; 571 menu=get(handles.ProjMode,'String');572 for iline=1:length(menu )573 if isequal(menu {iline},s.ProjMode)577 %menu=get(handles.ProjMode,'String'); 578 for iline=1:length(menu_proj) 579 if isequal(menu_proj{iline},s.ProjMode) 574 580 set(handles.ProjMode,'Value',iline) 575 581 testmode=1; … … 754 760 set(huvmat,'UserData',UvData)%update the data in the uvmat interface 755 761 list_str=get(hlist_object,'String'); 756 TITLE=set_title(ObjectData.Style,ObjectData.ProjMode); 757 list_str{IndexObj}=[num2str(IndexObj) '-' TITLE]; 762 % TITLE=set_title(ObjectData.Style,ObjectData.ProjMode); 763 % list_str{IndexObj}=[num2str(IndexObj) '-' TITLE]; 764 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 758 765 if isequal(length(list_str),IndexObj) 759 766 list_str{IndexObj+1}='more...'; … … 849 856 end 850 857 msgbox_uvmat('CONFIRMATION',[answer{1} ' saved']) 858 851 859 %--------------------------------------------------------- 852 860 % --- Executes on slider movement. … … 872 880 873 881 874 875 function XObject_Callback(hObject, eventdata, handles)876 877 878 function YObject_Callback(hObject, eventdata, handles)879 880 881 882 883 function ZObject_Callback(hObject, eventdata, handles)884 885 886 882 % --- Executes on button press in HELP. 887 883 function HELP_Callback(hObject, eventdata, handles) 888 884 path_to_uvmat=which ('uvmat');% check the path of uvmat 889 885 pathelp=fileparts(path_to_uvmat); 890 helpfile=fullfile(pathelp,' UVMAT_DOC','uvmat_doc.html');891 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')886 helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); 887 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package') 892 888 else 893 web([helpfile '#set_object'])894 end 895 896 897 898 889 addpath (fullfile(pathelp,'uvmat_doc')) 890 web([helpfile '#set_object']) 891 end 892 893 894
Note: See TracChangeset
for help on using the changeset viewer.