timeOfArrival.m 9.90 KiB
function [] = timeOfArrival()
%TIMEOFARRIVAL Defines the ARTOA4 edit time of arrival window.
global artoaGui artoaWorkspace;
%% Initialize required variables
windowTitle = [ 'ARTOA4 - Float ' num2str(artoaWorkspace.float.floatname) ' - Time of arrival' ];
%% Initialize time of arrival gui
artoaGui.figures.editTimeOfArrival = figure( ...
'Name', windowTitle, ...
'NumberTitle', 'off' ...
);
addToolbarExplorationButtons(artoaGui.figures.editTimeOfArrival);
artoaGui.editTimeOfArrival = struct();
set( ...
artoaGui.figures.editTimeOfArrival, ...
'CloseRequestFcn', ...
@artoa.controller.edit.timeOfArrival.close, ...
'Units', 'normalized' ...
);
%% Setup axes
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival = axes(artoaGui.figures.editTimeOfArrival);
% set colormap
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.CLim = [0, 255];
cmap = flipud(gray(300));
colormap(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, cmap(1:256, :));
grid on;
% set background and axes font color
set(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'Color', [1 1 1], 'XColor', 'blue', 'YColor', 'blue');
% set plot title
titleVal = [ ...
'Project: ' artoaWorkspace.float.projectname ...
' FloatId: ' num2str(artoaWorkspace.float.floatname) ...
' Cycle: ' num2str(artoaWorkspace.float.cycle(1)) ...
' - Time of arrival' ...
];
titleHandle = title(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, titleVal, 'FontSize', 10);
set(titleHandle, 'Color', 'blue');
% set x and y label
xlabel(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'Message Date', 'FontSize', 10);
ylabel(artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, 'Time of arrival rel. to window start time', 'FontSize', 10);
% setup listener to update the deployment and recover text of soundsources
addlistener( ...
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, ...
'YLim', ...
'PostSet', ...
@artoa.controller.edit.timeOfArrival.updateSoundsourceDeploymentRecoverText ...
);
%% Generate Plot
artoa.controller.edit.timeOfArrival.plot();
%% Generate Controls
left = .85;
width = .14;
%% Selection frame
artoaGui.editTimeOfArrival.frameControlsSelect = uipanel( ...
'Title', 'Select', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [left .7 width .2] ...
);
artoaGui.editTimeOfArrival.buttonPickPolygon = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSelect, ...
'String', 'Polygon', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .7 .69 .2], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.pickPolygon();' ...
);
artoaGui.editTimeOfArrival.buttonPickPoint = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSelect, ...
'String', 'Point', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .4 .69 .2], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.pickPoint();' ...
);
artoaGui.editTimeOfArrival.buttonDropSelection = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSelect, ...
'String', 'Drop', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .1 .69 .2], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.dropSelection();' ...
);
%% Sound source frame
artoaGui.editTimeOfArrival.frameControlsSoundSource = uipanel( ...
'Title', 'Soundsource', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [left .35 width .3] ...
);
artoaGui.editTimeOfArrival.buttonApply = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSoundSource, ...
'String', 'Apply', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .8 .69 .15], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.applySoundSourceToSelectedPoints();' ...
);
artoaGui.editTimeOfArrival.buttonApplyAllVisible = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSoundSource, ...
'String', 'Apply All Visible', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .6 .69 .15], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.applySoundSourceToAllVisible();' ...
);
artoaGui.editTimeOfArrival.buttonDelete = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSoundSource, ...
'String', 'Withdraw', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .4 .69 .15], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.removeSoundSourceFromSelectedPoints();' ...
);
artoaGui.editTimeOfArrival.buttonWithdrawAllVisible = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsSoundSource, ...
'String', 'Withdraw All Visible', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .2 .69 .15], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.withdrawSoundSourceToAllVisible();' ...
);
%% Shift frame
artoaGui.editTimeOfArrival.frameControlsShift = uipanel( ...
'Title', 'Shift', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [left .1 width .2] ...
);
artoaGui.editTimeOfArrival.buttonShiftApply = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsShift, ...
'String', 'Shift selected', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .7 .69 .2], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.shiftToa();' ...
);
artoaGui.editTimeOfArrival.buttonShiftResetSelection = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsShift, ...
'String', 'Reset selected', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .45 .69 .2], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.resetShiftToaSelection();' ...
);
artoaGui.editTimeOfArrival.buttonShiftResetAll = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsShift, ...
'String', 'Reset all', ...
'Style', 'PushButton', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.156 .2 .69 .2], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.resetShiftToa();' ...
);
%% Duplicate applied TOA table
artoaGui.editTimeOfArrival.frameDuplicateAppliedToa = uipanel( ...
'Title', 'Duplicates', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [.01 .25 width .15] ...
);
columns = { ...
'Soundsource', 'Date', 'TOAs' ...
};
artoaGui.editTimeOfArrival.tableDuplicateAppliedToa = uitable( ...
artoaGui.editTimeOfArrival.frameDuplicateAppliedToa, ...
'Units', 'normalized', ...
'Position', [.1, .1, .8, .8], ...
'Data', cell(1, length(columns)), ...
'ColumnName', columns, ...
'ColumnEditable', false, ...
'CellSelectionCallback', @artoa.controller.edit.timeOfArrival.tableDuplicateToaSelection,...
'CellEditCallback', '', ...
'ColumnWidth', {60, 120, 120} ...
);
clear columns;
%% Sound source color legend frame
artoa.controller.edit.timeOfArrival.createSoundsourceColorsPanel();
%% TOA Histogram
artoaGui.editTimeOfArrival.frameToaHistogram = uipanel( ...
'Title', 'TOA histogram', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [.01 .45 width .15] ...
);
%% Colormap slider
artoaGui.editTimeOfArrival.frameControlsColormapSlider = uipanel( ...
'Title', 'Adjust colormap boundaries', ...
'Units', 'normalized', ...
'BackgroundColor', 'white', ...
'Position', [.01 .1 width .1] ...
);
artoaGui.editTimeOfArrival.textUpperBoundary = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsColormapSlider, ...
'String', 'Upper', ...
'Style', 'text', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.1 .6 .2 .2] ...
);
artoaGui.editTimeOfArrival.sliderUpperBoundary = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsColormapSlider, ...
'Style', 'slider', ...
'Units', 'normalized', ...
'Max', 255, ...
'Min', 0, ...
'Value', 255, ...
'SliderStep', [1/255, 10/255], ...
'Position', [.4 .6 .3 .2], ...
'Callback', 'artoa.controller.edit.timeOfArrival.updateUpperColormapBoundary();'...
);
artoaGui.editTimeOfArrival.inputUpperBoundary = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsColormapSlider, ...
'String', '255', ...
'Style', 'edit', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.8 .6 .1 .2], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.updateUpperColormapBoundary(true);' ...
);
artoaGui.editTimeOfArrival.textLowerBoundary = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsColormapSlider, ...
'String', 'Lower', ...
'Style', 'text', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.1 .2 .2 .2] ...
);
artoaGui.editTimeOfArrival.sliderLowerBoundary = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsColormapSlider, ...
'Style', 'slider', ...
'Units', 'normalized', ...
'Max', 255, ...
'Min', 0, ...
'Value', 0, ...
'SliderStep', [1/255, 10/255], ...
'Position', [.4 .2 .3 .2], ...
'Callback', 'artoa.controller.edit.timeOfArrival.updateLowerColormapBoundary();'...
);
artoaGui.editTimeOfArrival.inputLowerBoundary = uicontrol( ...
'Parent', artoaGui.editTimeOfArrival.frameControlsColormapSlider, ...
'String', '0', ...
'Style', 'edit', ...
'FontSize', 8, ...
'Units', 'normalized', ...
'Position', [.8 .2 .1 .2], ...
'CallBack', 'artoa.controller.edit.timeOfArrival.updateLowerColormapBoundary(true);' ...
);
%% Update histogram
artoa.controller.edit.timeOfArrival.plotToaHistogram();
%% Enable zoom
zoom on;
end