- Timestamp:
- May 6, 2012, 4:06:22 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ_matlab.m
r406 r410 211 211 [Field,ParamOut,errormsg] = read_field(par_civ2.ImageA,par_civ2.FileTypeA,[],par_civ2.i1); 212 212 par_civ2.ImageA=Field.A; 213 % par_civ2.ImageA=imread(Param.Civ2.ImageA);214 213 else 215 214 par_civ2.ImageA=par_civ1.ImageA; … … 219 218 [Field,ParamOut,errormsg] = read_field(par_civ2.ImageB,par_civ2.FileTypeB,[],par_civ2.i2); 220 219 par_civ2.ImageB=Field.A; 221 % par_civ2.ImageB=imread(Param.Civ2.ImageB);222 220 else 223 221 par_civ2.ImageB=par_civ1.ImageB; -
trunk/src/delete_object.m
r302 r410 11 11 huvmat=findobj('tag','uvmat');%handles of the uvmat interface 12 12 UvData=get(huvmat,'UserData'); 13 hlist_object=findobj(huvmat,'Tag','ListObject');%handles of the object li çst in the uvmat interface13 hlist_object=findobj(huvmat,'Tag','ListObject');%handles of the object list in the uvmat interface 14 14 list_str=get(hlist_object,'String');%objet list 15 ObjectData=[];%default16 hdisplay=[];17 15 if isequal(floor(hObject),hObject) %case of an index 18 16 if ~isempty(UvData) & isfield(UvData, 'Object') & length(UvData.Object)>=hObject … … 76 74 set(hlist_object,'String',list_str) 77 75 set(hlist_object,'Value',length(list_str)) 78 hlist_object=findobj(huvmat,'Tag','list_object_2');%handles of the object liçst in the uvmat interface 79 set(hlist_object,'String',[list_str;{'...'}]) 80 set(hlist_object,'Value',length(list_str)+1) 76 hlist_object_1=findobj(huvmat,'Tag','ListObject_1');%handles of the first object list in the uvmat interface 77 old_index=get(hlist_object_1,'Value'); 78 set(hlist_object_1,'String',list_str) 79 if hObject<=old_index 80 set(hlist_object_1,'Value',old_index-1) 81 end 82 % hlist_object=findobj(huvmat,'Tag','list_object_2');%handles of the object liçst in the uvmat interface 83 % set(hlist_object,'String',[list_str;{'...'}]) 84 % set(hlist_object,'Value',length(list_str)+1) -
trunk/src/mouse_down.m
r402 r410 245 245 %indicate on the list of the GUI uvmat which object has been selected 246 246 if strcmp(get(hcurrentfig,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field 247 IndexObj_old=get(hhuvmat.ListObject,'Value');248 if IndexObj>IndexObj_old(1)249 IndexObj=[IndexObj_old(1) IndexObj];250 else251 IndexObj=[1 IndexObj];252 end247 % IndexObj=get(hhuvmat.ListObject,'Value'); 248 % if IndexObj>IndexObj_old(1) 249 % IndexObj=[IndexObj_old(1) IndexObj]; 250 % else 251 % IndexObj=[1 IndexObj]; 252 % end 253 253 set(hhuvmat.ListObject,'Value',IndexObj); 254 set(hhuvmat.ListObject,'UserData',IndexObj);254 % set(hhuvmat.ListObject,'UserData',IndexObj); 255 255 else 256 set(hhuvmat.ListObject ,'Value',IndexObj);257 list_str=get(hhuvmat.ListObject ,'String');256 set(hhuvmat.ListObject_1,'Value',IndexObj); 257 list_str=get(hhuvmat.ListObject_1,'String'); 258 258 UvData.Object{IndexObj}.Name=list_str{IndexObj}; 259 259 end … … 290 290 if test_create && ~isempty(xy) && ~(isfield(AxeData,'Drawing')&& isequal(AxeData.Drawing,'create')) 291 291 hset_object=findobj(allchild(0),'tag','set_object'); 292 % activate this option if the GUI set_object is opened 292 293 if ~isempty(hset_object) 293 sethandles=guidata(hset_object); 294 ObjectData=read_GUI(hset_object); %read object features in the GUI set_object294 sethandles=guidata(hset_object);% handles of the elements in set_object 295 ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object 295 296 ObjectData.Coord=[]; %reset previous object coordinates 296 ObjectData.Coord(1,1)=xy(1,1); 297 ObjectData.Coord(1,1)=xy(1,1); % the object first coordinate is set by the mouse position 297 298 ObjectData.Coord(1,2)=xy(1,2); 298 if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3299 if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3 299 300 ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle 300 301 end … … 303 304 IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface 304 305 else 305 IndexObj=2; 306 IndexObj=2;% the first object is used for uvmat display or blank 306 307 end 307 308 UvData.Object{IndexObj}=ObjectData; 308 ListObject=get(hhuvmat.ListObject,'String'); 309 IndexObj_old=get(hhuvmat.ListObject,'Value'); 309 ListObject=get(hhuvmat.ListObject_1,'String'); 310 310 UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject; 311 311 ObjectNameNew=ObjectData.Name; … … 313 313 ObjectNameNew=ObjectData.Type; 314 314 end 315 % add an index to the object name if the proposed name already exists 315 316 vers=0;% index of the name 316 317 detectname=1; … … 330 331 ObjectName=ObjectNameNew; 331 332 set(sethandles.Name,'String',ObjectName)% display the default name in set_object 332 IndexObj=numel(ListObject)+1;% append an object to the list in uvmat333 % IndexObj=numel(ListObject)+1;% append an object to the list in uvmat 333 334 set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list 334 set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj]) 335 set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list 336 %set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj]) 337 set(hhuvmat.ListObject,'Value',IndexObj) 335 338 % if isempty(object_name) 336 339 % list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Type]; … … 344 347 PlotData=get(AxeData.CurrentObject,'UserData'); 345 348 PlotData.IndexObj=IndexObj; 346 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph 347 AxeData.Drawing='create'; 349 set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion) 350 AxeData.Drawing='create';% flag for mouse motion 348 351 end 349 352 end -
trunk/src/mouse_up.m
r388 r410 145 145 UvData.Object{IndexObj}=ObjectData;%update the current object properties 146 146 hhuvmat=guidata(huvmat); 147 IndexObj=get(hhuvmat.ListObject,'Value'); 148 IndexObj_1=IndexObj(1); 149 IndexObj_2=IndexObj(2); 150 %IndexObj_2=get(hhuvmat.list_object_2,'Value'); 147 IndexObj_1=get(hhuvmat.ListObject_1,'Value'); 148 IndexObj_2=get(hhuvmat.ListObject,'Value'); 151 149 UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2); 152 150 -
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 -
trunk/src/uvmat.m
r408 r410 238 238 %% refresh projection plane 239 239 UvData.Object{1}.ProjMode='projection';%main plotting plane 240 set(handles.ListObject ,'Value',1)% default: empty projection objectproj_field241 set(handles.ListObject ,'String',{''})240 set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field 241 set(handles.ListObject_1,'String',{''}) 242 242 set(handles.Fields,'Value',1) 243 243 set(handles.Fields,'string',{''}) … … 364 364 set(handles.OBJECT_txt,'Visible','on') 365 365 set(handles.edit_object,'Visible','on') 366 set(handles.ListObject,'Visible','on')366 % set(handles.ListObject_1,'Visible','on') 367 367 set(handles.frame_object,'Visible','on') 368 368 if ~isempty(errormsg) … … 802 802 set(handles.OBJECT_txt,'Visible','on') 803 803 set(handles.edit_object,'Visible','on') 804 set(handles.ListObject,'Visible','on') 804 set(handles.ListObject_1,'Visible','on') 805 set(handles.ViewObject_1,'Visible','on') 805 806 set(handles.frame_object,'Visible','on') 806 807 … … 3891 3892 %------------------------------------------------------------------------ 3892 3893 3893 %------------------------------------------------------------------------ 3894 % --- Executes on selection change in ListObject. 3895 function ListObject_Callback(hObject, eventdata, handles) 3896 %------------------------------------------------------------------------ 3897 list_str=get(handles.ListObject,'String'); 3898 IndexObj_old=get(handles.ListObject,'UserData');%retrieve previous selection 3899 IndexObj=get(handles.ListObject,'Value');%present object selection 3900 3901 %% we select two objects or more at once (using the Ctrl key), keep only the last two items: the first is projected on uvmat, the second on view_field 3902 if length(IndexObj)>2 3903 IndexObj=[IndexObj(end-1) IndexObj(end)];%keeps only the last two selected items at most 3904 end 3905 3906 %% we select one object 3907 if length(IndexObj)==1% 3908 if length(IndexObj_old)>=2 && isequal(IndexObj_old(1),IndexObj) % we select the first previously selected object-> 3909 IndexObj=[1 IndexObj_old(2)];% it desactivates this object and selects the first object for uvmat 3910 elseif length(IndexObj_old)>=2 && isequal(IndexObj_old(2),IndexObj) % we select the second previously selected object-> 3911 IndexObj=IndexObj_old(1);% it desactivates this object and keeps only the first previously selected object (uvmat) 3912 else % 3913 IndexObj=[IndexObj_old(1) IndexObj];% activates a second object while keeping the first previously selected one 3914 end 3915 end 3916 3917 %% The second object is selected, it is displayed in set_object if this GUI is already opened 3894 % --- Executes on selection change in ListObject_1. 3895 function ListObject_1_Callback(hObject, eventdata, handles) 3896 list_str=get(handles.ListObject_1,'String'); 3897 IndexObj=get(handles.ListObject_1,'Value'); 3918 3898 UvData=get(handles.uvmat,'UserData'); 3919 ObjectData=UvData.Object{IndexObj(end)}; 3899 ObjectData=UvData.Object{get(handles.ListObject_1,'Value')}; 3900 3901 %% update the projection plot on uvmat 3902 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on UvData.Object{IndexObj(1)} 3903 plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));%read plotting parameters on the uvmat interfacPlotHandles); 3904 3905 %% display the object parameters if the GUI set_object is already opened 3920 3906 hset_object=findobj(allchild(0),'tag','set_object'); 3921 3907 if ~isempty(hset_object) 3922 delete(hset_object)% delete to refesh the content3908 % delete(hset_object)% delete to refesh the content 3923 3909 ZBounds=0; % default 3924 3910 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') … … 3926 3912 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 3927 3913 end 3928 ObjectData.Name=list_str{IndexObj (end)};3914 ObjectData.Name=list_str{IndexObj}; 3929 3915 set_object(ObjectData,[],ZBounds); 3916 set(handles.ViewObject_1,'Value',1)% show that the selected object in ListObject_1 is currently visualised 3930 3917 end 3931 3918 % desactivate the edit object mode … … 3933 3920 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 3934 3921 3935 %% update the object value stored in ListObject 3936 set(handles.ListObject,'Value',IndexObj); % marks the selected objects in the list 3937 set(handles.ListObject,'UserData',IndexObj)% keep the current object selection in memory for next time 3938 % 3939 % UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 3940 % if numel(UvData.Object)<max(IndexObj); 3941 % msgbox_uvmat('ERROR','invalid object list') 3942 % return 3943 % end 3944 % if numel(IndexObj)>=2 3945 % UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));%update the current object graphic representation 3946 % set(handles.uvmat,'UserData',UvData) 3947 % end 3948 3949 %% update the main plot (on uvmat) if the first selected object has been changed 3950 if ~isequal(IndexObj(1),IndexObj_old(1)) 3951 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on UvData.Object{IndexObj(1)} 3952 plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));%read plotting parameters on the uvmat interfacPlotHandles); 3953 end 3922 %------------------------------------------------------------------------ 3923 % --- Executes on selection change in ListObject. 3924 3925 function ListObject_Callback(hObject, eventdata, handles) 3926 %------------------------------------------------------------------------ 3927 list_str=get(handles.ListObject,'String'); 3928 IndexObj=get(handles.ListObject,'Value');%present object selection 3929 3930 %% The object is displayed in set_object if this GUI is already opened 3931 UvData=get(handles.uvmat,'UserData'); 3932 ObjectData=UvData.Object{IndexObj}; 3933 hset_object=findobj(allchild(0),'tag','set_object'); 3934 if ~isempty(hset_object) 3935 % delete(hset_object)% delete to refesh the content 3936 ZBounds=0; % default 3937 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') 3938 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 3939 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 3940 end 3941 ObjectData.Name=list_str{IndexObj}; 3942 set_object(ObjectData,[],ZBounds); 3943 set(handles.ViewObject,'Value',1)% show that the selected object in ListObject is currently visualised 3944 end 3945 % desactivate the edit object mode 3946 set(handles.edit_object,'Value',0) 3947 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 3954 3948 3955 3949 %% update the second plot (on view_field) if view_field is already openened … … 4023 4017 4024 4018 %------------------------------------------------------------------------ 4019 % --- Executes on button press in ViewObject_1. 4020 function ViewObject_1_Callback(hObject, eventdata, handles) 4021 %------------------------------------------------------------------------ 4022 check_view=get(handles.ViewObject_1,'Value'); 4023 4024 if check_view %activate set_object 4025 set(handles.ViewObject,'Value',0)% deselect ViewObject 4026 IndexObj=get(handles.ListObject_1,'Value'); 4027 list_object=get(handles.ListObject_1,'String'); 4028 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4029 UvData.Object{IndexObj}.Name=list_object{IndexObj}; 4030 if numel(UvData.Object)<IndexObj;% error in UvData 4031 msgbox_uvmat('ERROR','invalid object list') 4032 return 4033 end 4034 ZBounds=0; % default 4035 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') 4036 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 4037 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 4038 end 4039 set(handles.ListObject_1,'Value',IndexObj);%restore ListObject selection after set_object deletion 4040 data=UvData.Object{IndexObj}; 4041 if ~isfield(data,'Type')% default plane 4042 data.Type='plane'; 4043 end 4044 if isfield(UvData,'Field') 4045 Field=UvData.Field; 4046 if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh) 4047 data.RangeX=[UvData.Field.XMin UvData.Field.XMax]; 4048 if strcmp(data.Type,'line')||strcmp(data.Type,'polyline') 4049 data.RangeY=UvData.Field.Mesh; 4050 else 4051 data.RangeY=[UvData.Field.YMin UvData.Field.YMax]; 4052 end 4053 data.DX=UvData.Field.Mesh; 4054 data.DY=UvData.Field.Mesh; 4055 end 4056 if isfield(Field,'NbDim')&& isequal(Field.NbDim,3) 4057 data.Coord=[0 0 0]; %default 4058 end 4059 if isfield(Field,'CoordUnit') 4060 data.CoordUnit=Field.CoordUnit; 4061 end 4062 end 4063 hset_object=set_object(data,[],ZBounds); 4064 hhset_object=guidata(hset_object); 4065 if get(handles.edit_object,'Value')% edit mode 4066 set(hhset_object.PLOT,'Enable','on') 4067 else 4068 set(hhset_object.PLOT,'Enable','off') 4069 end 4070 else 4071 hset_object=findobj(allchild(0),'tag','set_object'); 4072 if ~isempty(hset_object) 4073 delete(hset_object)% delete existing version of set_object 4074 end 4075 end 4076 4077 %------------------------------------------------------------------------ 4025 4078 % --- Executes on button press in ViewObject. 4026 4079 function ViewObject_Callback(hObject, eventdata, handles) 4027 4080 %------------------------------------------------------------------------ 4028 IndexObj=get(handles.ListObject,'Value'); 4029 % IndexObj=IndexObj(end); %keeps only the second value 4030 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4031 if numel(UvData.Object)<IndexObj(end);% error in UvData 4032 msgbox_uvmat('ERROR','invalid object list') 4033 return 4034 end 4035 % ObjectData=UvData.Object{IndexObj(}; 4036 ZBounds=0; % default 4037 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') 4038 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 4039 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 4040 end 4041 hset_object=findobj(allchild(0),'tag','set_object'); 4042 if ~isempty(hset_object) 4043 delete(hset_object)% delete existing version of set_object 4044 end 4045 set(handles.ListObject,'Value',IndexObj);%restore ListObject selection after set_object deletion 4046 if ~isfield(UvData.Object{IndexObj(1)},'Type')% default plane 4047 UvData.Object{IndexObj(1)}.Type='plane'; 4048 end 4049 list_object=get(handles.ListObject,'String'); 4050 UvData.Object{IndexObj(end)}.Name=list_object{IndexObj(end)}; 4051 hset_object=set_object(UvData.Object{IndexObj(end)},[],ZBounds); 4052 hhset_object=guidata(hset_object); 4053 if get(handles.edit_object,'Value')% edit mode 4054 set(hhset_object.PLOT,'Enable','on') 4055 else 4056 set(hhset_object.PLOT,'Enable','off') 4057 end 4058 4059 %% show the second plot (on view_field) 4060 if length(IndexObj)==2 4061 ProjData= proj_field(UvData.Field,UvData.Object{IndexObj(2)});%project the current field on ObjectData 4081 check_view=get(handles.ViewObject,'Value'); 4082 4083 if check_view 4084 set(handles.ViewObject_1,'Value',0)% unselect ViewObject_1 4085 IndexObj=get(handles.ListObject,'Value'); 4086 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4087 if numel(UvData.Object)<IndexObj(end);% error in UvData 4088 msgbox_uvmat('ERROR','invalid object list') 4089 return 4090 end 4091 ZBounds=0; % default 4092 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') 4093 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 4094 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 4095 end 4096 set(handles.ListObject,'Value',IndexObj);%restore ListObject selection after set_object deletion 4097 if ~isfield(UvData.Object{IndexObj(1)},'Type')% default plane 4098 UvData.Object{IndexObj(1)}.Type='plane'; 4099 end 4100 list_object=get(handles.ListObject,'String'); 4101 UvData.Object{IndexObj(end)}.Name=list_object{IndexObj(end)}; 4102 hset_object=set_object(UvData.Object{IndexObj(end)},[],ZBounds); 4103 hhset_object=guidata(hset_object); 4104 if get(handles.edit_object,'Value')% edit mode 4105 set(hhset_object.PLOT,'Enable','on') 4106 else 4107 set(hhset_object.PLOT,'Enable','off') 4108 end 4109 4110 %% show the second plot (on view_field) 4111 ProjData= proj_field(UvData.Field,UvData.Object{IndexObj});%project the current field on ObjectData 4062 4112 hview_field=findobj(allchild(0),'tag','view_field'); 4063 4113 if isempty(hview_field) 4064 4114 hview_field=view_field; 4065 4115 end 4066 PlotHandles=guidata(hview_field); 4116 PlotHandles=guidata(hview_field); 4067 4117 plot_field(ProjData,PlotHandles.axes3,read_GUI(hview_field));%read plotting parameters on the uvmat interfacPlotHandles); 4068 end 4069 4118 else 4119 hset_object=findobj(allchild(0),'tag','set_object'); 4120 if ~isempty(hset_object) 4121 delete(hset_object)% delete existing version of set_object 4122 end 4123 end 4070 4124 %------------------------------------------------------------------- 4071 4125 % --- Executes on selection change in edit_object. … … 4105 4159 %------------------------------------------------------------------------ 4106 4160 IndexObj=get(handles.ListObject,'Value'); 4107 if IndexObj(end)>1 4108 delete_object(IndexObj(end)) 4161 IndexObj_1=get(handles.ListObject_1,'Value'); 4162 4163 if IndexObj>1 && ~isequal(IndexObj,IndexObj_1) 4164 delete_object(IndexObj) 4109 4165 end 4110 4166 … … 4252 4308 data.Type='points'; 4253 4309 data.ProjMode='projection';%default 4310 data.ProjModeMenu={};% do not restrict ProjMode menus 4254 4311 create_object(data,handles) 4255 4312 … … 4259 4316 data.Type='line'; 4260 4317 data.ProjMode='projection';%default 4318 data.ProjModeMenu={};% do not restrict ProjMode menus 4261 4319 create_object(data,handles) 4262 4320 … … 4266 4324 data.Type='polyline'; 4267 4325 data.ProjMode='projection';%default 4326 data.ProjModeMenu={};% do not restrict ProjMode menus 4268 4327 create_object(data,handles) 4269 4328 … … 4273 4332 data.Type='polygon'; 4274 4333 data.ProjMode='inside';%default 4334 data.ProjModeMenu={};% do not restrict ProjMode menus 4275 4335 create_object(data,handles) 4276 4336 … … 4280 4340 data.Type='rectangle'; 4281 4341 data.ProjMode='inside';%default 4342 data.ProjModeMenu={};% do not restrict ProjMode menus 4282 4343 create_object(data,handles) 4283 4344 … … 4287 4348 data.Type='ellipse'; 4288 4349 data.ProjMode='inside';%default 4350 data.ProjModeMenu={};% do not restrict ProjMode menus 4289 4351 create_object(data,handles) 4290 4352 … … 4303 4365 data.Type='plane'; 4304 4366 data.ProjMode='projection';%default 4367 data.ProjModeMenu={};% do not restrict ProjMode menus 4305 4368 create_object(data,handles) 4306 4369 … … 4310 4373 data.Type='volume'; 4311 4374 data.ProjMode='interp';%default 4375 data.ProjModeMenu={}; 4312 4376 % set(handles.create,'Visible','on') 4313 4377 % set(handles.create,'Value',1) 4314 % VOLUME_Callback(hObject,eventdata,handles) 4378 % VOLUME_Callback(hObject,eventdata,handles)data.ProjModeMenu={}; 4315 4379 create_object(data,handles) 4316 4380 … … 4319 4383 function create_object(data,handles) 4320 4384 %------------------------------------------------------------------------ 4321 4385 % desactivate geometric calibration if opened 4322 4386 hgeometry_calib=findobj(allchild(0),'tag','geometry_calib'); 4323 4387 if ishandle(hgeometry_calib) … … 4326 4390 set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7]) 4327 4391 end 4328 UvData=get(handles.uvmat,'UserData');4329 4392 set(handles.edit_object,'Value',0); %suppress the object edit mode 4330 4393 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4331 % data.enable_plot=1; 4394 UvData=get(handles.uvmat,'UserData'); 4395 data.Name=data.Type;% default name=type 4332 4396 data.Coord=[0 0]; %default 4333 4397 if isfield(UvData,'Field') … … 4335 4399 if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh) 4336 4400 data.RangeX=[UvData.Field.XMin UvData.Field.XMax]; 4337 if strcmp(data.Type,'line')||strcmp(data.Type,'polyline') 4401 if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')||strcmp(data.Type,'points') 4338 4402 data.RangeY=UvData.Field.Mesh; 4339 4403 else … … 4342 4406 data.DX=UvData.Field.Mesh; 4343 4407 data.DY=UvData.Field.Mesh; 4344 4345 % elseif isfield(Field,'AX')&& isfield(Field,'AY')&& isfield(Field,'A')%only image4346 % np=size(Field.A);4347 % meshx=(Field.AX(end)-Field.AX(1))/np(2);4348 % meshy=abs(Field.AY(end)-Field.AY(1))/np(1);4349 % data.RangeY=max(meshx,meshy);4350 % data.RangeX=max(meshx,meshy);4351 % data.DX=max(meshx,meshy);4352 4408 end 4353 4409 if isfield(Field,'NbDim')&& isequal(Field.NbDim,3) … … 4361 4417 delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered 4362 4418 end 4363 hset_object=findobj(allchild(0),'tag','set_object'); 4364 IndexObj=get(handles.ListObject,'Value'); 4365 if ~isempty(hset_object) 4366 delete(hset_object)% delete existing version of set_object 4367 end 4368 set(handles.ListObject,'Value',IndexObj) 4419 set(handles.ListObject,'Visible','on') 4420 set(handles.ViewObject,'Visible','on') 4421 set(handles.ViewObject,'Value',1) % indicate that the object selected in ListObject (projection oin view_field) is visualised 4422 set(handles.ViewObject_1,'Value',0)% then the object selected in ListObject_1 is not visualised 4369 4423 hset_object=set_object(data,handles);% call the set_object interface 4370 4424 hhset_object=guidata(hset_object); … … 4372 4426 set(handles.MenuObject,'checked','on') 4373 4427 set(handles.uvmat,'UserData',UvData) 4374 set(handles.CheckZoom,'Value',0) 4428 set(handles.CheckZoom,'Value',0) %desactivate the zoom for object creation by the mouse 4375 4429 CheckZoom_Callback(handles.uvmat, [], handles) 4376 4430 set(handles.delete_object,'Visible','on') … … 4482 4536 return 4483 4537 else 4484 set(handles.ListObject,'Max',2);%allow multiple selection4538 % set(handles.ListObject,'Max',2);%allow multiple selection 4485 4539 set(handles.ListObject,'Value',val); 4486 4540 flag=1;
Note: See TracChangeset
for help on using the changeset viewer.