From e476a297064a1aadc8fbb5f98e477a3e54c2f46e Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 12 Jan 2016 16:49:03 +0100 Subject: Scatterplot: removed animation. --- scatterplot.cpp | 46 ++++++++-------------------------------------- 1 file changed, 8 insertions(+), 38 deletions(-) (limited to 'scatterplot.cpp') diff --git a/scatterplot.cpp b/scatterplot.cpp index 919c75c..cad93c7 100644 --- a/scatterplot.cpp +++ b/scatterplot.cpp @@ -21,7 +21,6 @@ Scatterplot::Scatterplot(QQuickItem *parent) , m_shouldUpdateGeometry(false) , m_shouldUpdateMaterials(false) , m_displaySplat(true) - , m_animationEasing(QEasingCurve::InOutQuart) { setClip(true); setFlag(QQuickItem::ItemHasContents); @@ -60,26 +59,24 @@ void Scatterplot::setXY(const arma::mat &xy, bool updateView) } if (m_xy.n_elem != xy.n_elem) { - m_oldXY = xy; m_selectedGlyphs.clear(); - } else { - m_oldXY = m_xy; } m_xy = xy; - float min = std::min(m_xy.col(0).min(), m_oldXY.col(0).min()); - float max = std::max(m_xy.col(0).max(), m_oldXY.col(0).max()); + float min, max; + min = m_xy.col(0).min(); + max = m_xy.col(0).max(); m_sx.setDomain(min, max); - min = std::min(m_xy.col(1).min(), m_oldXY.col(1).min()); - max = std::max(m_xy.col(1).max(), m_oldXY.col(1).max()); + + min = m_xy.col(1).min(); + max = m_xy.col(1).max(); m_sy.setDomain(min, max); emit xyChanged(m_xy); if (updateView) { updateGeometry(); - startAnimation(); } } @@ -244,7 +241,6 @@ QSGNode *Scatterplot::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) } node = node->nextSibling(); - animationTick(); return root; } @@ -292,9 +288,7 @@ void Scatterplot::updateGlyphs(QSGNode *glyphsNode) m_sy.setRange(height() - PADDING, PADDING); QSGNode *node = glyphsNode->firstChild(); - float t = m_animationEasing.valueForProgress(m_t); for (arma::uword i = 0; i < m_xy.n_rows; i++) { - const arma::rowvec &oldRow = m_oldXY.row(i); const arma::rowvec &row = m_xy.row(i); bool isSelected = m_selectedGlyphs.contains(i); @@ -305,8 +299,8 @@ void Scatterplot::updateGlyphs(QSGNode *glyphsNode) QSGGeometryNode *glyphNode = static_cast(node->firstChild()->nextSibling()); if (m_shouldUpdateGeometry) { moveTranslationF = isSelected ? 1.0 : 0.0; - x = m_sx(t*row[0] + (1 - t)*oldRow[0]) + tx * moveTranslationF; - y = m_sy(t*row[1] + (1 - t)*oldRow[1]) + ty * moveTranslationF; + x = m_sx(row[0]) + tx * moveTranslationF; + y = m_sy(row[1]) + ty * moveTranslationF; QSGGeometry *geometry = glyphOutlineNode->geometry(); updateCircleGeometry(geometry, GLYPH_SIZE / 2, x, y); @@ -327,30 +321,6 @@ void Scatterplot::updateGlyphs(QSGNode *glyphsNode) } } -void Scatterplot::resetAnimation() -{ - m_t = 0; -} - -void Scatterplot::startAnimation() -{ - if (m_t < 1.0f) { - m_t = 1.0f; - return; - } - - resetAnimation(); - update(); -} - -void Scatterplot::animationTick() -{ - if (m_t < 1.0f) { - m_t += 0.1f; - updateGeometry(); - } -} - void Scatterplot::mousePressEvent(QMouseEvent *event) { switch (m_currentInteractionState) { -- cgit v1.2.3