Skip to content

Commit

Permalink
Added option menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Frudawski committed Mar 22, 2024
1 parent 21a4f45 commit 7d9bcf6
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 44 deletions.
Binary file added LUMOS functions/LUMOS_options.fig
Binary file not shown.
192 changes: 192 additions & 0 deletions LUMOS functions/LUMOS_options.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
function varargout = LUMOS_options(varargin)
% LUMOS_OPTIONS MATLAB code for LUMOS_options.fig
% LUMOS_OPTIONS, by itself, creates a new LUMOS_OPTIONS or raises the existing
% singleton*.
%
% H = LUMOS_OPTIONS returns the handle to a new LUMOS_OPTIONS or the handle to
% the existing singleton*.
%
% LUMOS_OPTIONS('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LUMOS_OPTIONS.M with the given input arguments.
%
% LUMOS_OPTIONS('Property','Value',...) creates a new LUMOS_OPTIONS or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before LUMOS_options_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to LUMOS_options_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help LUMOS_options

% Last Modified by GUIDE v2.5 16-Mar-2024 09:06:45

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @LUMOS_options_OpeningFcn, ...
'gui_OutputFcn', @LUMOS_options_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before LUMOS_options is made visible.
function LUMOS_options_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to LUMOS_options (see VARARGIN)

% Choose default command line output for LUMOS_options
handles.output = hObject;

try
% get LUMOS handle
handles.Lumos = findall(0,'tag','SpecSimulation');
catch me
catcher(me)
end

try
settings = getappdata(handles.Lumos,'settings');
% objects checkbox
hObject.Children.Children(2).Value = settings.objects;
% mesh optimization
hObject.Children.Children(7).Value = settings.mesh;
% luminaire consideration
hObject.Children.Children(6).Value = settings.luminaires;
% subgrid max number per dimension
hObject.Children.Children(3).String = num2str(settings.subgrid);
% object reflecion consideration
hObject.Children.Children(1).Value = settings.object_reflection;
catch

end

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes LUMOS_options wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = LUMOS_options_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in checkbox_mesh.
function checkbox_mesh_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_mesh (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox_mesh


% --- Executes on button press in checkbox_luminaires.
function checkbox_luminaires_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_luminaires (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox_luminaires


% --- Executes on button press in Apply_button.
function Apply_button_Callback(hObject, eventdata, handles)
% hObject handle to Apply_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% get settings
settings.objects = hObject.Parent.Children(2).Value;
settings.mesh = hObject.Parent.Children(7).Value;
settings.luminaires = hObject.Parent.Children(6).Value;
settings.subgrid = str2double(hObject.Parent.Children(3).String);
settings.object_reflection = hObject.Parent.Children(1).Value;

% save settings
setappdata(handles.Lumos,'settings',settings);

% close window
close(hObject.Parent.Parent)


% --- Executes on button press in Discard_button.
function Discard_button_Callback(hObject, eventdata, handles)
% hObject handle to Discard_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% close window without saving
close(hObject.Parent.Parent)


function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in checkbox_objects.
function checkbox_objects_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_objects (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox_objects


% --- Executes on button press in object_reflection.
function object_reflection_Callback(hObject, eventdata, handles)
% hObject handle to object_reflection (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of object_reflection


function checkbox_objects_CreateFcn(hObject, eventdata, handles)
% hObject handle to object_reflection (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of object_reflection
Binary file modified LUMOS functions/objects_un_group.fig
Binary file not shown.
Binary file modified LUMOS functions/spec_simulation.fig
Binary file not shown.
46 changes: 34 additions & 12 deletions LUMOS functions/spec_simulation.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

% Edit the above text to modify the response to help spec_simulation

% Last Modified by GUIDE v2.5 15-Mar-2023 09:39:45
% Last Modified by GUIDE v2.5 03-Mar-2024 08:11:14

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
Expand Down Expand Up @@ -1213,8 +1213,8 @@ function simulation_table_edit(hObject, eventdata, handles)
room{r}.result = [];
case 5
room{r}.enable = data{r,c};
case 6
room{r}.MeshOptimization = data{r,c};
%case 6
% room{r}.MeshOptimization = data{r,c};
otherwise
end

Expand Down Expand Up @@ -3657,6 +3657,7 @@ function uipushtool2_ClickedCallback(hObject, eventdata, handles)
data.results = getappdata(handles.Lumos,'result');
data.ldt = getappdata(handles.Lumos,'ldt');
data.spectra = getappdata(handles.Lumos,'spectra');
data.settings = getappdata(handles.Lumos,'settings');
% save data
save([path file],'data');
handles.save_file = [path file];
Expand Down Expand Up @@ -3712,10 +3713,15 @@ function uipushtool3_ClickedCallback(hObject, eventdata, handles)
setappdata(handles.Lumos,'spectra',[]);
end
try
setappdata(handles.Lumos,'result',data.results);
setappdata(handles.Lumos,'result',data.results);
catch
setappdata(handles.Lumos,'result',[]);
end
try
setappdata(handles.Lumos,'settings',data.settings);
catch
setappdata(handles.Lumos,'settings',[]);
end

for l = 1:max(size(data.room))
list{l,1} = data.room{l}.name;
Expand Down Expand Up @@ -5878,8 +5884,9 @@ function uitoggletool17_ClickedCallback(hObject, eventdata, handles)
% save simulation table mode
table = getappdata(handles.Lumos,'table');
table{handles.data.room}.table_mode = 'simulation';
settings = getappdata(handles.Lumos,'settings');

% start simulation
% START SIMULATION
tic
axes(handles.topview)
result = [];
Expand Down Expand Up @@ -5977,12 +5984,12 @@ function uitoggletool17_ClickedCallback(hObject, eventdata, handles)
% actual radiosity simulation
if (s~= 0 || ~isempty(luminaires))

try
MeshOptimization = room{r}.MeshOptimization;
catch
MeshOptimization = 1;
end
[calculation,ground,measurements] = surfaces_radiosity_calculation(surfaces,skydata,luminaires,ground,information,measurements,MeshOptimization);
%try
% MeshOptimization = room{r}.MeshOptimization;
%catch
% MeshOptimization = 1;
%end
[calculation,ground,measurements] = surfaces_radiosity_calculation(surfaces,skydata,luminaires,ground,information,measurements,settings);

% save calculation
result{r}.sky{s+1} = calculation;
Expand Down Expand Up @@ -6822,6 +6829,7 @@ function simulation_table(hObject, eventdata, handles)
catch
list{5,r} = 0;
end
%{
try
list{6,r} = room{r}.MeshOptimization;
if isempty(list{6,r})
Expand All @@ -6830,12 +6838,13 @@ function simulation_table(hObject, eventdata, handles)
catch
list{6,r} = 1;
end
%}
check = 0;

end

rows = [];
rows = {'dens','refl','','h','sim','opt'};
rows = {'dens','refl','','h','sim'}; % ,'opt'


columns = [];
Expand Down Expand Up @@ -11678,3 +11687,16 @@ function uipushtool25_ClickedCallback(hObject, eventdata, handles)
return
end
save([path file],'hyperspec');


% --------------------------------------------------------------------
function Options_ClickedCallback(hObject, eventdata, handles)
% hObject handle to Options (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

try
LUMOS_options(hObject, eventdata, handles, 1)
catch
end

Loading

0 comments on commit 7d9bcf6

Please sign in to comment.