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

Lines between soundsources are now plotted and shown and hidden on selection of trajectory.

parent b4b29041
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,22 @@ for i = 1:length(trajectories)
trajectories{i}, ...
trajectoryColor ...
);
% plot lines between soundsources
[ ...
artoaGui.trajectoryOutput.trajectoryHandles{i}.linesSoundsources ...
] = artoa.controller.track.trajectoryOutput.plotSoundsourceLines( ...
artoaGui.trajectoryOutput.axesTrajectoryOutput, ...
trajectories{i}, ...
artoaWorkspace.filteredSoundsources, ...
trajectoryColor ...
);
% hide lines between soundsources
artoa.controller.setPlotHandleVisibility( ...
artoaGui.trajectoryOutput.trajectoryHandles{i}.linesSoundsources, ...
false ...
);
% set visibility of trajectories
artoa.controller.setPlotHandleVisibility( ...
{ ...
artoaGui.trajectoryOutput.trajectoryHandles{i}.scatterPositions, ...
......
function [] = plotSoundsourceLines()
function [lineHandles] = plotSoundsourceLines(pAxesHandle, pTrajectory, pSoundsources, pColor)
%PLOTSOUNDSOURCELINES Summary of this function goes here
% Detailed explanation goes here
global artoaWorkspace artoaGui;
%% Get required data
trajectoryId = artoaWorkspace.trajectoryOutput.tableGeneratedTracksSelectedRow;
trajectory = artoaWorkspace.trajectoryOutput.trajectories{trajectoryId};
%% Get all sound sources that are involved
involvedSoundsourceNames = ...
unique(flatten( ...
cellfun( ...
@strsplit, trajectory.trackParameter.soundsourceCombinations.soundsources, 'UniformOutput', false ...
@strsplit, pTrajectory.trackParameter.soundsourceCombinations.soundsources, 'UniformOutput', false ...
) ...
));
involvedSoundsources = artoa.data.extractSoundsourcesFromStruct( ...
involvedSoundsourceNames, ...
artoaWorkspace.filteredSoundsources, ...
pSoundsources, ...
true ...
);
%% Plot lines between soundsources
hold(artoaGui.trajectoryOutput.axesTrajectoryOutput, 'on');
artoaGui.trajectoryOutput.linesSoundsources = {};
hold(pAxesHandle, 'on');
lineHandles = {};
for o = 1:length(involvedSoundsourceNames)
currentSoundsource = involvedSoundsources.(involvedSoundsourceNames{o});
......@@ -31,14 +25,14 @@ for o = 1:length(involvedSoundsourceNames)
innerSoundsource = involvedSoundsources.(involvedSoundsourceNames{i});
x = [currentSoundsource.position(2) innerSoundsource.position(2)];
y = [currentSoundsource.position(1) innerSoundsource.position(1)];
artoaGui.trajectoryOutput.linesSoundsources{end + 1} = line( ...
artoaGui.trajectoryOutput.axesTrajectoryOutput, ...
x, y, 'Color', [0 0 0] ...
lineHandles{end + 1} = line( ...
pAxesHandle, ...
x, y, 'Color', pColor ...
);
end
end
hold(artoaGui.trajectoryOutput.axesTrajectoryOutput, 'off');
hold(pAxesHandle, 'off');
end
......@@ -4,6 +4,14 @@ function [] = tableGeneratedTracksSelect(~, event)
global artoaWorkspace artoaGui;
%% Hide all lines between soundsources
for i = 1:length(artoaGui.trajectoryOutput.trajectoryHandles)
artoa.controller.setPlotHandleVisibility( ...
artoaGui.trajectoryOutput.trajectoryHandles{i}.linesSoundsources, ...
false ...
);
end
%% Get data
try
selectedColumn = event.Indices(2);
......@@ -19,11 +27,6 @@ end
artoaWorkspace.trajectoryOutput.tableGeneratedTracksSelectedRow = selectedRow;
artoaWorkspace.trajectoryOutput.tableGeneratedTracksSelectedColumn = selectedColumn;
%% Remove lines between soundsources
if isfield(artoaGui.trajectoryOutput, 'linesSoundsources')
cellfun(@delete, artoaGui.trajectoryOutput.linesSoundsources);
end
%% Check for hiding
if selectedColumn == 1
artoaWorkspace.trajectoryOutput.trajectories{selectedRow}.hidden = ...
......@@ -35,11 +38,14 @@ if selectedColumn == 1
artoaGui.trajectoryOutput.trajectoryHandles{selectedRow}, ...
~artoaWorkspace.trajectoryOutput.trajectories{selectedRow}.hidden ...
);
else
% Draw lines between soundsources
artoa.controller.track.trajectoryOutput.plotSoundsourceLines();
end
%% Show only selected trajectory lines
artoa.controller.setPlotHandleVisibility( ...
artoaGui.trajectoryOutput.trajectoryHandles{selectedRow}.linesSoundsources, ...
true ...
);
%% Plot residuals
[ ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment