Skip to content
Snippets Groups Projects
initializeArtoa4.m 1.94 KiB
Newer Older
function [] = initializeArtoa4()
%INITIALIZEARTOA4 Initializes variables required for artoa4 and creates the main window if required.
%   

global artoaDataInput artoaWorkspace artoaGui;

%% When the gui exists, focus it
if isfield(artoaGui, 'figures') && isfield(artoaGui.figures, 'main')
    figure(artoaGui.figures.main.Number);
    return
end

%% Initalize required variables
artoaDataInput = struct();
artoaWorkspace = struct();
artoaWorkspace.hideDeletedDataPoints = false;
artoaWorkspace.defaults = struct();
artoaWorkspace.defaults.trackingMethods = { ...
    'Least Square', ...
    'Exclusive Least Square', ...
    'Circular', ...
    'Hyperbolic' ...
};
artoaWorkspace.defaults.interpolationMethods = { ...
    'None', ...
    'Linear', ...
    'Spline', ...
    'Cubic' ...
};
artoaWorkspace.defaults.soundspeedMethods = { ...
    'Del Grosso', ...
    'Linear', ...
    'Soundsource file', ...
    'Levitus', ...
    'Manual' ...
};
artoaWorkspace.defaults.pickPointMarkerSize = 80;
artoaGui = struct();
artoaGui.figures = struct();
artoaGui.main = struct();
artoaGui.trackParameter = struct();
artoaWorkspace.editOffsets = struct();
artoaWorkspace.editOffsets.useOffsets = false;

%% Read ini file if existent and copy required variables to workspace
artoa.controller.file.loadArtoaIni();
%% Read soundsource file if existent
try
    soundsourceFilepath = artoaDataInput.ini.files.soundsourcefile;
    if ~isfile(soundsourceFilepath)
        error([mfilename ': ' soundsourceFilepath ' is not a file. Please check your artoa.ini!']);
    end
    artoaDataInput.soundsources = artoa.load.soundsources(soundsourceFilepath);
catch ex
    error([mfilename ': Reading soundsource file failed with the following message: ' ex.message]);
end
%% Open main gui
artoa.controller.main.open();
%% Update the settings defined by ini
if artoa.data.getMember(artoaDataInput.ini, {'view', 'hidedeleteddatapoints'}, false)
    artoa.controller.switchHideDeletedPoints();
end