Skip to content
Snippets Groups Projects
initializeArtoa4.m 2.23 KiB
Newer Older
  • Learn to ignore specific revisions
  • 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;
    
    artoaWorkspace.artoaVersion = ['4' artoa.versioning.getVersionString(true)];
    
    
    artoaWorkspace.plugins = struct();
    artoaWorkspace.plugins.tracking = struct();
    
    
    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
    
    %% Initialize all plugins
    artoa.plugins.initialize();
    
    
    %% Open main gui
    artoa.controller.main.open();
    
    %% Move main window to the center of the screen
    movegui(artoaGui.figures.main, 'center');
    
    
    %% Update the settings defined by ini
    if artoa.data.getMember(artoaDataInput.ini, {'view', 'hidedeleteddatapoints'}, false)
        artoa.controller.switchHideDeletedPoints();
    end