Skip to content
Snippets Groups Projects
Commit 2d50cc1c authored by leprob001's avatar leprob001
Browse files

The restore view button has been implemented in a custom function for...

The restore view button has been implemented in a custom function for temperature, pressure and toa window.
parent 1863295e
No related branches found
No related tags found
No related merge requests found
216
\ No newline at end of file
217
\ No newline at end of file
function [] = restoreView(~, eventData)
%RESTOREVIEW Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace;
%% Reset limits of axes
axes = eventData.Axes;
[axes.XLim, axes.YLim] = artoa.data.getPressureLimits(artoaWorkspace, artoaWorkspace.hideDeletedDataPoints);
%% Add some space around
factor = 0.05;
axes.XLim(1) = axes.XLim(1) - abs(diff(axes.XLim)) * factor;
axes.XLim(2) = axes.XLim(2) + abs(diff(axes.XLim)) * factor;
axes.YLim(1) = axes.YLim(1) - abs(diff(axes.YLim)) * factor;
axes.YLim(2) = axes.YLim(2) + abs(diff(axes.YLim)) * factor;
end
function [] = restoreView(~, eventData)
%RESTOREVIEW Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace;
%% Reset limits of axes
axes = eventData.Axes;
[axes.XLim, axes.YLim] = artoa.data.getTemperatureLimits(artoaWorkspace, artoaWorkspace.hideDeletedDataPoints);
%% Add some space around
factor = 0.05;
axes.XLim(1) = axes.XLim(1) - abs(diff(axes.XLim)) * factor;
axes.XLim(2) = axes.XLim(2) + abs(diff(axes.XLim)) * factor;
axes.YLim(1) = axes.YLim(1) - abs(diff(axes.YLim)) * factor;
axes.YLim(2) = axes.YLim(2) + abs(diff(axes.YLim)) * factor;
end
......@@ -52,7 +52,6 @@ if isfield(artoaGui.editTimeOfArrival, 'scatterTimeOfArrival') ...
]);
% force toa scatter to be current axes of figure
artoaGui.figures.editTimeOfArrival.CurrentAxes = artoaGui.editTimeOfArrival.axesScatterTimeOfArrival;
zoom(artoaGui.figures.editTimeOfArrival, 'reset');
return
end
......@@ -70,6 +69,12 @@ artoaGui.editTimeOfArrival.scatterTimeOfArrival = scatter( ...
'filled' ...
);
%% Set limits
[ ...
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.XLim, ...
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival.YLim ...
] = artoa.data.getToaLimits(artoaWorkspace, ~artoaWorkspace.hideDeletedDataPoints);
%% Setup GPS information plot
artoa.controller.edit.timeOfArrival.plotSoundsourceToaFromGps(artoaWorkspace.filteredSoundsources);
......
......
function [] = restoreView(~, eventData)
%RESTOREVIEW Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace;
%% Reset limits of axes
axes = eventData.Axes;
[axes.XLim, axes.YLim] = artoa.data.getToaLimits(artoaWorkspace, ~artoaWorkspace.hideDeletedDataPoints);
%% Add some space around
factor = 0.05;
axes.XLim(1) = axes.XLim(1) - abs(diff(axes.XLim)) * factor;
axes.XLim(2) = axes.XLim(2) + abs(diff(axes.XLim)) * factor;
axes.YLim(1) = axes.YLim(1) - abs(diff(axes.YLim)) * factor;
axes.YLim(2) = axes.YLim(2) + abs(diff(axes.YLim)) * factor;
end
function [rafosLimits, pressureLimits] = getPressureLimits(pWorkspace, pIncludeDeleted)
%GETTOALIMITS Finds the maximum and minimum of toa data.
% If pIncludeDeleted equals to true, all values that are either selected or
% manually deleted are used for estimation.
if nargin == 1
pIncludeDeleted = false;
end
if pIncludeDeleted
selection = pWorkspace.statusPressure ~= 2;
else
selection = true(size(pWorkspace.statusPressure));
end
nanFilter = ~isnan(pWorkspace.rafosDate) & ~isnan(pWorkspace.pressure);
selection = selection & nanFilter;
pressureLimits = [min(pWorkspace.pressure(selection)), max(pWorkspace.pressure(selection))];
rafosLimits = [min(pWorkspace.rafosDate(selection)), max(pWorkspace.rafosDate(selection))];
end
function [rafosLimits, temperatureLimits] = getTemperatureLimits(pWorkspace, pIncludeDeleted)
%GETTOALIMITS Finds the maximum and minimum of toa data.
% If pIncludeDeleted equals to true, all values that are either selected or
% manually deleted are used for estimation.
if nargin == 1
pIncludeDeleted = false;
end
if pIncludeDeleted
selection = pWorkspace.statusTemperature ~= 2;
else
selection = true(size(pWorkspace.statusTemperature));
end
nanFilter = ~isnan(pWorkspace.rafosDate) & ~isnan(pWorkspace.temperature);
selection = selection & nanFilter;
temperatureLimits = [min(pWorkspace.temperature(selection)), max(pWorkspace.temperature(selection))];
rafosLimits = [min(pWorkspace.rafosDate(selection)), max(pWorkspace.rafosDate(selection))];
end
function [rafosLimits, toaLimits] = getToaLimits(pWorkspace, pIncludeDeleted)
%GETTOALIMITS Finds the maximum and minimum of toa data.
% If pIncludeDeleted equals to true, all values that are either selected or
% manually deleted are used for estimation.
if nargin == 1
pIncludeDeleted = false;
end
if pIncludeDeleted
temperatureSelection = pWorkspace.statusTemperature ~= 0;
pressureSelection = pWorkspace.statusPressure ~= 0;
else
temperatureSelection = pWorkspace.statusTemperature == 1;
pressureSelection = pWorkspace.statusPressure == 1;
end
selection = repmat(temperatureSelection & pressureSelection, pWorkspace.float.toaperphase, 1);
toaLimits = [min(pWorkspace.toaData.toa(selection)), max(pWorkspace.toaData.toa(selection))];
rafosLimits = [min(pWorkspace.toaData.toaDate(selection)), max(pWorkspace.toaData.toaDate(selection))];
end
......@@ -35,6 +35,13 @@ artoa.controller.edit.updateAvailablePlots();
set(gca, 'Position', [0.13 0.11 0.706 0.815]);
% create custom axes toolbar
[~, btns] = axtoolbar( ...
artoaGui.editPressure.axesScatterPressure, ...
{'datacursor', 'pan', 'zoomin', 'zoomout', 'restoreview'} ...
);
btns(1).ButtonPushedFcn = @artoa.controller.edit.pressure.restoreView;
%% Generate Controls
left = .85;
......
......
......@@ -35,6 +35,13 @@ artoa.controller.edit.updateAvailablePlots();
set(gca, 'Position', [0.13 0.11 0.706 0.815]);
% create custom axes toolbar
[~, btns] = axtoolbar( ...
artoaGui.editTemperature.axesScatterTemperature, ...
{'datacursor', 'pan', 'zoomin', 'zoomout', 'restoreview'} ...
);
btns(1).ButtonPushedFcn = @artoa.controller.edit.temperature.restoreView;
%% Generate Controls
left = .85;
......
......
......@@ -58,7 +58,12 @@ set(titleHandle, 'Color', 'blue');
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
%% Generate Plot
artoa.controller.edit.timeOfArrival.plot();
%% Setup listener to update the deployment and recover text of soundsources
addlistener( ...
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, ...
'YLim', ...
......@@ -66,9 +71,29 @@ addlistener( ...
@artoa.controller.edit.timeOfArrival.updateSoundsourceDeploymentRecoverText ...
);
%% Create custom axes toolbar
[~, btns] = axtoolbar( ...
artoaGui.editTimeOfArrival.axesScatterTimeOfArrival, ...
{'datacursor', 'pan', 'zoomin', 'zoomout', 'restoreview'} ...
);
% the buttons are returned in reverse order!
mountRestoreViewButton(btns(1));
[~, btns] = axtoolbar( ...
artoaGui.editTimeOfArrival.axesAppliedSoundsources, ...
{'datacursor', 'pan', 'zoomin', 'zoomout', 'restoreview'} ...
);
% the buttons are returned in reverse order!
mountRestoreViewButton(btns(1));
[~, btns] = axtoolbar( ...
artoaGui.editTimeOfArrival.axesToaFromGps, ...
{'datacursor', 'pan', 'zoomin', 'zoomout', 'restoreview'} ...
);
% the buttons are returned in reverse order!
mountRestoreViewButton(btns(1));
%% Generate Plot
artoa.controller.edit.timeOfArrival.plot();
function mountRestoreViewButton(pButton)
pButton.ButtonPushedFcn = @artoa.controller.edit.timeOfArrival.restoreView;
end
%% Generate Controls
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment