Newer
Older
function [ ] = main(pCallbacks, pTrackingMethods, pInterpolationMethods, pSoundspeedMethods)
%MAIN Contains the definition of main ARTOA4 gui.
global artoaGui;
%% Initialize callbacks
availableCallbacks = { ...
'CloseRequestFcn', ...
'WindowButtonDownFcn', ...
'loadRfb', ...
'loadInterim', ...
'loadSoundsourceFile', ...
'saveInterim', ...
'saveOptimumTables', ...
'loadArtoaIni', ...
'quit', ...
'openEditTemperature', ...
'openEditPressure', ...
'openEditTimeOfArrival', ...
'openEditOffsets', ...
'openTrackParameter', ...
'openTrackTrajectoryOutput', ...
'switchHideDeletedDataPoints', ...
'checkboxDopplerCorrection', ... % FIRST ITEM TRACK PARAMETER CALLBACKS
'comboboxInterpolationMethod', ...
'comboboxSoundspeedMethod', ...
'checkboxPlotResiduals', ...
'inputOutputInterpolationInterval', ...
'inputGapSize', ...
'tableSoundSourceCombinationsSelection', ...
'tableSoundSourceCombinationsEdit', ...
'buttonTrack', ...
'buttonAddCombination', ...
'buttonAddCombinationAbove', ...
'buttonDuplicateCombination', ...
'buttonRemoveCombination', ...
'buttonResetAllCombinations', ...
'tableSoundsourceOffsetsSelect', ... % FIRST ITEM OF OFFSETS
'tableSoundsourceOffsetsEdit', ...
'tableSoundspeedEdit', ...
'buttonCalculateOffsets', ...
'checkboxUseOffsets', ...
'buttonCopyFromOptimum', ...
'buttonCopyFromMeasured', ...
'buttonUndoLastCopy' ...
};
for i = 1:length(availableCallbacks) % check if a callback is undefined
if ~isfield(pCallbacks, availableCallbacks{i})
pCallbacks.(availableCallbacks{i}) = @(~, ~) false;
end
end
%% Initialize main window
artoaGui.figures.main = figure( ...
'Name', 'ARTOA 4', ...
'NumberTitle', 'off', ...
'Color', 'white', ...
'MenuBar', 'none', ...
leprob001
committed
'Units', 'characters' ...
%% Geometry variables
heightWindow = 60; % [characters]
widthWindow = 129; % [characters]
heightFrame = .4;
widthFrame = .95;
spacer = .025;
%% Set window height
artoaGui.figures.main.Position(3) = widthWindow;
artoaGui.figures.main.Position(4) = heightWindow;
%% Set extraordinary callbacks
set(artoaGui.figures.main, 'CloseRequestFcn', pCallbacks.CloseRequestFcn);
set(artoaGui.figures.main, 'WindowButtonDownFcn', pCallbacks.WindowButtonDownFcn);
%% Initialize file menu
artoaGui.main.menus = struct();
artoaGui.main.menus.file = uimenu(artoaGui.figures.main, 'Label', 'File');
% LOAD
loadHandle = uimenu(artoaGui.main.menus.file, 'Label', 'Load');
uimenu( ...
loadHandle, ...
'Label', 'ARGOS file', ...%'Callback', 'artoa.controller.loadArgos' ...
'Enable', 'off' ...
);
uimenu( ...
loadHandle, ...
'Label', 'RFB file', ...
'Callback', pCallbacks.loadRfb ...
);
uimenu( ...
loadHandle, ...
leprob001
committed
'Label', 'Interim file', ...
'Callback', pCallbacks.loadInterim ...
leprob001
committed
);
uimenu( ...
loadHandle, ...
'Label', 'SoSo file', ...
'Callback', pCallbacks.loadSoundsourceFile ...
artoaGui.main.menus.fileSave = uimenu( ...
artoaGui.main.menus.file, ...
'Label', 'Save', ...
'Enable', 'off' ...
);
artoaGui.main.menus.fileSave, ...
'Label', 'RFC file', ...
'Callback', pCallbacks.saveRfc ...
leprob001
committed
uimenu( ...
artoaGui.main.menus.fileSave, ...
leprob001
committed
'Label', 'Interim file', ...
'Callback', pCallbacks.saveInterim ...
leprob001
committed
);
uimenu( ...
artoaGui.main.menus.fileSave, ...
'Label', 'Optimum tables', ...
'Callback', pCallbacks.saveOptimumTables ...
);
% CONVERT
artoaGui.main.menus.fileConvert = uimenu( ...
artoaGui.main.menus.file, ...
'Label', 'Convert', ...
'Enable', 'on' ...
);
uimenu( ...
artoaGui.main.menus.fileConvert, ...
'Label', '*.profile to .rfb', ...
'Callback', pCallbacks.convertProfilesToRfb ...
);
% RELOAD ARTOA INI
artoaGui.main.menus.fileReloadArtoaIni = uimenu( ...
artoaGui.main.menus.file, ...
'Label', 'Reload artoa.ini', ...
'Callback', pCallbacks.loadArtoaIni ...
% QUIT
artoaGui.main.menus.fileQuit = uimenu( ...
artoaGui.main.menus.file, ...
'Label', 'Quit', ...
'Callback', pCallbacks.quit ...
);
%% Initialize edit menu
artoaGui.main.menus.edit = uimenu( ...
artoaGui.figures.main, ...
'Label', 'Edit', ...
'Enable', 'off' ...
);
% TEMPERATURE
artoaGui.main.menus.editTemperature = uimenu( ...
artoaGui.main.menus.edit, ...
'Label', 'Temperature', ...
'Callback', pCallbacks.openEditTemperature ...
);
% PRESSURE
leprob001
committed
artoaGui.main.menus.editPressure = uimenu( ...
artoaGui.main.menus.edit, ...
'Label', 'Pressure', ...
'Callback', pCallbacks.openEditPressure ...
leprob001
committed
);
% TIME OF ARRIVAL
artoaGui.main.menus.editTimeOfArrival = uimenu( ...
artoaGui.main.menus.edit, ...
'Label', 'Time of arrival', ...
'Callback', pCallbacks.openEditTimeOfArrival, ...
%% Initialize track menu
artoaGui.main.menus.track = uimenu( ...
artoaGui.figures.main, ...
'Label', 'Track', ...
'Enable', 'off' ...
);
% TRAJECTORY OUTPUT
artoaGui.main.menus.trajectoryOutput = uimenu( ...
artoaGui.main.menus.track, ...
'Label', 'Trajectory output', ...
'Callback', pCallbacks.openTrackTrajectoryOutput ...
%% Initialize view menu
artoaGui.main.menus.view = uimenu( ...
artoaGui.figures.main, ...
'Label', 'View', ...
'Enable', 'on' ...
);
artoaGui.main.menus.viewHideDeletedDataPoints = uimenu( ...
artoaGui.main.menus.view, ...
'Label', 'Hide deleted data points', ...
'Callback', pCallbacks.switchHideDeletedDataPoints ...
%% Version info
gitInfo = getGitInfo();
artoaGui.main.textVersionInfo = uicontrol( ...
'Parent', artoaGui.figures.main, ...
'String', artoa.versioning.getVersionString(), ...
'Style', 'text', ...
'FontSize', 10, ...
'Units', 'characters', ...
'Background', [1 1 1], ...
'Position', [(widthWindow - 20) 1 20 1] ...
);
%% Float loaded status
artoaGui.main.textLoadedFloat = uicontrol( ...
'Parent', artoaGui.figures.main, ...
'String', 'No float loaded.', ...
'Style', 'text', ...
'FontSize', 10, ...
'Units', 'characters', ...
'HorizontalAlignment', 'left', ...
'Background', [1 1 1], ...
'Position', [3 1 80 1] ...
);
%% Track parameter
artoaGui.trackParameter.frameTrackingParameter = uipanel( ...
'Parent', artoaGui.figures.main, ...
'Title', 'Tracking Parameter', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [ ...
spacer ...
widthFrame ...
] ...
);
% default geometry values for track parameter
left = .025;
buttonHeight = .3;
artoaGui.trackParameter.frameOptions = uipanel( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
'Title', 'Corrections', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [left .75 width .20] ...
);
artoaGui.trackParameter.checkboxDopplerCorrection = uicontrol( ...
'Parent', artoaGui.trackParameter.frameOptions, ...
'String', 'Apply Doppler Correction', ...
'Style', 'checkbox', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .5 .9 .3], ...
'Value', 1, ...
'CallBack', pCallbacks.checkboxDopplerCorrection ...
);
artoaGui.trackParameter.checkboxBackwardTracking = uicontrol( ...
'Parent', artoaGui.trackParameter.frameOptions, ...
'String', 'Enable backward tracking', ...
'Style', 'checkbox', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .1 .9 .3], ...
'Value', 0, ...
'CallBack', pCallbacks.checkboxBackwardTracking ...
);
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
% Interpolation method frame
artoaGui.trackParameter.frameInterpolationMethod = uipanel( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
'Title', 'Input Interpolation Method', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [(2*left + width) .75 width .20] ...
);
artoaGui.trackParameter.comboboxInterpolationMethod = uicontrol( ...
'Parent', artoaGui.trackParameter.frameInterpolationMethod, ...
'String', pInterpolationMethods, ...
'Style', 'popupmenu', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .5 .9 .4], ...
'CallBack', pCallbacks.comboboxInterpolationMethod ...
);
artoaGui.trackParameter.textGapSize = uicontrol( ...
'Parent', artoaGui.trackParameter.frameInterpolationMethod, ...
'String', 'Gap Size [days]', ...
'Style', 'text', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .1 .5 .3], ...
'CallBack', '' ...
);
artoaGui.trackParameter.inputGapSize = uicontrol( ...
'Parent', artoaGui.trackParameter.frameInterpolationMethod, ...
'String', '10', ...
'Style', 'edit', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(.7-left) .1 .3 .3], ...
'CallBack', pCallbacks.inputGapSize ...
);
% Soundspeed method frame
artoaGui.trackParameter.frameSoundspeedMethod = uipanel( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
'Title', 'Sound Speed Method', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [(3*left + 2*width) .75 width .20] ...
);
artoaGui.trackParameter.comboboxSoundspeedMethod = uicontrol( ...
'Parent', artoaGui.trackParameter.frameSoundspeedMethod, ...
'String', pSoundspeedMethods, ...
'Style', 'popupmenu', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .5 .9 .4], ...
'CallBack', pCallbacks.comboboxSoundspeedMethod ...
);
artoaGui.trackParameter.checkboxPlotResiduals = uicontrol( ...
'Parent', artoaGui.trackParameter.frameSoundspeedMethod, ...
'String', 'Plot Residuals', ...
'Enable', 'off', ...
'Style', 'checkbox', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .1 .9 .3], ...
'CallBack', pCallbacks.checkboxPlotResiduals ...
);
% Output interpolation interval
artoaGui.trackParameter.textOutputInterpolationInterval = uicontrol( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
'String', 'Output Interpolation Interval [h]', ...
'Style', 'text', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(4*left + 3*width) .75 (.5*width) .20], ...
'CallBack', '' ...
);
artoaGui.trackParameter.inputOutputInterpolationInterval = uicontrol( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
'String', '24', ...
'Style', 'edit', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(5*left + 3*width) .775 (.25*width) .05], ...
'CallBack', pCallbacks.inputOutputInterpolationInterval ...
);
% Sound source combination table
columns = { ...
'Begin', ...
'End', ...
'Sound Sources', ...
'Reference Position', ...
'Sound Speed', 'Sound Speed', 'Sound Speed', ...
'Tracking Method' ...
columnFormat = cell(1, length(columns));
columnFormat{end} = pTrackingMethods;
artoaGui.trackParameter.tableSoundSourceCombinations = uitable( ...
artoaGui.trackParameter.frameTrackingParameter, ...
'Units', 'normalized', ...
'Position', [left, 0.25, (5*left + 3.25*width), 0.45], ...
'Data', cell(1, length(columns)), ...
'ColumnName', columns, ...
'ColumnEditable', true, ...
'ColumnFormat', (columnFormat), ...
'CellSelectionCallback', pCallbacks.tableSoundSourceCombinationsSelection,... %@(app,event) disp(num2str(event.Indices)) ...
'CellEditCallback', pCallbacks.tableSoundSourceCombinationsEdit ...
);
clear columns columnFormat;
% Track buttons frame
artoaGui.trackParameter.frameTrackButtons = uipanel( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
'Title', 'Tracking controls', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [(1-left-.8*width) .025 .75*width .1] ...
);
artoaGui.trackParameter.buttonTrack = uicontrol( ...
'Parent', artoaGui.trackParameter.frameTrackButtons, ...
'String', 'Track', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .25 (1-2*left) 2.5*buttonHeight], ...
'CallBack', pCallbacks.buttonTrack ...
);
% Combination buttons frame
artoaGui.trackParameter.frameCombinationButtons = uipanel( ...
'Parent', artoaGui.trackParameter.frameTrackingParameter, ...
'Title', 'Combination controls', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [left .125 (5*left + 3.25*width) .125] ...
artoaGui.trackParameter.buttonAddCombination = uicontrol( ...
'Parent', artoaGui.trackParameter.frameCombinationButtons, ...
'String', 'Add', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .1 factor*width 2.5*buttonHeight], ...
'CallBack', pCallbacks.buttonAddCombination ...
);
artoaGui.trackParameter.buttonAddAboveCombination = uicontrol( ...
'Parent', artoaGui.trackParameter.frameCombinationButtons, ...
'String', 'Add above selected', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(2*left + factor*width) .1 factor*width 2.5*buttonHeight], ...
'CallBack', pCallbacks.buttonAddCombinationAbove ...
);
artoaGui.trackParameter.buttonDuplicateCombination = uicontrol( ...
'Parent', artoaGui.trackParameter.frameCombinationButtons, ...
'String', 'Duplicate selected', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(3*left + 2*factor*width) .1 factor*width 2.5*buttonHeight], ...
'CallBack', pCallbacks.buttonDuplicateCombination ...
);
artoaGui.trackParameter.buttonRemoveCombination = uicontrol( ...
'Parent', artoaGui.trackParameter.frameCombinationButtons, ...
'String', 'Remove selected', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(4*left + 3*factor*width) .1 factor*width 2.5*buttonHeight], ...
'CallBack', pCallbacks.buttonRemoveCombination ...
);
artoaGui.trackParameter.buttonResetAllCombinations = uicontrol( ...
'Parent', artoaGui.trackParameter.frameCombinationButtons, ...
'String', 'Reset All', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(1 - left - factor*width) .1 factor*width 2.5*buttonHeight], ...
'CallBack', pCallbacks.buttonResetAllCombinations ...
);
%% Offset table
artoaGui.editOffsets.frameOffsets = uipanel( ...
'Parent', artoaGui.figures.main, ...
'Title', 'Offsets', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [ ...
spacer ...
(1 - 2 * spacer - heightFrame - heightTrackingFrame) ...
widthFrame ...
heightFrame ...
] ...
);
% setup geometry variables
left = 0.03;
fullwidth = 1 - (2 * left);
% Initialize offset table
artoaGui.editOffsets.tableSoundsourceOffsets = uitable( ...
artoaGui.editOffsets.frameOffsets, ...
'Units', 'normalized', ...
'Position', [left, 0.5, fullwidth, 0.5], ...
'ColumnEditable', true, ...
'CellSelectionCallback', pCallbacks.tableSoundsourceOffsetsSelect, ...
'CellEditCallback', pCallbacks.tableSoundsourceOffsetsEdit ...
);
% Initialize soundspeed table
artoaGui.editOffsets.tableSoundspeed = uitable( ...
artoaGui.editOffsets.frameOffsets, ...
'Units', 'normalized', ...
'Position', [left, 0.375, fullwidth, 0.125], ...
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
'ColumnEditable', true, ...'CellSelectionCallback', pCallbacks.tableSoundsourceOffsetsSelect, ...
'CellEditCallback', pCallbacks.tableSoundspeedEdit ...
);
% Optimum offsets frame
artoaGui.editOffsets.frameOptimumOffsets = uipanel( ...
'Parent', artoaGui.editOffsets.frameOffsets, ...
'Title', 'Offset controls', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [left .025 fullwidth .3] ...
);
% Setup calculate offsets button
artoaGui.editOffsets.buttonCalculateOffsets = uicontrol( ...
'Parent', artoaGui.editOffsets.frameOptimumOffsets, ...
'String', 'Calculate offsets', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .25 fullwidth/2 .2], ...
'CallBack', pCallbacks.buttonCalculateOffsets ...
);
artoaGui.editOffsets.checkboxUseOffsets = uicontrol( ...
'Parent', artoaGui.editOffsets.frameOptimumOffsets, ...
'String', 'Use offsets', ...
'Style', 'checkbox', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [left .75 fullwidth/2 .2], ...
'CallBack', pCallbacks.checkboxUseOffsets ...
);
artoaGui.editOffsets.buttonCopyFromMeasured = uicontrol( ...
'Parent', artoaGui.editOffsets.frameOptimumOffsets, ...
'String', 'Copy Measured to Applied', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(1.5*left + fullwidth/2) .725 fullwidth/2 .2], ...
'CallBack', pCallbacks.buttonCopyFromMeasured ...
);
artoaGui.editOffsets.buttonCopyFromOptimum = uicontrol( ...
'Parent', artoaGui.editOffsets.frameOptimumOffsets, ...
'String', 'Copy Optimum to Applied', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(1.5*left + fullwidth/2) .5 fullwidth/2 .2], ...
'CallBack', pCallbacks.buttonCopyFromOptimum ...
);
artoaGui.editOffsets.buttonAppliedToNan = uicontrol( ...
'Parent', artoaGui.editOffsets.frameOptimumOffsets, ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(1.5*left + fullwidth/2) .275 fullwidth/2 .2], ...
'CallBack', pCallbacks.buttonAppliedToNan ...
);
artoaGui.editOffsets.buttonUndoLastCopy = uicontrol( ...
'Parent', artoaGui.editOffsets.frameOptimumOffsets, ...
'String', 'Undo last copy', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [(1.5*left + fullwidth/2) .05 fullwidth/2 .2], ...
'CallBack', pCallbacks.buttonUndoLastCopy ...
);