Changeset 402 for trunk/src/set_object.m
- Timestamp:
- Apr 29, 2012, 11:29:24 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r397 r402 85 85 set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front) 86 86 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 87 set(hObject,'DeleteFcn',{@closefcn}) 87 88 enable_plot=0;%default: does not allow plot of object and projection 88 89 89 90 % fill the interface as set in the input data: 90 91 if exist('data','var') 91 if isfield(data,'enable_plot')92 enable_plot=data.enable_plot;%test to desable button PLOT (display mode)93 end92 % if isfield(data,'enable_plot') 93 % enable_plot=data.enable_plot;%test to desable button PLOT (display mode) 94 % end 94 95 if isfield(data,'Coord') &&size(data.Coord,2)==3 95 96 set(handles.z_slider,'Visible','on') … … 149 150 end 150 151 end 151 if enable_plot 152 set(handles.PLOT,'enable','on') 153 else 152 % if enable_plot 153 % set(handles.PLOT,'enable','on') 154 % else 155 % enable the PLOT (REFRESH) button by default 154 156 set(handles.PLOT,'enable','off') 155 end157 % end 156 158 huvmat=findobj(allchild(0),'tag','uvmat'); 157 159 UvData=get(huvmat,'UserData'); … … 171 173 varargout{1} = handles.output; 172 174 varargout{2}=handles; 175 176 %------------------------------------------------------------------------ 177 % executed when closing the GUI set_object 178 function closefcn(gcbo,eventdata) 179 %------------------------------------------------------------------------ 180 huvmat=findobj(allchild(0),'Tag','uvmat');%find the current uvmat interface handle 181 if ~isempty(huvmat) 182 hhuvmat=guidata(huvmat); 183 set(hhuvmat.edit_object,'Value',0) 184 set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree 185 % deselect the object in ListObject when view_field is closed 186 if isempty(findobj(allchild(0),'Tag','view_field')) 187 ObjIndex=get(hhuvmat.ListObject,'Value'); 188 ObjIndex=ObjIndex(1);%keep only the first object selected 189 set(hhuvmat.ListObject,'Value',ObjIndex) 190 % draw all object colors in blue (unselected) in uvmat 191 hother=[findobj(hhuvmat.axes3,'Tag','proj_object');findobj(hhuvmat.axes3,'Tag','DeformPoint')];%find all the proj object and deform point representations 192 for iobj=1:length(hother) 193 if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch') 194 set(hother(iobj),'EdgeColor','b') 195 if isequal(get(hother(iobj),'FaceColor'),'m') 196 set(hother(iobj),'FaceColor','b') 197 end 198 elseif isequal(get(hother(iobj),'Type'),'image') 199 Acolor=get(hother(iobj),'CData'); 200 Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2)); 201 set(hother(iobj),'CData',Acolor); 202 else 203 set(hother(iobj),'Color','b') 204 end 205 set(hother(iobj),'Selected','off') 206 end 207 end 208 end 209 hseries=findobj(allchild(0),'Name','series');%find the current series interface handle 210 if ~isempty(hseries) 211 hhseries=guidata(hseries); 212 set(hhseries.GetObject,'Value',0) 213 set(hhseries.GetObject,'BackgroundColor',[0 1 0])%put unactivated buttons to green 214 end 215 173 216 174 217 %------------------------------------------------------------------------ … … 364 407 %------------------------------------------------------------------------ 365 408 366 %------------------------------------------------------------------------367 %------------------------------------------------------------------------368 %----------------------------------------------------369 % executed when closing: set the parent interface button to value 0370 function closefcn(gcbo,eventdata,parent_button)371 huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle372 if ~isempty(huvmat)373 hhuvmat=guidata(huvmat);374 set(hhuvmat.edit,'Value',0)375 set(hhuvmat.edit,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree376 end377 hseries=findobj(allchild(0),'Name','series');%find the current series interface handle378 if ~isempty(hseries)379 hhseries=guidata(hseries);380 set(hhseries.GetObject,'Value',0)381 set(hhseries.GetObject,'BackgroundColor',[0 1 0])%put unactivated buttons to green382 end383 409 384 410 %------------------------------------------------------------------------ … … 396 422 %% read the object on the GUI set_object 397 423 ObjectData=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object 398 ObjectName=ObjectData.Name;%name of the current object defined in set_object399 424 if iscell(ObjectData.Coord)%check for empty line 400 425 ObjectData.Coord=[0 0 0]; … … 406 431 ObjectData.Coord(checknan,:)=[];%remove the NaN lines 407 432 end 433 ObjectName=ObjectData.Name;%name of the current object defined in set_object 408 434 if isempty(ObjectName) 409 435 if get(hhuvmat.edit_object,'Value')% edit mode … … 411 437 ObjectName='Plane'; 412 438 else 413 ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item439 ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item 414 440 end 415 441 else %new object 416 StyleList=get(handles.Type,'String'); 417 StyleVal=get(handles.Type,'Value'); 418 ObjectName=StyleList{StyleVal}; 442 ObjectName=ObjectData.Type; 419 443 end 420 444 end … … 422 446 detectname=1; 423 447 ObjectNameNew=ObjectName; 424 vers=0; 448 vers=0;% index of the name 425 449 while detectname==1 426 450 detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list
Note: See TracChangeset
for help on using the changeset viewer.