This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BrillouinEvaluation.m
80 lines (68 loc) · 2.56 KB
/
BrillouinEvaluation.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
function varargout = BrillouinEvaluation
%% MAINCONTROLLER MainController
% controller knows about model and view
clear model;
model = BE_Model.Model(); % model is independent
includePath(model);
clear view;
view = BE_View.View();
BE_View.Tabs(model, view); % view has a reference of the model
controllers = controller(model, view);
model.controllers = controllers;
% add logging class
model.log = BE_Utils.Logging.Logging(model.pp, 'log.log');
model.log.write('');
model.log.write('#####################################################');
model.log.log('V/BrillouinEvaluation: Opened program.');
model.log.write('=====================================================');
set(view.figure, 'CloseRequestFcn', {@closeGUI, model, view, controllers});
controllers.closeGUI = @() closeGUI(0, 0, model, view, controllers);
if nargout > 0
varargout{1} = controllers;
end
if nargout > 1
varargout{2} = model;
end
if nargout > 2
varargout{3} = view;
end
end
function closeGUI(~, ~, model, view, controllers)
if isfield(view.masking, 'parent') && ishandle(view.masking.parent)
close(view.masking.parent);
delete(view.masking.parent);
end
if isfield(view.help, 'parent') && ishandle(view.help.parent)
close(view.help.parent);
delete(view.help.parent);
end
if isfield(view.calibration, 'BrillouinShiftView') && ishandle(view.calibration.BrillouinShiftView)
close(view.calibration.BrillouinShiftView);
delete(view.calibration.BrillouinShiftView);
end
controllers.data.closeFile();
model.log.write('=====================================================');
model.log.log('V/BrillouinEvaluation: Closed program.');
delete(view.figure);
end
function controllers = controller(model, view)
data = BE_Controller.Data(model, view);
extraction = BE_Controller.Extraction(model, view);
peakSelection = BE_Controller.PeakSelection(model, view);
calibration = BE_Controller.Calibration(model, view);
evaluation = BE_Controller.Evaluation(model, view);
help = BE_Controller.Help(model, view);
controllers = struct( ...
'data', data, ...
'extraction', extraction, ...
'calibration', calibration, ...
'peakSelection', peakSelection, ...
'evaluation', evaluation, ...
'help', help ...
);
end
function includePath(model)
fp = mfilename('fullpath');
[model.pp,~,~] = fileparts(fp);
addpath(model.pp);
end