aboutsummaryrefslogtreecommitdiff
path: root/selectionhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'selectionhandler.cpp')
-rw-r--r--selectionhandler.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/selectionhandler.cpp b/selectionhandler.cpp
new file mode 100644
index 0000000..44eef28
--- /dev/null
+++ b/selectionhandler.cpp
@@ -0,0 +1,19 @@
+#include "selectionhandler.h"
+
+SelectionHandler::SelectionHandler(const arma::uvec &sampleIndices)
+ : m_sampleIndices(sampleIndices)
+{
+}
+
+void SelectionHandler::setSelection(const QSet<int> &selection)
+{
+ QSet<int> newSelection;
+
+ // The selecion happens over the sample indices. We use the original dataset
+ // indices in sampleIndices to translate indices.
+ for (auto it = selection.begin(); it != selection.end(); it++) {
+ newSelection.insert(m_sampleIndices[*it]);
+ }
+
+ emit selectionChanged(newSelection);
+}