From d414b68cea008edc063e26133564d120a7430bd2 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Thu, 21 Jan 2016 19:36:14 +0100 Subject: Added selection linking. Needs more tests. --- main.cpp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index b9daab9..6af65b3 100644 --- a/main.cpp +++ b/main.cpp @@ -17,6 +17,7 @@ #include "barchart.h" #include "colormap.h" #include "interactionhandler.h" +#include "selectionhandler.h" #include "projectionobserver.h" #include "skelft.h" @@ -153,13 +154,6 @@ int main(int argc, char **argv) QObject::connect(&interactionHandler, SIGNAL(cpChanged(const arma::mat &)), m->splat, SLOT(setSites(const arma::mat &))); - // Linking between selections in cp plot and rp plot - //SelectionHandler selectionHandler(cpIndices); - //QObject::connect(cpPlot, SIGNAL(selectionChanged(const QSet &)), - // &selectionHandler, SLOT(setSelection(const QSet &))); - //QObject::connect(&selectionHandler, SIGNAL(selectionChanged(const QSet &)), - // plot, SLOT(setSelection(const QSet &))); - // Connections between history graph and cp plot //HistoryGraph *history = engine.rootObjects()[0]->findChild("history"); //QObject::connect(cpPlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)), @@ -181,26 +175,36 @@ int main(int argc, char **argv) m->rpBarChart->setAcceptedMouseButtons(Qt::LeftButton); m->setRPBarChartColorScale(Main::ColorScaleContinuous); - QObject::connect(m->cpBarChart, SIGNAL(selectionChanged(const QSet &)), - m->cpPlot, SLOT(setSelection(const QSet &))); - - QObject::connect(m->rpBarChart, SIGNAL(selectionChanged(const QSet &)), - m->rpPlot, SLOT(setSelection(const QSet &))); + // Linking between selections + SelectionHandler cpSelectionHandler(cpIndices.n_elem); + QObject::connect(m->cpPlot, SIGNAL(selectionInteractivelyChanged(const std::vector &)), + &cpSelectionHandler, SLOT(setSelection(const std::vector &))); + QObject::connect(m->cpBarChart, SIGNAL(selectionInteractivelyChanged(const std::vector &)), + &cpSelectionHandler, SLOT(setSelection(const std::vector &))); + QObject::connect(&cpSelectionHandler, SIGNAL(selectionChanged(const std::vector &)), + m->cpPlot, SLOT(setSelection(const std::vector &))); + + //SelectionHandler rpSelectionHandler(X.n_rows - cpIndices.n_elem); + //QObject::connect(m->rpPlot, SIGNAL(selectionInteractivelyChanged(const std::vector &)), + // &rpSelectionHandler, SLOT(setSelection(const std::vector &))); + //QObject::connect(m->rpBarChart, SIGNAL(selectionInteractivelyChanged(const std::vector &)), + // &rpSelectionHandler, SLOT(setSelection(const std::vector &))); + //QObject::connect(&rpSelectionHandler, SIGNAL(selectionChanged(const std::vector &)), + // m->rpPlot, SLOT(setSelection(const std::vector &))); ProjectionObserver projectionObserver(X, cpIndices); m->projectionObserver = &projectionObserver; QObject::connect(&interactionHandler, SIGNAL(cpChanged(const arma::mat &)), m->projectionObserver, SLOT(setMap(const arma::mat &))); - QObject::connect(m->projectionObserver, SIGNAL(valuesChanged(const arma::vec &)), - m->rpPlot, SLOT(setColorData(const arma::vec &))); + //QObject::connect(m->projectionObserver, SIGNAL(valuesChanged(const arma::vec &)), + // m->rpPlot, SLOT(setColorData(const arma::vec &))); QObject::connect(m->projectionObserver, SIGNAL(valuesChanged(const arma::vec &)), m->splat, SLOT(setValues(const arma::vec &))); - QObject::connect(m->projectionObserver, SIGNAL(valuesChanged(const arma::vec &)), + QObject::connect(m->projectionObserver, SIGNAL(cpValuesChanged(const arma::vec &)), m->cpBarChart, SLOT(setValues(const arma::vec &))); - QObject::connect(m->projectionObserver, SIGNAL(valuesChanged(const arma::vec &)), - m->rpBarChart, SLOT(setValues(const arma::vec &))); + //QObject::connect(m->projectionObserver, SIGNAL(rpValuesChanged(const arma::vec &)), + // m->rpBarChart, SLOT(setValues(const arma::vec &))); - //history->addHistoryItem(Ys); m->setColormapColorScale(Main::ColorScaleContinuous); m->setCPPlotColorScale(Main::ColorScaleContinuous); m->setRPPlotColorScale(Main::ColorScaleContinuous); -- cgit v1.2.3