This repository has been archived by the owner on Jul 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BrillouinAcquisition.m
57 lines (46 loc) · 1.7 KB
/
BrillouinAcquisition.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
function BrillouinAcquisition
%% MAINCONTROLLER MainController
% controller knows about model and view
model = BA_Model.Model(); % model is independent
includePath(model);
sharedFunctions(model);
view = BA_View.Tabs(model); % view has a reference of the model
controllers = controller(model, view);
set(view.figure, 'CloseRequestFcn', {@closeGUI, model, controllers});
end
function closeGUI(~, ~, model, controllers)
controllers.configuration.disconnect(model);
controllers.configuration.disconnectStage(model);
delete(gcf);
end
function controllers = controller(model, view)
configuration = BA_Controller.Configuration(model, view);
calibration = BA_Controller.Calibration(model, view);
acquisition = BA_Controller.Acquisition(model, view);
controllers = struct( ...
'configuration', configuration, ...
'calibration', calibration, ...
'acquisition', acquisition ...
);
end
function includePath(model)
fp = mfilename('fullpath');
[model.pp,~,~] = fileparts(fp);
addpath(model.pp);
end
function sharedFunctions(model)
model.sharedFunctions.iconString = @iconString;
end
function str = iconString(filepath)
iconFile = urlencode(fullfile(filepath));
iconUrl1 = strrep(['file:/' iconFile],'\','/');
scale = getScalingValue();
width = scale*20;
height = scale*20;
str = ['<html><img src="' iconUrl1 '" height="' sprintf('%1.0f', height) '" width="' sprintf('%1.0f', width) '"/></html>'];
end
function scale = getScalingValue()
screenSize = get(0,'ScreenSize');
jScreenSize = java.awt.Toolkit.getDefaultToolkit.getScreenSize;
scale = jScreenSize.width/screenSize(3);
end