Changeset 410 for trunk/src/set_object.m
- Timestamp:
- May 6, 2012, 4:06:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r402 r410 86 86 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 87 87 set(hObject,'DeleteFcn',{@closefcn}) 88 enable_plot=0;%default: does not allow plot of object and projection89 88 90 89 % fill the interface as set in the input data: 91 90 if exist('data','var') 92 % if isfield(data,'enable_plot')93 % enable_plot=data.enable_plot;%test to desable button PLOT (display mode)94 % end95 91 if isfield(data,'Coord') &&size(data.Coord,2)==3 96 92 set(handles.z_slider,'Visible','on') … … 102 98 end 103 99 if isfield(data,'ProjModeMenu') 104 % set(handles.ProjMode,'String',data.ProjModeMenu) % data.ProjModeMenu as projMode menu105 100 set(handles.ProjMode,'UserData',data.ProjModeMenu)% data.ProjModeMenu as default menu (used in Type_Callback) 106 101 end 107 102 errormsg=fill_GUI(data,handles); 103 if ~isempty(errormsg) 104 msgbox_uvmat('ERROR','bad data input in set_object') 105 return 106 end 108 107 Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type 109 108 … … 181 180 if ~isempty(huvmat) 182 181 hhuvmat=guidata(huvmat); 183 set(hhuvmat.edit_object,'Value',0) 182 set(hhuvmat.ViewObject_1,'value',0)% desactivate the two view buttons 183 set(hhuvmat.ViewObject,'value',0)% 184 set(hhuvmat.edit_object,'Value',0)% desactivate the edit option 184 185 set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree 185 186 % deselect the object in ListObject when view_field is closed … … 257 258 menu_proj=get(handles.ProjMode,'UserData'); 258 259 end 259 proj_index=get(handles.ProjMode,'Value'); 260 if proj_index>numel(menu_proj) 261 set(handles.ProjMode,'Value',1);% value index must not exceed the menu length 262 end 260 ProjModeList=get(handles.ProjMode,'String'); 261 menu_index=find(strcmp(ProjModeList{get(handles.ProjMode,'Value')},menu_proj)); 262 if isempty(menu_index) 263 menu_index=1;% 264 end 265 set(handles.ProjMode,'Value',menu_index);% value index must not exceed the menu length 263 266 set(handles.ProjMode,'String',menu_proj) 264 267 ProjMode_Callback(hObject, eventdata, handles) … … 412 415 function PLOT_Callback(hObject, eventdata, handles) 413 416 414 %% reading the object parameters on the GUI uvmat417 %% reading the object selection in the GUI uvmat 415 418 huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle 416 419 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 417 420 hhuvmat=guidata(huvmat);%handles of the objects children of the GUI uvmat 418 421 ListObject=get(hhuvmat.ListObject,'String');% list of objects displyed in uvmat 419 IndexObj=get(hhuvmat.ListObject,'Value');% index(indices) of the selected object(s) in uvmat 420 % (the first one is plotted in uvmat axis, the second one in view_field) 421 422 %% read the object on the GUI set_object 422 IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat 423 if get(hhuvmat.ViewObject,'Value') 424 IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field 425 end 426 427 %% read the object parameters in the GUI set_object 423 428 ObjectData=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object 424 429 if iscell(ObjectData.Coord)%check for empty line … … 433 438 ObjectName=ObjectData.Name;%name of the current object defined in set_object 434 439 if isempty(ObjectName) 435 if get(hhuvmat.edit_object,'Value')% edit mode436 if isempty(ListObject)437 ObjectName='Plane';438 else439 ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item440 end441 else %new object440 % if get(hhuvmat.edit_object,'Value')% edit mode 441 % if isempty(ListObject) 442 % ObjectName='Plane'; 443 % else 444 % ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item 445 % end 446 % else %new object 442 447 ObjectName=ObjectData.Type; 443 end448 % end 444 449 end 445 450 if ~get(hhuvmat.edit_object,'Value') %new object is being created … … 464 469 IndexObj(2)=numel(ListObject)+1;% append an object to the list in uvmat 465 470 set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list 466 set(hhuvmat.ListObject,'Value',IndexObj) 471 set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list 472 set(hhuvmat.ListObject,'Value',IndexObj(2)) 467 473 UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet) 468 474 end … … 482 488 ListObject{IndexObj(end),1}=ObjectName; 483 489 set(hhuvmat.ListObject,'String',ListObject) 490 set(hhuvmat.ListObject_1,'String',ListObject) 484 491 485 492 %% update the object plot 486 if testnew487 set(hhuvmat.ListObject,'Value',IndexObj)488 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;489 ObjectData.DisplayHandle_view_field=[];490 else493 % if testnew 494 % set(hhuvmat.ListObject,'Value',IndexObj) 495 % ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; 496 % ObjectData.DisplayHandle_view_field=[]; 497 % else 491 498 if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles 492 499 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat; … … 499 506 ObjectData.DisplayHandle_view_field=[]; 500 507 end 501 end508 % end 502 509 UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties 503 if numel(IndexObj)==2510 if numel(IndexObj)==2 504 511 UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2)); 505 end512 end 506 513 set(huvmat,'UserData',UvData) 507 514 … … 509 516 if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none') 510 517 PlotType='text'; 511 512 518 else 513 519 [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current field of uvmat on ObjectData
Note: See TracChangeset
for help on using the changeset viewer.