[204] | 1 | %'set_object': GUI to edit a projection object |
---|
| 2 | %------------------------------------------------------------------------ |
---|
| 3 | % function hset_object= set_object(data, PlotHandles,ZBounds) |
---|
| 4 | % associated with the GUI set_object.fig |
---|
| 5 | % |
---|
| 6 | % OUTPUT: |
---|
| 7 | % hset_object: handle of the GUI figure |
---|
| 8 | % |
---|
| 9 | % INPUT: |
---|
| 10 | % data: structure describing the object properties |
---|
| 11 | % .Style=... |
---|
| 12 | % .ProjMode |
---|
| 13 | % .CoordType: 'phys' or 'px' |
---|
[379] | 14 | % .num_DX,.num_DY,.num_DZ : mesh along each dirction |
---|
[204] | 15 | % .RangeX, RangeY |
---|
| 16 | % .Coord(j,i), i=1, 2, 3, components x, y, z of j=1...n position(s) characterizing the object components |
---|
| 17 | % PlotHandles: handles for projection plots NO MORE USED |
---|
| 18 | % Zbounds: bounds on Z ( 3D case) |
---|
| 19 | % |
---|
| 20 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 21 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
| 22 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 23 | % This file is part of the toolbox UVMAT. |
---|
| 24 | % |
---|
| 25 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 26 | % it under the terms of the GNU General Public License as published by |
---|
| 27 | % the Free Software Foundation; either version 2 of the License, or |
---|
| 28 | % (at your option) any later version. |
---|
| 29 | % |
---|
| 30 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 31 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 32 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 33 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
| 34 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 35 | |
---|
| 36 | function varargout = set_object(varargin) |
---|
| 37 | |
---|
[379] | 38 | % Last Modified by GUIDE v2.5 26-Jan-2012 22:00:47 |
---|
[204] | 39 | |
---|
| 40 | % Begin initialization code - DO NOT PLOT |
---|
| 41 | gui_Singleton = 1; |
---|
| 42 | gui_State = struct('gui_Name', mfilename, ... |
---|
| 43 | 'gui_Singleton', gui_Singleton, ... |
---|
| 44 | 'gui_OpeningFcn', @set_object_OpeningFcn, ... |
---|
| 45 | 'gui_OutputFcn', @set_object_OutputFcn, ... |
---|
| 46 | 'gui_LayoutFcn', [] , ... |
---|
| 47 | 'gui_Callback', []); |
---|
| 48 | if nargin & ischar(varargin{1}) |
---|
| 49 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 50 | end |
---|
| 51 | |
---|
| 52 | if nargout |
---|
| 53 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 54 | else |
---|
| 55 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 56 | end |
---|
| 57 | % End initialization code - DO NOT PLOT |
---|
| 58 | %------------------------------------------------------------------------ |
---|
| 59 | %------------------------------------------------------------------------ |
---|
| 60 | % --- Executes just before set_object is made visible. |
---|
| 61 | %INPUT: |
---|
| 62 | % handles: handles of the set_object interface elements |
---|
| 63 | %'IndexObj': NON USED ANYMORE (To suppress) index of the object (on the UvData list) that set_object will modify |
---|
| 64 | % if =[] or absent: index still undefined (create mode in uvmat) |
---|
| 65 | % if=0; no associated object (used for series), the button 'PLOT' is then unvisible |
---|
| 66 | %'data': read from an existing object selected in the interface |
---|
[379] | 67 | % .Name : class of object ('POINTS','LINE',....) |
---|
| 68 | % .num_DX,num_DY,num_DZ; meshes for regular grids |
---|
[204] | 69 | % .Coord: object position coordinates |
---|
| 70 | % .ParentButton: handle of the uicontrol object calling the interface |
---|
| 71 | % PlotHandles: set of handles of the elements contolling the plotting of the projected field: |
---|
| 72 | % if =[] or absent, no plot (mask mode in uvmat) |
---|
| 73 | % parameters on the uvmat interface (obtained by 'get_plot_handle.m') |
---|
| 74 | function set_object_OpeningFcn(hObject, eventdata, handles, data, PlotHandles,ZBounds) |
---|
| 75 | %------------------------------------------------------------------- |
---|
| 76 | % Choose default command line output for set_object |
---|
| 77 | handles.output = hObject; |
---|
| 78 | % Update handles structure |
---|
| 79 | guidata(hObject, handles); |
---|
| 80 | |
---|
| 81 | %default |
---|
[206] | 82 | if ~exist('ZBounds','var') |
---|
| 83 | ZBounds=0; %default |
---|
[204] | 84 | end |
---|
| 85 | set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front) |
---|
[309] | 86 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function |
---|
[204] | 87 | enable_plot=0;%default: does not allow plot of object and projection |
---|
| 88 | |
---|
| 89 | % fill the interface as set in the input data: |
---|
| 90 | if exist('data','var') |
---|
| 91 | if isfield(data,'enable_plot') |
---|
| 92 | enable_plot=data.enable_plot;%test to desable button PLOT (display mode) |
---|
| 93 | end |
---|
[379] | 94 | if isfield(data,'Coord') &&size(data.Coord,2)==3 |
---|
| 95 | set(handles.z_slider,'Visible','on') |
---|
| 96 | else |
---|
[204] | 97 | set(handles.z_slider,'Visible','off') |
---|
| 98 | end |
---|
[379] | 99 | errormsg=fill_GUI(data,handles); |
---|
| 100 | % if isfield(data,'StyleMenu') |
---|
| 101 | % set(handles.Type,'String',data.StyleMenu); |
---|
| 102 | % end |
---|
| 103 | % if isfield(data,'Type') |
---|
| 104 | % menu=get(handles.Type,'String'); |
---|
| 105 | % for iline=1:length(menu) |
---|
| 106 | % if isequal(menu{iline},data.Style) |
---|
| 107 | % set(handles.Type,'Value',iline) |
---|
| 108 | % break |
---|
| 109 | % end |
---|
| 110 | % end |
---|
| 111 | % end |
---|
| 112 | Type_Callback(hObject, eventdata, handles) |
---|
| 113 | % if isfield(data,'ProjMenu') |
---|
| 114 | % set(handles.ProjMode,'String',data.ProjMenu);%overset the standard menu |
---|
| 115 | % end |
---|
| 116 | % if isfield(data,'ProjMode') |
---|
| 117 | % menu=get(handles.ProjMode,'String'); |
---|
| 118 | % for iline=1:length(menu) |
---|
| 119 | % if isequal(menu{iline},data.ProjMode) |
---|
| 120 | % set(handles.ProjMode,'Value',iline) |
---|
| 121 | % break |
---|
| 122 | % end |
---|
| 123 | % end |
---|
| 124 | % end |
---|
| 125 | % ProjMode_Callback(hObject, eventdata, handles) |
---|
| 126 | % if isfield(data,'Coord') |
---|
| 127 | % if ischar(data.Coord) |
---|
| 128 | % data.Coord=str2num(data.Coord); |
---|
| 129 | % elseif iscell(data.Coord) |
---|
| 130 | % CoordCell=data.Coord; |
---|
| 131 | % data.Coord=zeros(numel(CoordCell),3); |
---|
| 132 | % data.Coord(:,3)=zeros(numel(CoordCell),1); % z component set to 0 by default |
---|
| 133 | % for iline=1:numel(CoordCell) |
---|
| 134 | % line_vec=str2num(CoordCell{iline}); |
---|
| 135 | % if numel(line_vec)==2 |
---|
| 136 | % data.Coord(iline,1:2)=str2num(CoordCell{iline}); |
---|
| 137 | % else |
---|
| 138 | % data.Coord(iline,:)=str2num(CoordCell{iline}); |
---|
| 139 | % end |
---|
| 140 | % end |
---|
| 141 | % end |
---|
| 142 | % if size(data.Coord,2)>=2 |
---|
| 143 | % sizcoord=size(data.Coord); |
---|
| 144 | % for i=1:sizcoord(1) |
---|
| 145 | % XObject{i}=num2str(data.Coord(i,1),4); |
---|
| 146 | % YObject{i}=num2str(data.Coord(i,2),4); |
---|
| 147 | % end |
---|
| 148 | % % set(handles.XObject,'String',XObject) |
---|
| 149 | % % set(handles.YObject,'String',YObject) |
---|
| 150 | % if sizcoord(2)>3 |
---|
| 151 | % for i=1:sizcoord(1) |
---|
| 152 | % ZObject{i}=num2str(data.Coord(i,3),4); |
---|
| 153 | % end |
---|
| 154 | % set(handles.ZObject,'String',ZObject) |
---|
| 155 | % end |
---|
| 156 | % end |
---|
| 157 | % end |
---|
| 158 | % if isfield(data,'DX') |
---|
| 159 | % if ~ischar(handles.num_DX) |
---|
| 160 | % data.DX=num2str(data.DX,3); |
---|
| 161 | % end |
---|
| 162 | % set(handles.num_DX,'String',data.DX) |
---|
| 163 | % end |
---|
| 164 | % if isfield(data,'DY') |
---|
| 165 | % if ~ischar(handles.num_DY) |
---|
| 166 | % data.DY=num2str(data.DY,3); |
---|
| 167 | % end |
---|
| 168 | % set(handles.num_DY,'String',data.DX) |
---|
| 169 | % end |
---|
[204] | 170 | if isfield(data,'RangeZ') && length(ZBounds) >= 2 |
---|
[379] | 171 | set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3)) |
---|
[204] | 172 | DZ=max(data.RangeZ);%slider step |
---|
[206] | 173 | if ~isnan(ZBounds(1)) && ZBounds(2)~=ZBounds(1) |
---|
[204] | 174 | rel_step(1)=min(DZ/(ZBounds(2)-ZBounds(1)),0.2);%must be smaller than 1 |
---|
| 175 | rel_step(2)=0.1; |
---|
| 176 | set(handles.z_slider,'Visible','on') |
---|
| 177 | set(handles.z_slider,'Min',ZBounds(1)) |
---|
| 178 | set(handles.z_slider,'Max',ZBounds(2)) |
---|
| 179 | set(handles.z_slider,'SliderStep',rel_step) |
---|
| 180 | set(handles.z_slider,'Value',(ZBounds(1)+ZBounds(2))/2) |
---|
| 181 | end |
---|
| 182 | end |
---|
| 183 | if isfield(data,'RangeX') |
---|
| 184 | if ischar(data.RangeX) |
---|
| 185 | data.RangeX=str2num(data.RangeX); |
---|
| 186 | end |
---|
[379] | 187 | set(handles.num_RangeX_2,'String',num2str(max(data.RangeX),3)) |
---|
| 188 | set(handles.num_RangeX_1,'String',num2str(min(data.RangeX),3)) |
---|
[204] | 189 | end |
---|
| 190 | if isfield(data,'RangeY') |
---|
| 191 | if ischar(data.RangeY) |
---|
| 192 | data.RangeY=str2num(data.RangeY); |
---|
| 193 | end |
---|
[379] | 194 | set(handles.num_RangeY_2,'String',num2str(max(data.RangeY),3)) |
---|
| 195 | set(handles.num_RangeY_1,'String',num2str(min(data.RangeY),3)) |
---|
[204] | 196 | end |
---|
| 197 | if isfield(data,'RangeZ') |
---|
| 198 | if ischar(data.RangeZ) |
---|
| 199 | data.RangeZ=str2num(data.RangeZ); |
---|
| 200 | end |
---|
[379] | 201 | set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3)) |
---|
[204] | 202 | if numel(data.RangeZ)>=2 |
---|
[379] | 203 | set(handles.num_RangeZ_1,'String',num2str(min(data.RangeZ),3)) |
---|
[204] | 204 | end |
---|
| 205 | end |
---|
[212] | 206 | if isfield(data,'Angle') && isequal(numel(data.Angle),3) |
---|
[379] | 207 | set(handles.num_Angle_1,'String',num2str(data.Angle(1))) |
---|
| 208 | set(handles.num_Angle_2,'String',num2str(data.Angle(2))) |
---|
| 209 | set(handles.num_Angle_3,'String',num2str(data.Angle(3))) |
---|
[204] | 210 | end |
---|
[379] | 211 | % if isfield(data,'DZ') |
---|
| 212 | % if ~ischar(handles.num_DZ) |
---|
| 213 | % data.DY=num2str(data.DZ,3); |
---|
| 214 | % end |
---|
| 215 | % set(handles.num_DZ,'String',data.DZ) |
---|
| 216 | % end |
---|
| 217 | % if isfield(data,'CoordUnit') |
---|
| 218 | % set(handles.CoordUnit,'String',data.CoordUnit) |
---|
| 219 | % end |
---|
[204] | 220 | end |
---|
| 221 | if enable_plot |
---|
| 222 | set(handles.PLOT,'enable','on') |
---|
| 223 | else |
---|
| 224 | set(handles.PLOT,'enable','off') |
---|
| 225 | end |
---|
| 226 | huvmat=findobj(allchild(0),'tag','uvmat'); |
---|
| 227 | UvData=get(huvmat,'UserData'); |
---|
| 228 | pos_uvmat=get(huvmat,'Position'); |
---|
| 229 | %position the set_object GUI with respect to uvmat |
---|
| 230 | if isfield(UvData,'SetObjectOrigin') |
---|
| 231 | pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2); |
---|
| 232 | pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); |
---|
| 233 | set(hObject,'Position',pos_set_object) |
---|
| 234 | end |
---|
| 235 | |
---|
[379] | 236 | |
---|
[204] | 237 | %------------------------------------------------------------------------ |
---|
| 238 | % --- Outputs from this function are returned to the command line. |
---|
| 239 | function varargout = set_object_OutputFcn(hObject, eventdata, handles) |
---|
| 240 | %------------------------------------------------------------------------ |
---|
| 241 | % Get default command line output from handles structure |
---|
| 242 | varargout{1} = handles.output; |
---|
| 243 | varargout{2}=handles; |
---|
| 244 | |
---|
| 245 | %------------------------------------------------------------------------ |
---|
[379] | 246 | % --- Executes on selection change in Type. |
---|
| 247 | function Type_Callback(hObject, eventdata, handles) |
---|
[204] | 248 | %------------------------------------------------------------------------ |
---|
[379] | 249 | %style_prev=get(handles.Type,'UserData');%previous object style |
---|
| 250 | ListType=get(handles.Type,'String'); |
---|
| 251 | Type=ListType{get(handles.Type,'Value')}; |
---|
[204] | 252 | % make correspondance between different object styles |
---|
[379] | 253 | Coord=get(handles.Coord,'Data'); |
---|
| 254 | % |
---|
| 255 | % Xcolumn=get(handles.XObject,'String'); |
---|
| 256 | % Ycolumn=get(handles.YObject,'String'); |
---|
| 257 | % if ischar(Xcolumn) |
---|
| 258 | % sizchar=size(Xcolumn); |
---|
| 259 | % for icol=1:sizchar(1) |
---|
| 260 | % Xcolumn_cell{icol}=Xcolumn(icol,:); |
---|
| 261 | % end |
---|
| 262 | % Xcolumn=Xcolumn_cell; |
---|
| 263 | % end |
---|
| 264 | % if ischar(Ycolumn) |
---|
| 265 | % sizchar=size(Ycolumn); |
---|
| 266 | % for icol=1:sizchar(1) |
---|
| 267 | % Ycolumn_cell{icol}=Ycolumn(icol,:); |
---|
| 268 | % end |
---|
| 269 | % Ycolumn=Ycolumn_cell; |
---|
| 270 | % end |
---|
| 271 | % Zcolumn={};%default |
---|
| 272 | % z_new={}; |
---|
| 273 | % if isequal(get(handles.ZObject,'Visible'),'on') |
---|
| 274 | % %data.NbDim=3; %test 3D object |
---|
| 275 | % Zcolumn=get(handles.ZObject,'String'); |
---|
| 276 | % if ischar(Zcolumn) |
---|
| 277 | % Zcolumn={Zcolumn}; |
---|
| 278 | % end |
---|
| 279 | % end |
---|
| 280 | % x_new{1}=Xcolumn{1}; |
---|
| 281 | % y_new{1}=Ycolumn{1}; |
---|
| 282 | % x_new{1}=Coord(1,1); |
---|
| 283 | % y_new{1}=Coord(1,2); |
---|
| 284 | % z_new{1}=Coord(1,3); |
---|
| 285 | % if ~isempty(Zcolumn) |
---|
| 286 | % z_new{1}=Zcolumn{1}; |
---|
| 287 | % end |
---|
| 288 | % if isequal(style,'line') |
---|
| 289 | % if strcmp(style_prev,'rectangle')||strcmp(style_prev,'ellipse') |
---|
| 290 | % num_RangeX_2=get(handles.num_RangeX_2,'String'); |
---|
| 291 | % num_RangeY_2=get(handles.num_RangeY_2,'String'); |
---|
| 292 | % x_new{2}=num2str(num_RangeX_2,4); |
---|
| 293 | % y_new{2}=num2str(num_RangeY_2,4); |
---|
| 294 | % set(handles.XObject,'String',x_new) |
---|
| 295 | % set(handles.YObject,'String',y_new) |
---|
| 296 | % set(handles.ZObject,'String',z_new) |
---|
| 297 | % end |
---|
| 298 | % elseif isequal(style,'polyline') |
---|
| 299 | % elseif strcmp(style,'rectangle')|| strcmp(style,'ellipse') |
---|
| 300 | % set(handles.XObject,'String',x_new) |
---|
| 301 | % set(handles.YObject,'String',y_new) |
---|
| 302 | % set(handles.ZObject,'String',z_new) |
---|
| 303 | % end |
---|
| 304 | |
---|
| 305 | %% set the number of lines in the Coord table depending on object type |
---|
| 306 | switch Type |
---|
| 307 | case{'line'} |
---|
| 308 | if size(Coord,1)<2 |
---|
| 309 | if isequal(size(Coord,2),3) |
---|
| 310 | Coord=[Coord; 0 0 0];%add a line for edition (3D case) |
---|
| 311 | else |
---|
| 312 | Coord=[Coord; 0 0]; %add a line for edition (2D case) |
---|
| 313 | end |
---|
| 314 | else |
---|
| 315 | Coord=Coord(1:2,:); |
---|
| 316 | end |
---|
| 317 | case{'rectangle','ellipse','plane','volume'} |
---|
| 318 | Coord=Coord(1,:); |
---|
[204] | 319 | end |
---|
[379] | 320 | set(handles.Coord,'Data',Coord) |
---|
[204] | 321 | |
---|
[379] | 322 | %% set the projection menu and the corresponding options |
---|
| 323 | switch Type |
---|
[204] | 324 | case {'points','line','polyline','plane'} |
---|
| 325 | menu_proj={'projection';'interp';'filter';'none'}; |
---|
| 326 | case {'polygon','rectangle','ellipse'} |
---|
| 327 | menu_proj={'inside';'outside';'mask_inside';'mask_outside'}; |
---|
| 328 | case 'volume' |
---|
| 329 | menu_proj={'interp';'none'}; |
---|
[379] | 330 | otherwise |
---|
| 331 | menu_proj={'projection';'interp';'filter';'none'};%default |
---|
[204] | 332 | end |
---|
| 333 | proj_index=get(handles.ProjMode,'Value'); |
---|
| 334 | if proj_index<numel(menu_proj) |
---|
| 335 | set(handles.ProjMode,'Value',1);% value index must not exceed the menu length |
---|
| 336 | end |
---|
| 337 | set(handles.ProjMode,'String',menu_proj) |
---|
| 338 | ProjMode_Callback(hObject, eventdata, handles) |
---|
[379] | 339 | |
---|
[204] | 340 | %store the current option |
---|
[379] | 341 | % str=get(handles.Type,'String'); |
---|
| 342 | % val=get(handles.Type,'Value'); |
---|
| 343 | % set(handles.Type,'UserData',style) |
---|
[204] | 344 | |
---|
| 345 | %------------------------------------------------------------------------ |
---|
| 346 | function xObject_Callback(hObject, eventdata, handles) |
---|
| 347 | |
---|
| 348 | %------------------------------------------------------------------------ |
---|
| 349 | function yObject_Callback(hObject, eventdata, handles) |
---|
| 350 | |
---|
| 351 | %------------------------------------------------------------------------ |
---|
| 352 | % --- Executes on selection change in zObject. |
---|
| 353 | function zObject_Callback(hObject, eventdata, handles) |
---|
| 354 | %------------------------------------------------------------------------ |
---|
| 355 | |
---|
| 356 | %------------------------------------------------------------------------ |
---|
| 357 | % --- Executes on selection change in ProjMode. |
---|
| 358 | function ProjMode_Callback(hObject, eventdata, handles) |
---|
| 359 | menu=get(handles.ProjMode,'String'); |
---|
| 360 | value=get(handles.ProjMode,'Value'); |
---|
| 361 | ProjMode=menu{value}; |
---|
[379] | 362 | menu=get(handles.Type,'String'); |
---|
| 363 | value=get(handles.Type,'Value'); |
---|
[204] | 364 | ObjectStyle=menu{value}; |
---|
[379] | 365 | %%%%%%%%% TODO |
---|
| 366 | test3D=0; %TODO: update test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case |
---|
| 367 | %%%%%%%%% |
---|
[204] | 368 | %default setting |
---|
[379] | 369 | set(handles.num_Angle_1,'Visible','off') |
---|
| 370 | set(handles.num_Angle_2,'Visible','off') |
---|
| 371 | set(handles.num_Angle_3,'Visible','off') |
---|
| 372 | set(handles.num_RangeX_1,'Visible','off') |
---|
| 373 | set(handles.num_RangeX_2,'Visible','off') |
---|
| 374 | set(handles.num_RangeY_1,'Visible','off') |
---|
[204] | 375 | if isequal(ProjMode,'interp') |
---|
[379] | 376 | set(handles.num_RangeY_2,'Visible','off') |
---|
[204] | 377 | else |
---|
[379] | 378 | set(handles.num_RangeY_2,'Visible','on') |
---|
[204] | 379 | end |
---|
| 380 | if strcmp(ObjectStyle,'rectangle')||strcmp(ObjectStyle,'ellipse') |
---|
[379] | 381 | set(handles.num_RangeX_2,'Visible','on') |
---|
[204] | 382 | else |
---|
[379] | 383 | set(handles.num_RangeX_2,'Visible','off') |
---|
[204] | 384 | end |
---|
[379] | 385 | set(handles.num_RangeZ_1,'Visible','off') |
---|
| 386 | set(handles.num_RangeZ_2,'Visible','off') |
---|
| 387 | set(handles.num_DX,'Visible','off') |
---|
| 388 | set(handles.num_DY,'Visible','off') |
---|
| 389 | set(handles.num_DZ,'Visible','off') |
---|
[204] | 390 | |
---|
| 391 | switch ObjectStyle |
---|
| 392 | case 'points' |
---|
[379] | 393 | set(handles.num_RangeY_2,'TooltipString','num_YMax: range of projection around each point') |
---|
| 394 | % set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points') |
---|
| 395 | % set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points') |
---|
| 396 | % set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points') |
---|
[204] | 397 | case {'line','polyline','polygon'} |
---|
[379] | 398 | set(handles.num_RangeY_2,'TooltipString','num_YMax: range of projection around the line') |
---|
| 399 | set(handles.Coord,'TooltipString','Coord: table of x,y, z coordinates defining the line') |
---|
| 400 | % set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line') |
---|
| 401 | % set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line') |
---|
[204] | 402 | if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') |
---|
[379] | 403 | set(handles.num_DX,'Visible','on') |
---|
| 404 | set(handles.num_DX,'TooltipString','num_DX: mesh for the interpolated field along the line') |
---|
[204] | 405 | end |
---|
| 406 | case {'rectangle','ellipse'} |
---|
[379] | 407 | set(handles.num_RangeX_2,'TooltipString',['num_XMax: half length of the ' ObjectStyle]) |
---|
| 408 | set(handles.num_RangeY_2,'TooltipString',['num_YMax: half width of the ' ObjectStyle]) |
---|
| 409 | % set(handles.XObject,'TooltipString',['XObject: x coordinate of the ' Type ' centre']) |
---|
| 410 | % set(handles.YObject,'TooltipString',['YObject: y coordinate of the ' Type ' centre']) |
---|
[204] | 411 | case {'plane'} |
---|
[379] | 412 | set(handles.num_Angle_3,'Visible','on') |
---|
| 413 | set(handles.num_RangeX_1,'Visible','on') |
---|
| 414 | set(handles.num_RangeX_2,'Visible','on') |
---|
| 415 | set(handles.num_RangeY_1,'Visible','on') |
---|
| 416 | set(handles.num_RangeY_2,'Visible','on') |
---|
| 417 | % set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' Type]) |
---|
| 418 | % set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' Type]) |
---|
| 419 | set(handles.num_RangeZ_2,'TooltipString','num_ZMax: range of projection normal to the plane') |
---|
[204] | 420 | if test3D |
---|
[379] | 421 | set(handles.num_Angle_2,'Visible','on') |
---|
| 422 | set(handles.num_Angle_1,'Visible','on') |
---|
| 423 | set(handles.num_RangeZ_2,'Visible','on') |
---|
[204] | 424 | end |
---|
| 425 | if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') |
---|
[379] | 426 | set(handles.num_DX,'Visible','on') |
---|
| 427 | set(handles.num_DY,'Visible','on') |
---|
[204] | 428 | else |
---|
[379] | 429 | set(handles.num_DX,'Visible','off') |
---|
| 430 | set(handles.num_DY,'Visible','off') |
---|
[204] | 431 | end |
---|
[206] | 432 | if isequal(ProjMode,'interp') |
---|
[379] | 433 | set(handles.num_DZ,'Visible','on') |
---|
[204] | 434 | end |
---|
| 435 | case {'volume'} |
---|
[379] | 436 | set(handles.num_RangeX_1,'Visible','on') |
---|
| 437 | set(handles.num_RangeX_2,'Visible','on') |
---|
| 438 | set(handles.num_RangeY_1,'Visible','on') |
---|
| 439 | set(handles.num_RangeY_2,'Visible','on') |
---|
[204] | 440 | set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' ObjectStyle]) |
---|
| 441 | set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' ObjectStyle]) |
---|
[379] | 442 | set(handles.num_Angle_1,'Visible','on') |
---|
| 443 | set(handles.num_Angle_2,'Visible','on') |
---|
| 444 | set(handles.num_Angle_3,'Visible','on') |
---|
| 445 | set(handles.num_RangeZ_1,'Visible','on') |
---|
| 446 | set(handles.num_RangeZ_2,'Visible','on') |
---|
[204] | 447 | if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter') |
---|
[379] | 448 | set(handles.num_DX,'Visible','on') |
---|
| 449 | set(handles.num_DY,'Visible','on') |
---|
| 450 | set(handles.num_DZ,'Visible','on') |
---|
[204] | 451 | else |
---|
[379] | 452 | set(handles.num_DX,'Visible','off') |
---|
| 453 | set(handles.num_DY,'Visible','off') |
---|
| 454 | set(handles.num_DZ,'Visible','off') |
---|
[204] | 455 | end |
---|
| 456 | end |
---|
| 457 | %------------------------------------------------------------------------ |
---|
| 458 | |
---|
| 459 | %------------------------------------------------------------------------ |
---|
[379] | 460 | function num_Angle_1_Callback(hObject, eventdata, handles) |
---|
[204] | 461 | update_slider(hObject, eventdata,handles) |
---|
| 462 | %------------------------------------------------------------------------ |
---|
| 463 | %------------------------------------------------------------------------ |
---|
[379] | 464 | function num_Angle_2_Callback(hObject, eventdata, handles) |
---|
[204] | 465 | update_slider(hObject, eventdata,handles) |
---|
| 466 | %------------------------------------------------------------------------ |
---|
| 467 | function update_slider(hObject, eventdata,handles) |
---|
| 468 | %rotation angles |
---|
[379] | 469 | PlaneAngle(1)=str2num(get(handles.num_Angle_1,'String'));%first angle in degrees |
---|
| 470 | PlaneAngle(2)=str2num(get(handles.num_Angle_2,'String'));%second angle in degrees |
---|
| 471 | PlaneAngle(3)=str2num(get(handles.num_Angle_3,'String'));%second angle in degrees |
---|
[212] | 472 | om=norm(PlaneAngle);%norm of rotation angle in radians |
---|
| 473 | OmAxis=PlaneAngle/om; %unit vector marking the rotation axis |
---|
| 474 | cos_om=cos(pi*om/180); |
---|
| 475 | sin_om=sin(pi*om/180); |
---|
| 476 | coeff=OmAxis(3)*(1-cos_om); |
---|
| 477 | %components of the unity vector norm_plane normal to the projection plane |
---|
| 478 | norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; |
---|
| 479 | norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om; |
---|
| 480 | norm_plane(3)=OmAxis(3)*coeff+cos_om; |
---|
[204] | 481 | huvmat=findobj('Tag','uvmat');%find the current uvmat interface handle |
---|
| 482 | UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface |
---|
| 483 | if isfield(UvData,'X') & isfield(UvData,'Y') & isfield(UvData,'Z') |
---|
[212] | 484 | Z=norm_plane(1)*(UvData.X)+norm_plane(2)*(UvData.Y)+norm_plane(3)*(UvData.Z); |
---|
[204] | 485 | set(handles.z_slider,'Min',min(Z)) |
---|
| 486 | set(handles.z_slider,'Max',max(Z)) |
---|
| 487 | ZMax_Callback(hObject, eventdata, handles) |
---|
| 488 | end |
---|
| 489 | %------------------------------------------------------------------------ |
---|
[379] | 490 | function num_DX_Callback(hObject, eventdata, handles) |
---|
[204] | 491 | %------------------------------------------------------------------------ |
---|
| 492 | %------------------------------------------------------------------------ |
---|
[379] | 493 | function num_DY_Callback(hObject, eventdata, handles) |
---|
[204] | 494 | %------------------------------------------------------------------------ |
---|
| 495 | %------------------------------------------------------------------------ |
---|
[379] | 496 | function num_DZ_Callback(hObject, eventdata, handles) |
---|
[204] | 497 | %------------------------------------------------------------------------ |
---|
| 498 | |
---|
| 499 | %------------------------------------------------------------------------ |
---|
| 500 | %------------------------------------------------------------------------ |
---|
| 501 | %---------------------------------------------------- |
---|
| 502 | % executed when closing: set the parent interface button to value 0 |
---|
| 503 | function closefcn(gcbo,eventdata,parent_button) |
---|
| 504 | huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle |
---|
| 505 | if ~isempty(huvmat) |
---|
| 506 | hhuvmat=guidata(huvmat); |
---|
| 507 | set(hhuvmat.edit,'Value',0) |
---|
| 508 | set(hhuvmat.edit,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree |
---|
| 509 | end |
---|
| 510 | hseries=findobj(allchild(0),'Name','series');%find the current series interface handle |
---|
| 511 | if ~isempty(hseries) |
---|
| 512 | hhseries=guidata(hseries); |
---|
| 513 | set(hhseries.GetObject,'Value',0) |
---|
| 514 | set(hhseries.GetObject,'BackgroundColor',[0 1 0])%put unactivated buttons to green |
---|
| 515 | end |
---|
| 516 | |
---|
| 517 | %------------------------------------------------------------------------ |
---|
| 518 | % --- Executes on button press in PLOT: PLOT the defined object and its projected field |
---|
| 519 | function PLOT_Callback(hObject, eventdata, handles) |
---|
| 520 | |
---|
| 521 | %% reading the object parameters on the GUI uvmat |
---|
| 522 | huvmat=findobj('tag','uvmat');%find the current uvmat interface handle |
---|
| 523 | UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat |
---|
| 524 | hhuvmat=guidata(huvmat);%handles in the uvmat GUI |
---|
[307] | 525 | ListObject=get(hhuvmat.ListObject,'String');%position in the objet list |
---|
[342] | 526 | IndexObj=get(hhuvmat.ListObject,'Value'); |
---|
[341] | 527 | |
---|
| 528 | %% read the object on the GUI set_object |
---|
[379] | 529 | %ObjectData=read_set_object(handles.set_object);%read the input parameters defining the object in the GUI set_object |
---|
| 530 | ObjectData=read_GUI(handles.set_object);%read the input parameters defining the object in the GUI set_object |
---|
| 531 | %ObjectData.Coord=cell2mat(ObjectData.Coord); |
---|
| 532 | ObjectName=ObjectData.Name;%name of the current object defiend in set_object |
---|
[309] | 533 | if isempty(ObjectName) |
---|
| 534 | if get(hhuvmat.edit_object,'Value')% edit mode |
---|
| 535 | ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item |
---|
[342] | 536 | else %new object |
---|
[379] | 537 | StyleList=get(handles.Type,'String'); |
---|
| 538 | StyleVal=get(handles.Type,'Value'); |
---|
[342] | 539 | ObjectName=StyleList{StyleVal}; |
---|
[309] | 540 | end |
---|
[204] | 541 | end |
---|
[309] | 542 | if ~get(hhuvmat.edit_object,'Value') %new object is being created |
---|
[204] | 543 | detectname=1; |
---|
| 544 | ObjectNameNew=ObjectName; |
---|
| 545 | vers=0; |
---|
[309] | 546 | while detectname==1 |
---|
[204] | 547 | detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list |
---|
| 548 | if detectname% if the object name already exists |
---|
| 549 | indstr=regexp(ObjectNameNew,'\D'); |
---|
| 550 | if indstr(end)<length(ObjectNameNew) %object name ends by a number |
---|
| 551 | vers=str2double(ObjectNameNew(indstr(end)+1:end))+1; |
---|
| 552 | ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)]; |
---|
| 553 | else |
---|
| 554 | vers=vers+1; |
---|
[309] | 555 | ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]; |
---|
[204] | 556 | end |
---|
| 557 | end |
---|
| 558 | end |
---|
| 559 | ObjectName=ObjectNameNew; |
---|
[379] | 560 | set(handles.Name,'String',ObjectName)% display the default name in set_object |
---|
[342] | 561 | IndexObj(2)=numel(ListObject)+1;% append an object to the list in uvmat |
---|
| 562 | set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list |
---|
| 563 | set(hhuvmat.ListObject,'Value',IndexObj) |
---|
| 564 | UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet) |
---|
[204] | 565 | end |
---|
[309] | 566 | testnew=0; |
---|
| 567 | if numel(IndexObj)==1 % if only one object is selected, the projection is in uvmat |
---|
[379] | 568 | % PlotHandles=hhuvmat; |
---|
[309] | 569 | plotaxes=hhuvmat.axes3;%handle of axes3 in view_field |
---|
| 570 | else % if a second object is selected, the projection is in view_field, and this second object is selected |
---|
| 571 | hview_field=findobj(allchild(0),'tag','view_field'); |
---|
| 572 | if isempty(hview_field) |
---|
| 573 | hview_field=view_field; |
---|
| 574 | end |
---|
| 575 | PlotHandles=guidata(hview_field); |
---|
| 576 | plotaxes=PlotHandles.axes3;%handle of axes3 in view_field |
---|
| 577 | end |
---|
| 578 | |
---|
| 579 | %% naming the object |
---|
| 580 | ListObject{IndexObj(end),1}=ObjectName; |
---|
[307] | 581 | set(hhuvmat.ListObject,'String',ListObject) |
---|
[204] | 582 | |
---|
| 583 | %% update the object plot and projection field |
---|
[309] | 584 | if testnew |
---|
| 585 | set(hhuvmat.ListObject,'Value',IndexObj) |
---|
[204] | 586 | ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; |
---|
| 587 | ObjectData.DisplayHandle_view_field=[]; |
---|
| 588 | else |
---|
[309] | 589 | if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles |
---|
| 590 | ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat; |
---|
[204] | 591 | else |
---|
| 592 | ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input |
---|
| 593 | end |
---|
[309] | 594 | if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles |
---|
| 595 | ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field; |
---|
[204] | 596 | else |
---|
| 597 | ObjectData.DisplayHandle_view_field=[]; |
---|
| 598 | end |
---|
| 599 | end |
---|
[309] | 600 | UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties |
---|
| 601 | if numel(IndexObj)==2 |
---|
| 602 | UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2)); |
---|
| 603 | end |
---|
[204] | 604 | set(huvmat,'UserData',UvData) |
---|
| 605 | |
---|
| 606 | %% plot the field projected on the object and store in the corresponding figue |
---|
[227] | 607 | [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData |
---|
| 608 | if ~isempty(errormsg) |
---|
| 609 | msgbox_uvmat('ERROR', errormsg) |
---|
| 610 | return |
---|
| 611 | end |
---|
[292] | 612 | fighandle=get(plotaxes,'parent'); |
---|
| 613 | PlotParam=read_GUI(fighandle); |
---|
[309] | 614 | [PlotType,Object_out{IndexObj(end)}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot |
---|
[204] | 615 | |
---|
| 616 | %% update the GUI uvmat |
---|
| 617 | hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI |
---|
| 618 | set(hhuvmat.MenuEditObject,'enable','on') |
---|
| 619 | set(hhuvmat.edit_object,'Value',1) % set uvmat to object edit mode to allow further object update |
---|
| 620 | set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow |
---|
| 621 | |
---|
| 622 | %------------------------------------------------------------------------ |
---|
| 623 | % --- Executes on button press in MenuCoord. |
---|
| 624 | function MenuCoord_Callback(hObject, eventdata, handles) |
---|
| 625 | %------------------------------------------------------------------------ |
---|
| 626 | %---------------------------------------------------- |
---|
[379] | 627 | function num_RangeY_1_Callback(hObject, eventdata, handles) |
---|
[204] | 628 | %------------------------------------------------------------------------ |
---|
| 629 | |
---|
[379] | 630 | function num_RangeZ_1_Callback(hObject, eventdata, handles) |
---|
[204] | 631 | %------------------------------------------------------------------------ |
---|
| 632 | |
---|
[379] | 633 | function num_RangeZ_2_Callback(hObject, eventdata, handles) |
---|
| 634 | DZ=str2num(get(handles.num_RangeZ_2,'String')); |
---|
[204] | 635 | ZMin=get(handles.z_slider,'Min'); |
---|
| 636 | ZMax=get(handles.z_slider,'Max'); |
---|
| 637 | if ~isequal(ZMax-ZMin,0) |
---|
| 638 | rel_step(1)=DZ/(ZMax-ZMin); |
---|
| 639 | rel_step(2)=0.2; |
---|
| 640 | set(handles.z_slider,'SliderStep',rel_step) |
---|
| 641 | end |
---|
| 642 | %------------------------------------------------------------------------ |
---|
[379] | 643 | function num_RangeY_2_Callback(hObject, eventdata, handles) |
---|
[204] | 644 | %------------------------------------------------------------------------ |
---|
| 645 | |
---|
[379] | 646 | function num_RangeX_1_Callback(hObject, eventdata, handles) |
---|
[204] | 647 | %------------------------------------------------------------------------ |
---|
| 648 | |
---|
[379] | 649 | function num_RangeX_2_Callback(hObject, eventdata, handles) |
---|
[204] | 650 | %------------------------------------------------------------------------ |
---|
| 651 | %------------------------------------------------------------------------ |
---|
| 652 | function SAVE_Callback(hObject, eventdata, handles) |
---|
| 653 | % ------------------------------------------------------ |
---|
[379] | 654 | %Object=read_set_object(handles); |
---|
| 655 | Object=read_GUI(handles.set_object); |
---|
[204] | 656 | huvmat=findobj('Tag','uvmat'); |
---|
| 657 | % UvData=get(huvmat,'UserData'); |
---|
| 658 | if isempty(huvmat) |
---|
| 659 | huvmat=findobj(allchild(0),'Name','series'); |
---|
| 660 | end |
---|
| 661 | hchild=get(huvmat,'Children'); |
---|
| 662 | hrootpath=findobj(hchild,'Tag','RootPath'); |
---|
| 663 | if isempty(hrootpath) |
---|
| 664 | RootPath=''; |
---|
| 665 | else |
---|
| 666 | RootPath=get(hrootpath,'String'); |
---|
| 667 | if iscell(RootPath) |
---|
| 668 | RootPath=RootPath{1}; |
---|
| 669 | end |
---|
| 670 | end |
---|
| 671 | title={'object name'}; |
---|
| 672 | dir_save=uigetdir(RootPath); |
---|
[379] | 673 | ObjectName=get(handles.Name,'String'); |
---|
[204] | 674 | if ~isempty(ObjectName)&&~strcmp(ObjectName,'') |
---|
| 675 | def={fullfile(dir_save,[ObjectName '.xml'])}; |
---|
| 676 | else |
---|
| 677 | def={fullfile(dir_save,[Object.Style '.xml'])}; |
---|
| 678 | end |
---|
| 679 | displ_txt='save object as an .xml file';%default display |
---|
| 680 | menu=get(handles.ProjMode,'String'); |
---|
| 681 | value=get(handles.ProjMode,'Value'); |
---|
| 682 | ProjMode=menu{value}; |
---|
| 683 | if strcmp(ProjMode,'mask_inside')||strcmp(ProjMode,'mask_outside') |
---|
| 684 | displ_txt='save mask contour as an .xml file: to create a mask image, use save_mask on the GUI uvmat (lower right)'; |
---|
| 685 | end |
---|
| 686 | answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def); |
---|
| 687 | if ~isempty(answer) |
---|
| 688 | t=struct2xml(Object); |
---|
| 689 | save(t,answer{1}) |
---|
| 690 | end |
---|
| 691 | msgbox_uvmat('CONFIRMATION',[answer{1} ' saved']) |
---|
[227] | 692 | |
---|
[204] | 693 | %------------------------------------------------------------------------ |
---|
| 694 | % --- Executes on slider movement. |
---|
| 695 | function z_slider_Callback(hObject, eventdata, handles) |
---|
| 696 | %--------------------------------------------------------- |
---|
| 697 | Z_value=get(handles.z_slider,'Value'); |
---|
| 698 | %rotation angles |
---|
[227] | 699 | PlaneAngle=[0 0 0]; |
---|
| 700 | norm_plane=[0 0 1]; |
---|
| 701 | cos_om=1; |
---|
| 702 | sin_om=0; |
---|
| 703 | |
---|
[379] | 704 | PlaneAngle(1)=str2double(get(handles.num_Angle_1,'String'));%first angle in degrees |
---|
| 705 | PlaneAngle(2)=str2double(get(handles.num_Angle_2,'String'));%second angle in degrees |
---|
| 706 | PlaneAngle(3)=str2double(get(handles.num_Angle_3,'String'));%second angle in degrees |
---|
[227] | 707 | PlaneAngle=(pi/180)*PlaneAngle; |
---|
[212] | 708 | om=norm(PlaneAngle);%norm of rotation angle in radians |
---|
[227] | 709 | if isequal(om,0) |
---|
| 710 | norm_plane=[0 0 1]; |
---|
| 711 | else |
---|
| 712 | OmAxis=PlaneAngle/om; %unit vector marking the rotation axis |
---|
| 713 | cos_om=cos(om); |
---|
| 714 | sin_om=sin(om); |
---|
| 715 | coeff=OmAxis(3)*(1-cos_om); |
---|
| 716 | %components of the unity vector norm_plane normal to the projection plane |
---|
| 717 | norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; |
---|
| 718 | norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om; |
---|
| 719 | norm_plane(3)=OmAxis(3)*coeff+cos_om; |
---|
| 720 | end |
---|
[204] | 721 | |
---|
| 722 | %set new plane position and update graph |
---|
[379] | 723 | % set(handles.XObject,'String',num2str(norm_plane(1)*Z_value,4)) |
---|
| 724 | % set(handles.YObject,'String',num2str(norm_plane(2)*Z_value,4)) |
---|
| 725 | % set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4)) |
---|
[204] | 726 | PLOT_Callback(hObject, eventdata, handles) |
---|
[227] | 727 | |
---|
[204] | 728 | %------------------------------------------------------------------------ |
---|
| 729 | % --- Executes on button press in HELP. |
---|
| 730 | function HELP_Callback(hObject, eventdata, handles) |
---|
[227] | 731 | %------------------------------------------------------------------------ |
---|
[204] | 732 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
| 733 | pathelp=fileparts(path_to_uvmat); |
---|
| 734 | helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); |
---|
| 735 | 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') |
---|
| 736 | else |
---|
| 737 | addpath (fullfile(pathelp,'uvmat_doc')) |
---|
| 738 | web([helpfile '#set_object']) |
---|
| 739 | end |
---|
| 740 | %------------------------------------------------------------------------ |
---|
| 741 | |
---|
[379] | 742 | function Name_Callback(hObject, eventdata, handles) |
---|
| 743 | % hObject handle to Name (see GCBO) |
---|
| 744 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 745 | % handles structure with handles and user data (see GUIDATA) |
---|
[204] | 746 | |
---|
[379] | 747 | % Hints: get(hObject,'String') returns contents of Name as text |
---|
| 748 | % str2double(get(hObject,'String')) returns contents of Name as a double |
---|
| 749 | |
---|
| 750 | %------------------------------------------------------------------------ |
---|
| 751 | % --- Executes when entered data in editable cell(s) in Coord. |
---|
| 752 | function Coord_CellEditCallback(hObject, eventdata, handles) |
---|
| 753 | %------------------------------------------------------------------------ |
---|
| 754 | ListType=get(handles.Type,'String'); |
---|
| 755 | Type=ListType{get(handles.Type,'Value')}; |
---|
| 756 | switch Type |
---|
| 757 | % add lines if multi line input needed |
---|
| 758 | case{'points','polyline','polygon'} |
---|
| 759 | Coord=get(handles.Coord,'Data'); |
---|
| 760 | if isequal(size(Coord,2),3) |
---|
| 761 | Coord=[Coord;{[]} {[]} {[]}];%add a line for edition (3D case) |
---|
| 762 | else |
---|
| 763 | Coord=[Coord;{[]} {[]}]; %add a line for edition (2D case) |
---|
| 764 | end |
---|
| 765 | set(handles.Coord,'Data',Coord) |
---|
| 766 | end |
---|
| 767 | |
---|
| 768 | |
---|
| 769 | |
---|
| 770 | function num_Angle_3_Callback(hObject, eventdata, handles) |
---|
| 771 | % hObject handle to num_Angle_3 (see GCBO) |
---|
| 772 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 773 | % handles structure with handles and user data (see GUIDATA) |
---|
| 774 | |
---|
| 775 | % Hints: get(hObject,'String') returns contents of num_Angle_3 as text |
---|
| 776 | % str2double(get(hObject,'String')) returns contents of num_Angle_3 as a double |
---|