diff --git a/lib/+artoa/+controller/+edit/+pressure/applyStatusToAllPointsExceptDeleted.m b/lib/+artoa/+controller/+edit/+pressure/applyStatusToAllPointsExceptDeleted.m new file mode 100644 index 0000000000000000000000000000000000000000..e41a86a7a6082376ba1950a3a1962d1afec0efcb --- /dev/null +++ b/lib/+artoa/+controller/+edit/+pressure/applyStatusToAllPointsExceptDeleted.m @@ -0,0 +1,24 @@ +function [] = applyStatusToAllPointsExceptDeleted(pStatus) +%APPLYSTATUSTOALLPOINTSEXCEPTDELETED Selects all points that are not deleted. +% Applies status 1 to all points that are not deleted. +% +% Parameters: +% pStatusCode (int) The status code that will be applied to the +% selected data. + +global artoaWorkspace; + +%% Set selection +artoaWorkspace.editPressure.selectedPoints = (artoaWorkspace.statusPressure ~= 2); + +%% Set status +artoaWorkspace.statusPressure(artoaWorkspace.editPressure.selectedPoints) = pStatus; + +%% Update gui +artoa.controller.edit.pressure.plot(); + +%% Remove the selected points from workspace +artoaWorkspace.editPressure = rmfield(artoaWorkspace.editPressure, 'selectedPoints'); + +end + diff --git a/lib/+artoa/+controller/+edit/+pressure/applyStatusToSelectedPoints.m b/lib/+artoa/+controller/+edit/+pressure/applyStatusToSelectedPoints.m new file mode 100644 index 0000000000000000000000000000000000000000..af9b81436d6473a6d362612dccba316de731872c --- /dev/null +++ b/lib/+artoa/+controller/+edit/+pressure/applyStatusToSelectedPoints.m @@ -0,0 +1,35 @@ +function [] = applyStatusToSelectedPoints(pStatusCode) +%APPLYSTATUSTOSELECTEDPOINTS Applies the given status code to the workspace variables. +% Applies the given status to the workspace variable. +% If pUpdateGui is set to false, the polygon variables are not being +% cleaned up. +% +% Parameters: +% pStatusCode (int) The status code that will be applied to the +% selected data. +% + +global artoaWorkspace artoaGui; + + +%% Check if selection exists + +if ~isfield(artoaWorkspace.editPressure, 'selectedPoints') ... + || isempty(artoaWorkspace.editPressure.selectedPoints) + warndlg('You need to select data by using the "Pick" button first!', 'No data selected'); + return; +end + +%% Set status +artoaWorkspace.statusPressure(artoaWorkspace.editPressure.selectedPoints) = pStatusCode; + +%% Update gui +artoa.controller.edit.pressure.plot(); +delete(artoaGui.editPressure.selectedPolygon); +artoaGui.editPressure = rmfield(artoaGui.editPressure, 'selectedPolygon'); + +%% Remove the polygon field from workspace +artoaWorkspace.editPressure = rmfield(artoaWorkspace.editPressure, 'selectedPoints'); + +end + diff --git a/lib/+artoa/+controller/+edit/+pressure/close.m b/lib/+artoa/+controller/+edit/+pressure/close.m new file mode 100644 index 0000000000000000000000000000000000000000..1a1fbc32c405e3314e0349f97dde4354015f66a9 --- /dev/null +++ b/lib/+artoa/+controller/+edit/+pressure/close.m @@ -0,0 +1,18 @@ +function [ ] = close() +%CLOSEREQ Cleans up all variables that are used by the editPressure GUI. +% Changes to the data is not being modified. + +global artoaGui artoaWorkspace; + +%% Close the figure + +delete(artoaGui.figures.editPressure); + +%% Clean up variables + +artoaGui = rmfield(artoaGui, 'editPressure'); +artoaGui.figures = rmfield(artoaGui.figures, 'editPressure'); +artoaWorkspace = rmfield(artoaWorkspace, 'editPressure'); + +end + diff --git a/lib/+artoa/+controller/+edit/+pressure/open.m b/lib/+artoa/+controller/+edit/+pressure/open.m new file mode 100644 index 0000000000000000000000000000000000000000..19758331c415b2643492e76c1fe2358cedb382a5 --- /dev/null +++ b/lib/+artoa/+controller/+edit/+pressure/open.m @@ -0,0 +1,22 @@ +function [] = open() +%OPENEDITTEMPERATURE Initializes the pressure editing gui. +% Detailed explanation goes here + +global artoaGui artoaWorkspace; + +%% Check if the gui is already opened + +if isfield(artoaGui.figures, 'editPressure') + figure(artoaGui.figures.editPressure); + return +end + + +%% Open the gui +artoa.gui.edit.pressure(); + +%% Create workspace variables +artoaWorkspace.editPressure = struct(); + +end + diff --git a/lib/+artoa/+controller/+edit/+pressure/pickPolygon.m b/lib/+artoa/+controller/+edit/+pressure/pickPolygon.m new file mode 100644 index 0000000000000000000000000000000000000000..ea3fcfa5e24f874b8bff032ef6c5e4c6f5c3a02e --- /dev/null +++ b/lib/+artoa/+controller/+edit/+pressure/pickPolygon.m @@ -0,0 +1,57 @@ +function [] = pickPolygon() +%PICKPOLYGON Lets the user pick a polygon in the plot. +% During selection, a line is being plotted that shows the selected +% points by the user. +% The polygon can be stopped by using the right mouse button. If +% finished, the selected points are being calculated and stored in the +% artoaWorkspace variable. + +global artoaGui artoaWorkspace; + +%% Select polygon by mouse +x = []; +y = []; + +% draw the line that will be extended on every click +artoaGui.editPressure.selectedPolygon = line( ... + NaN, NaN, 'Color', [1 1 1], 'LineStyle', '-' ... +); + +[dx, dy, button] = ginput(1); +while button == 1 + % get boundaries + bound = artoaGui.figures.editPressure.CurrentAxes.XLim; + dx = artoa.data.adjustToBoundaries(dx, bound(1), bound(2)); + bound = artoaGui.figures.editPressure.CurrentAxes.YLim; + dy = artoa.data.adjustToBoundaries(dy, bound(1), bound(2)); + % add values to array + x = [x; dx]; + y = [y; dy]; + if length(x) == 1 + continue; + end + % update the line + set(artoaGui.editPressure.selectedPolygon, 'XData', x, 'YData', y); + [dx, dy, button] = ginput(1); +end + +% close the poligon by adding the first value as the last one +if length(x) > 3 % a polygon can only be closed if there are more than two values + x = [x; x(1)]; + y = [y; y(1)]; +end +% update the line +set(artoaGui.editPressure.selectedPolygon, 'XData', x, 'YData', y); + +% store the selected points in the workspace for editing +artoaWorkspace.editPressure.selectedPoints = inpolygon( ... + artoaWorkspace.rafosDate, ... + artoaWorkspace.pressure, ... + x, ... + y ... +); + + + +end + diff --git a/lib/+artoa/+controller/+edit/+pressure/plot.m b/lib/+artoa/+controller/+edit/+pressure/plot.m new file mode 100644 index 0000000000000000000000000000000000000000..e95d0928dbbdab05f628acbc4829aabf5517a14f --- /dev/null +++ b/lib/+artoa/+controller/+edit/+pressure/plot.m @@ -0,0 +1,72 @@ +function [] = plot() +%PLOT Plots or updates the temperature points. +% If the plot already exists and is valid, the points only get updated. +% Otherwise the plot will be initialized +% + +global artoaGui artoaWorkspace; + +hold on + +%% Get all required values +% create color vector +c = repmat([1 1 0], length(artoaWorkspace.rafosDate), 1); +c(artoaWorkspace.statusPressure == 1, :) = ... + repmat([1 1 1], length(c(artoaWorkspace.statusPressure == 1, 1)), 1); +c(artoaWorkspace.statusPressure == 2, :) = ... + repmat([1 0 0], length(c(artoaWorkspace.statusPressure == 2, 1)), 1); + +if artoaWorkspace.showAllDataPoints + x = artoaWorkspace.rafosDate; + y = artoaWorkspace.pressure; +else + x = artoaWorkspace.rafosDate(artoaWorkspace.statusPressure ~= 2); + y = artoaWorkspace.pressure(artoaWorkspace.statusPressure ~= 2); + c = c(artoaWorkspace.statusPressure ~= 2, :); +end + +%% If the plot exists, just update the values + +if isfield(artoaGui.editPressure, 'scatterPressure') ... + && isvalid(artoaGui.editPressure.scatterPressure) + artoaGui.editPressure.scatterPressure.XData = x; + artoaGui.editPressure.scatterPressure.YData = y; + artoaGui.editPressure.scatterPressure.CData = c; + return +end + +% get all points that are not deleted +artoaGui.editPressure.scatterPressure = scatter( ... + x, ... + y, ... + [], ... + c, ... %'.', 'MarkerSize', 10 ... + 'filled' ... +); + + +grid on; + +% set background color +set(gca, 'Color', [.3 .3 .3], 'XColor', 'blue', 'YColor', 'blue'); + +% set plot title +titleVal = [ ... + 'Project: ' artoaWorkspace.float.projectname ... + ' FloatId: ' num2str(artoaWorkspace.float.floatname) ... + ' Cycle: ' num2str(artoaWorkspace.float.cycle(1)) ... + ' - Pressure' ... +]; +titleHandle = title(titleVal, 'FontSize', 10); +set(titleHandle, 'Color', 'blue'); + +% set x and y label +xlabel('Message Date', 'FontSize', 10); +ylabel('Pressure [dBar]', 'FontSize', 10); + +hold off + + + +end + diff --git a/lib/+artoa/+controller/+edit/+temperature/applyStatusToAllPointsExceptDeleted.m b/lib/+artoa/+controller/+edit/+temperature/applyStatusToAllPointsExceptDeleted.m new file mode 100644 index 0000000000000000000000000000000000000000..a79323a03a0814d7e03a54abfab609a3752a9adf --- /dev/null +++ b/lib/+artoa/+controller/+edit/+temperature/applyStatusToAllPointsExceptDeleted.m @@ -0,0 +1,24 @@ +function [] = applyStatusToAllPointsExceptDeleted(pStatus) +%APPLYSTATUSTOALLPOINTSEXCEPTDELETED Selects all points that are not deleted. +% Applies status 1 to all points that are not deleted. +% +% Parameters: +% pStatusCode (int) The status code that will be applied to the +% selected data. + +global artoaWorkspace; + +%% Set selection +artoaWorkspace.editTemperature.selectedPoints = (artoaWorkspace.statusTemperature ~= 2); + +%% Set status +artoaWorkspace.statusTemperature(artoaWorkspace.editTemperature.selectedPoints) = pStatus; + +%% Update gui +artoa.controller.edit.temperature.plot(); + +%% Remove the selected points from workspace +artoaWorkspace.editTemperature = rmfield(artoaWorkspace.editTemperature, 'selectedPoints'); + +end + diff --git a/lib/+artoa/+controller/+edit/+temperature/applyStatusToSelectedPoints.m b/lib/+artoa/+controller/+edit/+temperature/applyStatusToSelectedPoints.m new file mode 100644 index 0000000000000000000000000000000000000000..cf6ec6956c073e7bf4914604bab64ae9b2a5621b --- /dev/null +++ b/lib/+artoa/+controller/+edit/+temperature/applyStatusToSelectedPoints.m @@ -0,0 +1,35 @@ +function [] = applyStatusToSelectedPoints(pStatusCode) +%APPLYSTATUSTOSELECTEDPOINTS Applies the given status code to the workspace variables. +% Applies the given status to the workspace variable. +% If pUpdateGui is set to false, the polygon variables are not being +% cleaned up. +% +% Parameters: +% pStatusCode (int) The status code that will be applied to the +% selected data. +% + +global artoaWorkspace artoaGui; + + +%% Check if selection exists + +if ~isfield(artoaWorkspace.editTemperature, 'selectedPoints') ... + || isempty(artoaWorkspace.editTemperature.selectedPoints) + warndlg('You need to select data by using the "Pick" button first!', 'No data selected'); + return; +end + +%% Set status +artoaWorkspace.statusTemperature(artoaWorkspace.editTemperature.selectedPoints) = pStatusCode; + +%% Update gui +artoa.controller.edit.temperature.plot(); +delete(artoaGui.editTemperature.selectedPolygon); +artoaGui.editTemperature = rmfield(artoaGui.editTemperature, 'selectedPolygon'); + +%% Remove the polygon field from workspace +artoaWorkspace.editTemperature = rmfield(artoaWorkspace.editTemperature, 'selectedPoints'); + +end + diff --git a/lib/+artoa/+controller/+edit/+temperature/close.m b/lib/+artoa/+controller/+edit/+temperature/close.m index 43be1d58ec83260710490ae6bcf9979542c7a8ee..4758a2623a6c88d684b0f017265caaa4adfe393d 100644 --- a/lib/+artoa/+controller/+edit/+temperature/close.m +++ b/lib/+artoa/+controller/+edit/+temperature/close.m @@ -2,7 +2,7 @@ function [ ] = close() %CLOSEREQ Cleans up all variables that are used by the editTemperature GUI. % Changes to the data is not being modified. -global artoaGui; +global artoaGui artoaWorkspace; %% Close the figure @@ -12,6 +12,7 @@ delete(artoaGui.figures.editTemperature); artoaGui = rmfield(artoaGui, 'editTemperature'); artoaGui.figures = rmfield(artoaGui.figures, 'editTemperature'); +artoaWorkspace = rmfield(artoaWorkspace, 'editTemperature'); end diff --git a/lib/+artoa/+controller/+edit/+temperature/deleteSelectedPoints.m b/lib/+artoa/+controller/+edit/+temperature/deleteSelectedPoints.m deleted file mode 100644 index c7af608e507dac866ba6a29ce0c684b612c9db5e..0000000000000000000000000000000000000000 --- a/lib/+artoa/+controller/+edit/+temperature/deleteSelectedPoints.m +++ /dev/null @@ -1,38 +0,0 @@ -function [] = deleteSelectedPoints() -%DELETESELECTEDPOINTS Summary of this function goes here -% Detailed explanation goes here - -global artoaWorkspace; - -%% Check if selection exists - -if ~isfield(artoaWorkspace, 'selectedPolygon') || ~isvalid(artoaWorkspace.selectedPolygon) - return; -end - -%% Get polygon data -selectedPolygonX = artoaWorkspace.selectedPolygon.XData; -selectedPolygonY = artoaWorkspace.selectedPolygon.YData; - -if isempty(selectedPolygonX) || isempty(selectedPolygonY) - return; -end - -%% Find indices of selected points in temperature array - -selectedPoints = inpolygon( ... - artoaWorkspace.rafosDate, ... - artoaWorkspace.temperature, ... - selectedPolygonX, ... - selectedPolygonY ... -); - -%% Mark data as deleted -artoaWorkspace.status(selectedPoints) = 2; - -%% Update gui -artoa.controller.edit.temperature.plot(); - - -end - diff --git a/lib/+artoa/+controller/+edit/+temperature/open.m b/lib/+artoa/+controller/+edit/+temperature/open.m index 6a93b0f3e0f3a9a93f0631c60ca0b6a5b8c45823..d3fcf4b0d9714537e3bb00468c475595b277b127 100644 --- a/lib/+artoa/+controller/+edit/+temperature/open.m +++ b/lib/+artoa/+controller/+edit/+temperature/open.m @@ -2,7 +2,7 @@ function [] = open() %OPENEDITTEMPERATURE Initializes the temperature editing gui. % Detailed explanation goes here -global artoaGui; +global artoaGui artoaWorkspace; %% Check if the gui is already opened @@ -15,5 +15,8 @@ end %% Open the gui artoa.gui.edit.temperature(); +%% Create workspace variables +artoaWorkspace.editTemperature = struct(); + end diff --git a/lib/+artoa/+controller/+edit/+temperature/pickPolygon.m b/lib/+artoa/+controller/+edit/+temperature/pickPolygon.m index 6c0de13221f9f2995278c2acc34dc38d2835c358..16ffa6bc219f67af863b385c6bd9a0cbcbea0844 100644 --- a/lib/+artoa/+controller/+edit/+temperature/pickPolygon.m +++ b/lib/+artoa/+controller/+edit/+temperature/pickPolygon.m @@ -2,29 +2,18 @@ function [] = pickPolygon() %PICKPOLYGON Lets the user pick a polygon in the plot. % During selection, a line is being plotted that shows the selected % points by the user. +% The polygon can be stopped by using the right mouse button. If +% finished, the selected points are being calculated and stored in the +% artoaWorkspace variable. global artoaGui artoaWorkspace; -%% Save current state of window button down - -windowButtonDownFunction = get( ... - artoaGui.figures.editTemperature, ... - 'WindowButtonDownFcn' ... -); - -%% Disable current window button down -set( ... - artoaGui.figures.editTemperature, ... - 'WindowButtonDownFcn', ... - '' ... -); - %% Select polygon by mouse x = []; y = []; % draw the line that will be extended on every click -artoaWorkspace.selectedPolygon = line( ... +artoaGui.editTemperature.selectedPolygon = line( ... NaN, NaN, 'Color', [1 1 1], 'LineStyle', '-' ... ); @@ -42,7 +31,7 @@ while button == 1 continue; end % update the line - set(artoaWorkspace.selectedPolygon, 'XData', x, 'YData', y); + set(artoaGui.editTemperature.selectedPolygon, 'XData', x, 'YData', y); [dx, dy, button] = ginput(1); end @@ -52,15 +41,17 @@ if length(x) > 3 % a polygon can only be closed if there are more than two value y = [y; y(1)]; end % update the line -set(artoaWorkspace.selectedPolygon, 'XData', x, 'YData', y); +set(artoaGui.editTemperature.selectedPolygon, 'XData', x, 'YData', y); + +% store the selected points in the workspace for editing +artoaWorkspace.editTemperature.selectedPoints = inpolygon( ... + artoaWorkspace.rafosDate, ... + artoaWorkspace.temperature, ... + x, ... + y ... +); -%% Restore window button down -set( ... - artoaGui.figures.editTemperature, ... - 'WindowButtonDownFcn', ... - windowButtonDownFunction ... -); end diff --git a/lib/+artoa/+controller/+edit/+temperature/plot.m b/lib/+artoa/+controller/+edit/+temperature/plot.m index e54385b099fcb5b142b19cb24cc639e7300477d0..c978c4cdd35fa7e786838aa14536ea818609ee49 100644 --- a/lib/+artoa/+controller/+edit/+temperature/plot.m +++ b/lib/+artoa/+controller/+edit/+temperature/plot.m @@ -11,16 +11,18 @@ hold on %% Get all required values % create color vector c = repmat([1 1 0], length(artoaWorkspace.rafosDate), 1); -c(artoaWorkspace.status == 1, :) = repmat([1 1 1], length(c(artoaWorkspace.status == 1, 1)), 1); -c(artoaWorkspace.status == 2, :) = repmat([1 0 0], length(c(artoaWorkspace.status == 2, 1)), 1); +c(artoaWorkspace.statusTemperature == 1, :) = ... + repmat([1 1 1], length(c(artoaWorkspace.statusTemperature == 1, 1)), 1); +c(artoaWorkspace.statusTemperature == 2, :) = ... + repmat([1 0 0], length(c(artoaWorkspace.statusTemperature == 2, 1)), 1); if artoaWorkspace.showAllDataPoints x = artoaWorkspace.rafosDate; y = artoaWorkspace.temperature; else - x = artoaWorkspace.rafosDate(artoaWorkspace.status ~= 2); - y = artoaWorkspace.temperature(artoaWorkspace.status ~= 2); - c = c(artoaWorkspace.status ~= 2, :); + x = artoaWorkspace.rafosDate(artoaWorkspace.statusTemperature ~= 2); + y = artoaWorkspace.temperature(artoaWorkspace.statusTemperature ~= 2); + c = c(artoaWorkspace.statusTemperature ~= 2, :); end %% If the plot exists, just update the values diff --git a/lib/+artoa/+controller/+file/loadInterim.m b/lib/+artoa/+controller/+file/loadInterim.m new file mode 100644 index 0000000000000000000000000000000000000000..47590055b4ef64be0a3d3db0776feccb68429e96 --- /dev/null +++ b/lib/+artoa/+controller/+file/loadInterim.m @@ -0,0 +1,19 @@ +function [] = loadInterim() +%LOADINTERIM Loads the current state of ARTOA4 from the file specified by dialog. +% + +%% Ask for filename +filename = uigetfile('*.itm'); + +if (filename == 0) + return +end + +%% Load mat file +load(filename, '-mat'); + +%% Update menu buttons +artoa.controller.updateMenuButtons(); + +end + diff --git a/lib/+artoa/+controller/+file/saveInterim.m b/lib/+artoa/+controller/+file/saveInterim.m new file mode 100644 index 0000000000000000000000000000000000000000..361dcfb0db8f2834d81447290e6d6e73db6f623e --- /dev/null +++ b/lib/+artoa/+controller/+file/saveInterim.m @@ -0,0 +1,16 @@ +function [] = saveInterim() +%SAVEINTERIM Saves the current state of ARTOA4 to the file specified by dialog. +% + +global artoaWorkspace artoaDataInput artoaDataOutput; + +%% Ask for filename +filename = uiputfile('*.itm'); + +if (filename ~= 0) + save(filename, 'artoaWorkspace', 'artoaDataInput', 'artoaDataOutput'); +end + + +end + diff --git a/lib/+artoa/+controller/copyRfbToWorkspace.m b/lib/+artoa/+controller/copyRfbToWorkspace.m index dcf13f6e127197eb77b08f036feb3a3875d58454..a53b0846259063ae9bc28ef565d35c62fa2a91b9 100644 --- a/lib/+artoa/+controller/copyRfbToWorkspace.m +++ b/lib/+artoa/+controller/copyRfbToWorkspace.m @@ -19,14 +19,16 @@ artoaWorkspace.temperature = artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIA artoaWorkspace.pressure = artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.pressure); % STATUS -artoaWorkspace.status = zeros(size(artoaDataInput.rfb.DATA, 1), 1); +artoaWorkspace.statusTemperature = zeros(size(artoaDataInput.rfb.DATA, 1), 1); +artoaWorkspace.statusPressure = zeros(size(artoaDataInput.rfb.DATA, 1), 1); % EXCLUDE LINES CONTAINING 9999 temperatureToExclude = artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.temperature) == 9999; pressureToExclude = artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.pressure) == 9999; -pointsToExclude = or(temperatureToExclude, pressureToExclude); -artoaWorkspace.status(pointsToExclude) = 2; +%pointsToExclude = or(temperatureToExclude, pressureToExclude); +artoaWorkspace.statusTemperature(temperatureToExclude) = 2; +artoaWorkspace.statusPressure(pressureToExclude) = 2; % RAFOS DATE artoaWorkspace.rafosDate = artoa.convert.dmy2rd( ... diff --git a/lib/+artoa/+controller/loadRfb.m b/lib/+artoa/+controller/loadRfb.m index 91736d6c11833f7b0ed694c1917cdfdd0ad8e598..4dd1f80de1d63e9857c6dc0da9ecc4c7d48eba6c 100644 --- a/lib/+artoa/+controller/loadRfb.m +++ b/lib/+artoa/+controller/loadRfb.m @@ -22,9 +22,7 @@ artoaDataInput.rfb = artoa.load.rfb(filepath); artoa.controller.copyRfbToWorkspace(); %% Update menu buttons -if ~islogical(artoaDataInput.rfb) - artoaGui.main.menus.edit.Enable = 'on'; -end +artoa.controller.updateMenuButtons(); end diff --git a/lib/+artoa/+controller/loadSoundSourceFile.m b/lib/+artoa/+controller/loadSoundSourceFile.m new file mode 100644 index 0000000000000000000000000000000000000000..f2913171c24308cc8d9c10f7d9c261061456ecef --- /dev/null +++ b/lib/+artoa/+controller/loadSoundSourceFile.m @@ -0,0 +1,30 @@ +function [] = loadSoundSourceFile() +%LOADSOUNDSOURCEFILE Creates a file selection dialog and reads the file into memory. + +global artoaGui artoaDataInput; + +%% Initialize variables +artoaDataInput.soundsources = false; + +%% Create file dialog and filename +[file, path] = uigetfile('*.soso'); +filepath = fullfile(path, file); + +%% Check if file exists +if ~isfile(filepath) + error([mfilename ': Selected file ' filepath ' is not a file! Please try again!']); +end + +%% Load file into memory +artoaDataInput.soundsources = artoa.load.soundsources(filepath); + +%% Update workspace +%artoa.controller.copyRfbToWorkspace(); + +%% Update menu buttons +if ~islogical(artoaDataInput.soundsources) + artoaGui.main.menus.edit.Enable = 'on'; +end + +end + diff --git a/lib/+artoa/+controller/updateMenuButtons.m b/lib/+artoa/+controller/updateMenuButtons.m new file mode 100644 index 0000000000000000000000000000000000000000..f99c11c071619193031524c1cf53c7372db9a659 --- /dev/null +++ b/lib/+artoa/+controller/updateMenuButtons.m @@ -0,0 +1,16 @@ +function [] = updateMenuButtons() +%ENABLEMENUBUTTONS Summary of this function goes here +% Detailed explanation goes here + +global artoaGui artoaDataInput; + +%% Update menu buttons +if isfield(artoaDataInput, 'rfb') && ~islogical(artoaDataInput.rfb) + artoaGui.main.menus.edit.Enable = 'on'; +else + artoaGui.main.menus.edit.Enable = 'off'; +end + + +end + diff --git a/lib/+artoa/+gui/+edit/pressure.m b/lib/+artoa/+gui/+edit/pressure.m new file mode 100644 index 0000000000000000000000000000000000000000..3de73165da4ee2cd3c5f3367d3cbff1677381bfd --- /dev/null +++ b/lib/+artoa/+gui/+edit/pressure.m @@ -0,0 +1,121 @@ +function [] = pressure() +%TEMPERATURE Defines the ARTOA4 edit pressure window. + +global artoaGui artoaWorkspace; + +%% Initialize required variables + +windowTitle = [ 'ARTOA4 - Float ' num2str(artoaWorkspace.float.floatname) ' - Pressure' ]; + + +%% Initialize temperature gui + +artoaGui.figures.editPressure = figure( ... + 'Name', windowTitle, ... + 'NumberTitle', 'off' ... +); +addToolbarExplorationButtons(artoaGui.figures.editPressure); + +artoaGui.editPressure = struct(); + +set( ... + artoaGui.figures.editPressure, ... + 'CloseRequestFcn', ... + 'artoa.controller.edit.pressure.close();' ... +); + +%% Generate Plot + +artoa.controller.edit.pressure.plot(); + +set(gca, 'Position', [0.13 0.11 0.706 0.815]); + +%% Generate Controls + +left = .85; +width = .14; +buttonHeight = .05; +buttonMarginLeftRight = .005; + +artoaGui.editPressure.frameControls = uicontrol( ... + 'Style', 'Frame', ... + 'Units', 'normalized', ... + 'BackgroundColor', 'white', ... + 'Position', [left .11 width .815] ... +); + +artoaGui.editPressure.frameHeadline = uicontrol( ... + 'Style', 'Text', ... + 'Units', 'normalized', ... + 'FontSize', 8, ... + 'BackgroundColor', 'white', ... + 'Position', [(left+buttonMarginLeftRight) .85 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'String', 'Data' ... +); + +artoaGui.editPressure.buttonPick = uicontrol( ... + 'String', 'Pick', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .8 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.pressure.pickPolygon();' ... +); + +artoaGui.editPressure.buttonApply = uicontrol( ... + 'String', 'Apply', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .75 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.pressure.applyStatusToSelectedPoints(1);' ... +); + +artoaGui.editPressure.buttonDelete = uicontrol( ... + 'String', 'Delete', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .7 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.pressure.applyStatusToSelectedPoints(2);' ... +); + +artoaGui.editPressure.buttonReset = uicontrol( ... + 'String', 'Reset', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .65 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.pressure.applyStatusToSelectedPoints(0);' ... +); + +artoaGui.editPressure.buttonApplyAll = uicontrol( ... + 'String', 'Apply all', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .5 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.pressure.applyStatusToAllPointsExceptDeleted(1);' ... +); + +artoaGui.editPressure.buttonResetAll = uicontrol( ... + 'String', 'Reset all', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .45 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.pressure.applyStatusToAllPointsExceptDeleted(0);' ... +); + +artoaGui.editPressure.buttonReplot = uicontrol( ... + 'String', 'Replot', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .2 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.pressure.plot();' ... +); + + +end + diff --git a/lib/+artoa/+gui/+edit/temperature.m b/lib/+artoa/+gui/+edit/temperature.m index f4430157e7df93f76d26b5d7c5a3bf015d697303..2ad16257b42f4b34abb8d9c0f2a1d042c89a29eb 100644 --- a/lib/+artoa/+gui/+edit/temperature.m +++ b/lib/+artoa/+gui/+edit/temperature.m @@ -14,6 +14,7 @@ artoaGui.figures.editTemperature = figure( ... 'Name', windowTitle, ... 'NumberTitle', 'off' ... ); +addToolbarExplorationButtons(artoaGui.figures.editTemperature); artoaGui.editTemperature = struct(); @@ -61,13 +62,58 @@ artoaGui.editTemperature.buttonPick = uicontrol( ... 'CallBack', 'artoa.controller.edit.temperature.pickPolygon();' ... ); +artoaGui.editTemperature.buttonApply = uicontrol( ... + 'String', 'Apply', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .75 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.temperature.applyStatusToSelectedPoints(1);' ... +); + artoaGui.editTemperature.buttonDelete = uicontrol( ... 'String', 'Delete', ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... - 'Position', [(left+buttonMarginLeftRight) .75 (width-2*buttonMarginLeftRight) buttonHeight], ... - 'CallBack', 'artoa.controller.edit.temperature.deleteSelectedPoints();' ... + 'Position', [(left+buttonMarginLeftRight) .7 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.temperature.applyStatusToSelectedPoints(2);' ... +); + +artoaGui.editTemperature.buttonReset = uicontrol( ... + 'String', 'Reset', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .65 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.temperature.applyStatusToSelectedPoints(0);' ... +); + +artoaGui.editTemperature.buttonApplyAll = uicontrol( ... + 'String', 'Apply all', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .5 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.temperature.applyStatusToAllPointsExceptDeleted(1);' ... +); + +artoaGui.editTemperature.buttonResetAll = uicontrol( ... + 'String', 'Reset all', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .45 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.temperature.applyStatusToAllPointsExceptDeleted(0);' ... +); + +artoaGui.editTemperature.buttonReplot = uicontrol( ... + 'String', 'Replot', ... + 'Style', 'PushButton', ... + 'FontSize', 8, ... + 'Units', 'normalized', ... + 'Position', [(left+buttonMarginLeftRight) .2 (width-2*buttonMarginLeftRight) buttonHeight], ... + 'CallBack', 'artoa.controller.edit.temperature.plot();' ... ); diff --git a/lib/+artoa/+gui/main.m b/lib/+artoa/+gui/main.m index bd9ec49f4ca6500ed2e018570203be81e051b73b..d0041c1148059b987859d531b5ec6d1dbdfab7b6 100644 --- a/lib/+artoa/+gui/main.m +++ b/lib/+artoa/+gui/main.m @@ -32,8 +32,13 @@ uimenu( ... ); uimenu( ... loadHandle, ... - 'Label', 'Interim file', ...%'Callback', 'artoa.controller.loadInterim' ... - 'Enable', 'off' ... + 'Label', 'Interim file', ... + 'Callback', 'artoa.controller.file.loadInterim();' ... +); +uimenu( ... + loadHandle, ... + 'Label', 'SoSo file', ... + 'Callback', 'artoa.controller.loadSoundSourceFile();' ... ); % SAVE @@ -45,6 +50,12 @@ uimenu( ... 'Enable', 'off' ... ); +uimenu( ... + saveHandle, ... + 'Label', 'Interim file', ... + 'Callback', 'artoa.controller.file.saveInterim();' ... +); + % QUIT artoaGui.main.menus.fileQuit = uimenu( ... artoaGui.main.menus.file, ... @@ -71,7 +82,11 @@ artoaGui.main.menus.editTemperature = uimenu( ... ); % PRESSURE -%pressureHandle = uimenu(file, 'Label', 'Pressure', 'Enable', 'off'); +artoaGui.main.menus.editPressure = uimenu( ... + artoaGui.main.menus.edit, ... + 'Label', 'Pressure', ... + 'Callback', 'artoa.controller.edit.pressure.open();' ... +); %% Initialize view menu