aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-19 02:30:50 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-19 02:30:50 +0100
commita319a857a633ab2fbcdbae5204eb5cfcdcc1b413 (patch)
tree94c3408db5539cd24b03b28e68f316ac6e145951 /main.cpp
parente5eaf5236d6e0348b344e0c96c2612b603ff6a3a (diff)
Updated options & hacks to change color scales.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp80
1 files changed, 33 insertions, 47 deletions
diff --git a/main.cpp b/main.cpp
index c58d216..3add8e7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -117,47 +117,33 @@ int main(int argc, char **argv)
QQmlApplicationEngine engine(QUrl("qrc:///main_view.qml"));
- //ColorScale colorScale{
- // QColor("#1f77b4"),
- // QColor("#ff7f0e"),
- // QColor("#2ca02c"),
- // QColor("#d62728"),
- // QColor("#9467bd"),
- // QColor("#8c564b"),
- // QColor("#e377c2"),
- // QColor("#17becf"),
- // QColor("#7f7f7f"),
- //};
- //colorScale.setExtents(labels.min(), labels.max());
-
- ContinuousColorScale colorScale = ContinuousColorScale::builtin(ContinuousColorScale::HEATED_OBJECTS);
-
- Scatterplot *cpPlot = engine.rootObjects()[0]->findChild<Scatterplot *>("cpPlot");
- Scatterplot *rpPlot = engine.rootObjects()[0]->findChild<Scatterplot *>("rpPlot");
- cpPlot->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton);
- // cpPlot->setColorData(arma::zeros<arma::vec>(cpSize));
- VoronoiSplat *splat = engine.rootObjects()[0]->findChild<VoronoiSplat *>("splat");
- skelft2DInitialization(splat->width());
- Colormap *colormap = engine.rootObjects()[0]->findChild<Colormap *>("colormap");
+ m->cpPlot = engine.rootObjects()[0]->findChild<Scatterplot *>("cpPlot");
+ m->cpPlot->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton);
+
+ m->rpPlot = engine.rootObjects()[0]->findChild<Scatterplot *>("rpPlot");
+
+ m->splat = engine.rootObjects()[0]->findChild<VoronoiSplat *>("splat");
+ skelft2DInitialization(m->splat->width());
+
+ m->colormap = engine.rootObjects()[0]->findChild<Colormap *>("colormap");
// Keep track of the current cp (in order to save them later, if requested)
- QObject::connect(cpPlot, SIGNAL(xyChanged(const arma::mat &)),
+ QObject::connect(m->cpPlot, SIGNAL(xyChanged(const arma::mat &)),
m, SLOT(setCP(const arma::mat &)));
- QObject::connect(cpPlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)),
+ QObject::connect(m->cpPlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)),
m, SLOT(setCP(const arma::mat &)));
// Update projection as the cp are modified
InteractionHandler interactionHandler(X, cpIndices);
- m->setInteractionHandler(&interactionHandler);
- m->setTechnique(InteractionHandler::TECHNIQUE_LAMP);
- QObject::connect(cpPlot, SIGNAL(xyChanged(const arma::mat &)),
+ interactionHandler.setTechnique(InteractionHandler::TECHNIQUE_LAMP);
+ QObject::connect(m->cpPlot, SIGNAL(xyChanged(const arma::mat &)),
&interactionHandler, SLOT(setCP(const arma::mat &)));
- QObject::connect(cpPlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)),
+ QObject::connect(m->cpPlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)),
&interactionHandler, SLOT(setCP(const arma::mat &)));
QObject::connect(&interactionHandler, SIGNAL(cpChanged(const arma::mat &)),
- rpPlot, SLOT(setXY(const arma::mat &)));
+ m->rpPlot, SLOT(setXY(const arma::mat &)));
QObject::connect(&interactionHandler, SIGNAL(cpChanged(const arma::mat &)),
- splat, SLOT(setSites(const arma::mat &)));
+ m->splat, SLOT(setSites(const arma::mat &)));
// Linking between selections in cp plot and rp plot
//SelectionHandler selectionHandler(cpIndices);
@@ -173,33 +159,33 @@ int main(int argc, char **argv)
//QObject::connect(history, SIGNAL(currentItemChanged(const arma::mat &)),
// cpPlot, SLOT(setXY(const arma::mat &)));
- QObject::connect(rpPlot, SIGNAL(scaleChanged(const LinearScale<float> &, const LinearScale<float> &)),
- cpPlot, SLOT(setScale(const LinearScale<float> &, const LinearScale<float> &)));
+ QObject::connect(m->rpPlot, SIGNAL(scaleChanged(const LinearScale<float> &, const LinearScale<float> &)),
+ m->cpPlot, SLOT(setScale(const LinearScale<float> &, const LinearScale<float> &)));
- BarChart *barChart = engine.rootObjects()[0]->findChild<BarChart *>("barChart");
- barChart->setAcceptedMouseButtons(Qt::LeftButton);
- barChart->setColorScale(colorScale);
+ m->barChart = engine.rootObjects()[0]->findChild<BarChart *>("barChart");
+ m->barChart->setAcceptedMouseButtons(Qt::LeftButton);
+ m->setBarChartColorScale(Main::ColorScaleContinuous);
ProjectionObserver projectionObserver(X, cpIndices);
QObject::connect(&interactionHandler, SIGNAL(cpChanged(const arma::mat &)),
&projectionObserver, SLOT(setMap(const arma::mat &)));
QObject::connect(&projectionObserver, SIGNAL(mapChanged(const arma::vec &)),
- rpPlot, SLOT(setColorData(const arma::vec &)));
+ m->rpPlot, SLOT(setColorData(const arma::vec &)));
QObject::connect(&projectionObserver, SIGNAL(mapChanged(const arma::vec &)),
- splat, SLOT(setValues(const arma::vec &)));
+ m->splat, SLOT(setValues(const arma::vec &)));
QObject::connect(&projectionObserver, SIGNAL(mapChanged(const arma::vec &)),
- barChart, SLOT(setValues(const arma::vec &)));
+ m->barChart, SLOT(setValues(const arma::vec &)));
//history->addHistoryItem(Ys);
- colormap->setColorScale(colorScale);
- rpPlot->setColorScale(colorScale);
- splat->setColorScale(colorScale);
-
- cpPlot->setColorScale(colorScale);
- cpPlot->setAutoScale(false);
- cpPlot->setColorData(labels(cpIndices), false);
- cpPlot->setXY(Ys, false);
- cpPlot->update();
+ m->setColormapColorScale(Main::ColorScaleContinuous);
+ m->setCPPlotColorScale(Main::ColorScaleContinuous);
+ m->setRPPlotColorScale(Main::ColorScaleContinuous);
+ m->setSplatColorScale(Main::ColorScaleContinuous);
+
+ m->cpPlot->setAutoScale(false);
+ m->cpPlot->setColorData(labels(cpIndices), false);
+ m->cpPlot->setXY(Ys, false);
+ m->cpPlot->update();
auto ret = app.exec();