forked from eigtool/eigtool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
et_plot3d_switch_fn.m
124 lines (100 loc) · 3.51 KB
/
et_plot3d_switch_fn.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
function et_plot3d_switch_fn(the_function)
% function et_plot3d_switch_fn(the_function)
%
% Function called when a menu item in the 3D-pseudospectra plot is
% selected.
%
% See also: EIGTOOL
% Version 2.4.1 (Wed Nov 19 21:54:20 EST 2014)
% Copyright (c) 2002-2014, The Chancellor, Masters and Scholars
% of the University of Oxford, and the EigTool Developers. All rights reserved.
% EigTool is maintained on GitHub: https://github.com/eigtool
% Report bugs/request features at https://github.com/eigtool/eigtool/issues
fig = gcbf;
figure(fig);
itm = gcbo;
redraw_fig = 0;
% Get the data from the figure
plot_data = get(fig,'UserData');
switch the_function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'DispEws'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cur_state = get(itm,'checked');
if strcmp(cur_state,'on'),
set(itm,'Checked','off');
else
set(itm,'Checked','on');
end;
redraw_fig = 1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'LightSource'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
default_vals = {['[ ',num2str(plot_data.light_source),' ]']};
% Loop around until we get valid values
cont = 1;
while cont==1,
s = inputdlg({['Please enter a direction for the light source, in [AZ,EL] ' ...
'view coordinates.']}, ...
'Light Source...', 1,default_vals);
if isempty(s), % If cancel chosen, just do nothing
return;
elseif isempty(s{1}), % If left blank, error (will be trapped below)
light_source = 'error';
else
light_source = str2num(s{1});
end;
% Check the value we've got
if length(light_source)==2,
cont = 0;
redraw_fig = 1;
plot_data.light_source = light_source;
else
h = errordlg('Invalid value for light source direction','Invalid input','modal');
waitfor(h);
end;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'MeshSize'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
default_vals = {num2str(plot_data.xline_freq),num2str(plot_data.yline_freq)};
% Loop around until we get valid values
cont = 1;
while cont==1,
AddOpts.Resize='off';
AddOpts.WindowStyle='modal';
AddOpts.Interpreter='tex';
s = inputdlg({['Please enter a value for the mesh interval in the x-direction'], ...
['Please enter a value for the mesh interval in the y-direction']}, ...
'Mesh Size...', [1;1],default_vals);
if isempty(s), % If cancel chosen, just do nothing
return;
else
xline_freq = str2num(s{1});
yline_freq = str2num(s{2});
end;
% Check the value we've got
if length(xline_freq)==1 & length(yline_freq)==1,
cont = 0;
redraw_fig = 1;
plot_data.xline_freq = xline_freq;
plot_data.yline_freq = yline_freq;
else
h = errordlg('Invalid value for mesh sizes','Invalid input','modal');
waitfor(h);
end;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
otherwise
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This is there just in case of a bug somewhere!
errordlg([the_function ': Undefined action! This should not ' ...
'have happened in the release version. Please contact ' ...
'[email protected].'],'Error...','modal');
end; % END OF SWITCH STATEMENT
% Save the data back to the figure
set(fig,'UserData',plot_data);
% Redraw the figure
if redraw_fig,
create_3d_plot(fig);
end;