From 0f34fd437efb936ef29ac91186321aa7251fbfb1 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 23 May 2023 11:22:33 +0200 Subject: Massive changes in initial port away from Qt. --- projectionhistory.cpp | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'projectionhistory.cpp') diff --git a/projectionhistory.cpp b/projectionhistory.cpp index e57ef41..bc6bb6a 100644 --- a/projectionhistory.cpp +++ b/projectionhistory.cpp @@ -3,8 +3,6 @@ #include #include -#include - #include "mp.h" #include "numericrange.h" @@ -59,8 +57,8 @@ void ProjectionHistory::undo() m_values = m_prevValues; updateUnreliability(); - emit undoPerformed(); - emit currentMapChanged(m_Y); + undoPerformed(); + currentMapChanged(m_Y); if (m_cpSelectionEmpty && m_rpSelectionEmpty) { emitValuesChanged(); } @@ -76,8 +74,8 @@ void ProjectionHistory::reset() m_values = m_firstValues; updateUnreliability(); - emit resetPerformed(); - emit currentMapChanged(m_Y); + resetPerformed(); + currentMapChanged(m_Y); if (m_cpSelectionEmpty && m_rpSelectionEmpty) { emitValuesChanged(); } @@ -98,7 +96,7 @@ void ProjectionHistory::addMap(const arma::mat &Y) updateUnreliability(); mp::aggregatedError(m_distX, m_distY, m_values); - qDebug("Aggr. error: min: %f, max: %f", m_values.min(), m_values.max()); + // qDebug("Aggr. error: min: %f, max: %f", m_values.min(), m_values.max()); if (!m_hasFirst) { m_hasFirst = true; @@ -109,7 +107,7 @@ void ProjectionHistory::addMap(const arma::mat &Y) m_selection.assign(m_values.n_elem, false); } - emit currentMapChanged(m_Y); + currentMapChanged(m_Y); if (m_cpSelectionEmpty && m_rpSelectionEmpty) { emitValuesChanged(); } @@ -152,7 +150,7 @@ void ProjectionHistory::setCPSelection(const std::vector &cpSelection) cpSelectionPostProcess(); - emit selectionChanged(m_selection); + selectionChanged(m_selection); } void ProjectionHistory::cpSelectionPostProcess() @@ -167,7 +165,7 @@ void ProjectionHistory::cpSelectionPostProcess() } } - emit rpValuesChanged(m_influences(m_rpIndices), true); + rpValuesChanged(m_influences(m_rpIndices), true); } else { emitValuesChanged(); } @@ -191,7 +189,7 @@ void ProjectionHistory::setRPSelection(const std::vector &rpSelection) m_rpSelectionEmpty = m_rpSelection.empty(); rpSelectionPostProcess(); - emit selectionChanged(m_selection); + selectionChanged(m_selection); } void ProjectionHistory::rpSelectionPostProcess() @@ -205,9 +203,9 @@ void ProjectionHistory::rpSelectionPostProcess() } } - emit cpValuesChanged(m_influences(m_cpIndices), true); + cpValuesChanged(m_influences(m_cpIndices), true); } else { - emit cpValuesChanged(arma::vec(), false); + cpValuesChanged(arma::vec(), false); } // TODO: emit rpSelectionChanged()? @@ -235,29 +233,29 @@ void ProjectionHistory::setSelection(const std::vector &selection) m_cpSelectionEmpty = m_cpSelection.empty(); cpSelectionPostProcess(); - emit selectionChanged(m_selection); + selectionChanged(m_selection); } bool ProjectionHistory::emitValuesChanged() const { switch (m_type) { case ObserverCurrent: - emit rpValuesChanged(m_values(m_rpIndices), false); - emit valuesChanged(m_values, false); + rpValuesChanged(m_values(m_rpIndices), false); + valuesChanged(m_values, false); return true; case ObserverDiffPrevious: if (m_hasPrev) { arma::vec diff = m_values - m_prevValues; - emit rpValuesChanged(diff(m_rpIndices), true); - emit valuesChanged(diff, false); + rpValuesChanged(diff(m_rpIndices), true); + valuesChanged(diff, false); return true; } return false; case ObserverDiffFirst: if (m_hasFirst) { arma::vec diff = m_values - m_firstValues; - emit rpValuesChanged(diff(m_rpIndices), true); - emit valuesChanged(diff, true); + rpValuesChanged(diff(m_rpIndices), true); + valuesChanged(diff, true); return true; } return false; @@ -273,16 +271,16 @@ void ProjectionHistory::setRewind(double t) } arma::mat Y = m_Y * t + m_prevY * (1.0 - t); - emit mapRewound(Y); + mapRewound(Y); if (!m_cpSelectionEmpty || !m_rpSelectionEmpty) { return; } arma::vec values = m_values * t + m_prevValues * (1.0 - t); - // emit cpValuesRewound(values(m_cpIndices)); - emit rpValuesRewound(values(m_rpIndices)); - emit valuesRewound(values); + // cpValuesRewound(values(m_cpIndices)); + rpValuesRewound(values(m_rpIndices)); + valuesRewound(values); } void ProjectionHistory::updateUnreliability() -- cgit v1.2.3