aboutsummaryrefslogtreecommitdiff
path: root/manipulationhandler.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-02-09 17:38:28 -0200
committerSamuel Fadel <samuelfadel@gmail.com>2016-02-09 17:38:28 -0200
commit886bdd0fa43a2fcdeca306648b643b623af99f88 (patch)
tree7ffa1e622724862b8b99387199fb1ef7cbf79b28 /manipulationhandler.cpp
parent962114b867c044240919ebc558c0b25f105db963 (diff)
Added TransitionControl and plot rewinding.
New component overlays main view and handles middle clicks/drags to performing rewinding. Also sports smooth transitioning back to current projection whenever the mouse button is lifted. Next up, the same kind of transitions in the displayed values.
Diffstat (limited to 'manipulationhandler.cpp')
-rw-r--r--manipulationhandler.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/manipulationhandler.cpp b/manipulationhandler.cpp
index b298860..7d3e3c0 100644
--- a/manipulationhandler.cpp
+++ b/manipulationhandler.cpp
@@ -4,6 +4,8 @@
#include <iostream>
#include <numeric>
+#include <QDebug>
+
#include "mp.h"
#include "numericrange.h"
@@ -30,24 +32,47 @@ void ManipulationHandler::setTechnique(ManipulationHandler::Technique technique)
void ManipulationHandler::setCP(const arma::mat &Ys)
{
+ m_prevY = m_Y;
+
switch (m_technique) {
case TECHNIQUE_PLMP:
- mp::plmp(m_X, m_cpIndices, Ys, m_Y);
+ // TODO?
+ // mp::plmp(m_X, m_cpIndices, Ys, m_Y);
break;
case TECHNIQUE_LSP:
- // TODO
+ // TODO?
// mp::lsp(m_X, m_cpIndices, Ys, m_Y);
break;
case TECHNIQUE_LAMP:
mp::lamp(m_X, m_cpIndices, Ys, m_Y);
break;
case TECHNIQUE_PEKALSKA:
- // TODO
+ // TODO?
// mp::pekalska(m_X, m_cpIndices, Ys, m_Y);
break;
}
+ if (m_firstY.n_rows != m_Y.n_rows) {
+ m_firstY = m_Y;
+ }
+
emit cpChanged(m_Y.rows(m_cpIndices));
emit rpChanged(m_Y.rows(m_rpIndices));
emit mapChanged(m_Y);
}
+
+void ManipulationHandler::setRewind(double t)
+{
+ if (m_prevY.n_rows != m_Y.n_rows) {
+ return;
+ }
+
+ arma::mat Y = m_Y * t + m_prevY * (1.0 - t);
+ emit cpChanged(Y.rows(m_cpIndices));
+ emit rpChanged(Y.rows(m_rpIndices));
+
+ // NOTE: this signal was supposed to be emitted, but since we don't want
+ // anything besides graphical objects to know the projection is being
+ // rewound, this is (for now) left out.
+ // emit mapChanged(Y);
+}