aboutsummaryrefslogtreecommitdiff
path: root/selectionhandler.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2015-09-17 12:20:24 -0300
committerSamuel Fadel <samuelfadel@gmail.com>2015-09-17 12:20:24 -0300
commit0518b806d8ce25c69847ec8c403276193611b2e1 (patch)
treef008385354f24ab2fadca171d27d8f2656244d89 /selectionhandler.cpp
parent8b1e2720b1253a91e3b75a08e2f5a38deb55affa (diff)
Additional interactive functionalities.
- Selection linking between subsample plot and main plot - Dumb "effectiveness" coloring
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..4c488a0
--- /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 arma::uvec &selection)
+{
+ arma::uvec newSelection(selection);
+
+ // The selecion happens over the sample indices. We use the original dataset
+ // indices in sampleIndices to translate indices.
+ for (auto it = newSelection.begin(); it != newSelection.end(); it++) {
+ *it = m_sampleIndices[*it];
+ }
+
+ emit selectionChanged(newSelection);
+}