From 886bdd0fa43a2fcdeca306648b643b623af99f88 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 9 Feb 2016 17:38:28 -0200 Subject: 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. --- manipulationhandler.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'manipulationhandler.cpp') diff --git a/manipulationhandler.cpp b/manipulationhandler.cpp index b298860..7d3e3c0 100644 --- a/manipulationhandler.cpp +++ b/manipulationhandler.cpp @@ -4,6 +4,8 @@ #include #include +#include + #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); +} -- cgit v1.2.3