Changeset 388 for trunk/src/set_object.m
- Timestamp:
- Apr 6, 2012, 4:37:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r387 r388 220 220 set(handles.ProjMode,'String',menu_proj) 221 221 ProjMode_Callback(hObject, eventdata, handles) 222 223 %store the current option224 % str=get(handles.Type,'String');225 % val=get(handles.Type,'Value');226 % set(handles.Type,'UserData',style)227 228 %------------------------------------------------------------------------229 function xObject_Callback(hObject, eventdata, handles)230 231 %------------------------------------------------------------------------232 function yObject_Callback(hObject, eventdata, handles)233 234 %------------------------------------------------------------------------235 % --- Executes on selection change in zObject.236 function zObject_Callback(hObject, eventdata, handles)237 %------------------------------------------------------------------------238 222 239 223 %------------------------------------------------------------------------ … … 403 387 404 388 %% reading the object parameters on the GUI uvmat 405 huvmat=findobj('tag','uvmat');%find the current uvmat interfacehandle389 huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle 406 390 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat 407 hhuvmat=guidata(huvmat);%handles in the uvmat GUI 408 ListObject=get(hhuvmat.ListObject,'String');%position in the objet list 409 IndexObj=get(hhuvmat.ListObject,'Value'); 391 hhuvmat=guidata(huvmat);%handles of the objects children of the GUI uvmat 392 ListObject=get(hhuvmat.ListObject,'String');% list of objects displyed in uvmat 393 IndexObj=get(hhuvmat.ListObject,'Value');% index(indices) of the selected object(s) in uvmat 394 % (the first one is plotted in uvmat axis, the second one in view_field) 410 395 411 396 %% read the object on the GUI set_object 412 %ObjectData=read_set_object(handles.set_object);%read the input parameters defining the object in the GUI set_object 413 ObjectData=read_GUI(handles.set_object);%read the input parameters defining the object in the GUI set_object 414 %ObjectData.Coord=cell2mat(ObjectData.Coord); 415 ObjectName=ObjectData.Name;%name of the current object defiend in set_object 397 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_object 399 checknan=isnan(sum(ObjectData.Coord,2));%check for NaN lines 400 if ~isempty(checknan) 401 ObjectData.Coord(checknan,:)=[];%remove the NaN lines 402 end 416 403 if isempty(ObjectName) 417 404 if get(hhuvmat.edit_object,'Value')% edit mode … … 449 436 testnew=0; 450 437 if numel(IndexObj)==1 % if only one object is selected, the projection is in uvmat 451 % PlotHandles=hhuvmat;452 438 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 453 439 else % if a second object is selected, the projection is in view_field, and this second object is selected 454 440 hview_field=findobj(allchild(0),'tag','view_field'); 455 441 if isempty(hview_field) 456 hview_field=view_field; 442 hview_field=view_field;%open the GUI view_field if it is not found 457 443 end 458 444 PlotHandles=guidata(hview_field); … … 464 450 set(hhuvmat.ListObject,'String',ListObject) 465 451 466 %% update the object plot and projection field452 %% update the object plot 467 453 if testnew 468 454 set(hhuvmat.ListObject,'Value',IndexObj) … … 488 474 489 475 %% plot the field projected on the object and store in the corresponding figue 490 [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 491 if ~isempty(errormsg) 492 msgbox_uvmat('ERROR', errormsg) 493 return 494 end 495 fighandle=get(plotaxes,'parent'); 496 PlotParam=read_GUI(fighandle); 497 [PlotType,Object_out{IndexObj(end)}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot 498 476 if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none') 477 PlotType='text'; 478 479 else 480 [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current field of uvmat on ObjectData 481 if ~isempty(errormsg) 482 msgbox_uvmat('ERROR', errormsg) 483 return 484 end 485 fighandle=get(plotaxes,'parent'); 486 PlotParam=read_GUI(fighandle); 487 PlotType=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot 488 end 489 if strcmp(PlotType,'text') 490 hview_field=findobj(allchild(0),'tag','view_field'); %case of no projection (pure object display) 491 if ~isempty(hview_field) 492 delete(hview_field) 493 end 494 end 495 499 496 %% update the GUI uvmat 500 497 hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI … … 603 600 end 604 601 605 %set new plane position and update graph 606 % set(handles.XObject,'String',num2str(norm_plane(1)*Z_value,4)) 607 % set(handles.YObject,'String',num2str(norm_plane(2)*Z_value,4)) 608 % set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4)) 602 % update graph 609 603 PLOT_Callback(hObject, eventdata, handles) 610 604 … … 616 610 pathelp=fileparts(path_to_uvmat); 617 611 helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); 618 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') 619 else 612 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') 620 613 addpath (fullfile(pathelp,'uvmat_doc')) 621 614 web([helpfile '#set_object']) … … 641 634 case{'points','polyline','polygon'} 642 635 Coord=get(handles.Coord,'Data'); 643 if isequal(size(Coord,2),3) 644 Coord=[Coord;{[]} {[]} {[]}];%add a line for edition (3D case) 645 else 646 Coord=[Coord;{[]} {[]}]; %add a line for edition (2D case) 647 end 648 set(handles.Coord,'Data',Coord) 636 if ~isnan(Coord(end,1)) 637 if isequal(size(Coord,2),3) 638 %Coord=[Coord;{[]} {[]} {[]}];%add a line for edition (3D case) 639 Coord=[Coord;NaN NaN NaN]; %add a line for edition (3D case) 640 else 641 Coord=[Coord;NaN NaN]; %add a line for edition (2D case) 642 end 643 set(handles.Coord,'Data',Coord) 644 end 649 645 end 650 646
Note: See TracChangeset
for help on using the changeset viewer.