function [scatterHandle, textHandles] = scatterPositions(pAxesHandle, pSoundsources, pPlotAsMap)
%PLOT Summary of this function goes here
%   Detailed explanation goes here

%% Collect required data

fnames = fieldnames(pSoundsources);
plot_names = fnames;

lat = NaN(length(fnames), 1);
lon = NaN(length(fnames), 1);

for i = 1:length(fnames)
    lat(i) = pSoundsources.(fnames{i}).position(1);
    lon(i) = pSoundsources.(fnames{i}).position(2);
    plot_names{i} = {'', ['  ' plot_names{i}]};
end

%% Plot positions

% make handle the current axes
axes(pAxesHandle);

hold(pAxesHandle, 'on');

if pPlotAsMap
    scatterHandle = scatterm(pAxesHandle, lat, lon, [], [0 0 0]);
    %textHandles = text(pAxesHandle, lon, lat, plot_names, 'Color', [0 0 0]);
    textHandles = textm(lat, lon, plot_names, 'Color', [0 0 0]);
else
    scatterHandle = scatter(pAxesHandle, lon, lat, [], [0 0 0]);
    textHandles = text(pAxesHandle, lon, lat, plot_names, 'Color', [0 0 0]);
end
hold(pAxesHandle, 'off');

end

