function varargout = main(varargin)
% MAIN M-file for main.fig
% MAIN, by itself, creates a new MAIN or raises the existing
% singleton*.
%
% H = MAIN returns the handle to a new MAIN or the handle to
% the existing singleton*.
%
% MAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MAIN.M with the given input arguments.
%
% MAIN('Property','Value',...) creates a new MAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before main_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to main_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 main
% Last Modified by GUIDE v2.5 26-Jun-2022 10:35:54
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @main_OpeningFcn, ...
'gui_OutputFcn', @main_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 main is made visible.
function main_OpeningFcn(hObject, eventdata, handles, varargin)
global hds
global hpg hpt hps hpnn % graph handles, tree handles, start point handle, nodes numbers
global rr % to meorize r - nodes positions
% Choose default command line output for main
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
hds=handles;
set(hds.figure1,'MenuBar','figure','Toolbar','figure');
set(hds.axes1,'NextPlot','Add');
axis(hds.axes1,'equal');
% empty, no handles:
hpg=[];
hpt=[];
hps=[];
hpnn=[];
rr=[];
randomize_clb(true);
% UIWAIT makes main wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = main_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;
function N_Callback(hObject, eventdata, handles)
randomize_clb(true);
% --- Executes during object creation, after setting all properties.
function N_CreateFcn(hObject, eventdata, handles)
% hObject handle to N (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
function R_Callback(hObject, eventdata, handles)
randomize_clb(false);
% --- Executes during object creation, after setting all properties.
function R_CreateFcn(hObject, eventdata, handles)
% hObject handle to R (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
function a_Callback(hObject, eventdata, handles)
randomize_clb(true);
% --- Executes during object creation, after setting all properties.
function a_CreateFcn(hObject, eventdata, handles)
% hObject handle to a (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
function s_Callback(hObject, eventdata, handles)
randomize_clb(false);
% --- Executes during object creation, after setting all properties.
function s_CreateFcn(hObject, eventdata, handles)
% hObject handle to s (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 rnp.
function rnp_Callback(hObject, eventdata, handles)
randomize_clb(true);
% --- Executes on button press in sg.
function sg_Callback(hObject, eventdata, handles)
global hpg
if get(handles.sg,'value');
for c=1:length(hpg)
if ishandle(hpg(c))
set(hpg(c),'Visible','on');
end
end
else
for c=1:length(hpg)
if ishandle(hpg(c))
set(hpg(c),'Visible','off');
end
end
end
% --- Executes on button press in st.
function st_Callback(hObject, eventdata, handles)
global hpt
if get(handles.st,'value');
for c=1:length(hpt)
if ishandle(hpt(c))
set(hpt(c),'Visible','on');
end
end
else
for c=1:length(hpt)
if ishandle(hpt(c))
set(hpt(c),'Visible','off');
end
end
end
% --- Executes on button press in snn.
function snn_Callback(hObject, eventdata, handles)
global hpnn
if get(handles.snn,'value');
for c=1:length(hpnn)
if ishandle(hpnn(c))
set(hpnn(c),'Visible','on');
end
end
else
for c=1:length(hpnn)
if ishandle(hpnn(c))
set(hpnn(c),'Visible','off');
end
end
end