aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index 81498a7..64560d3 100644
--- a/main.cpp
+++ b/main.cpp
@@ -12,12 +12,14 @@
#include "mp.h"
#include "continuouscolorscale.h"
#include "scatterplot.h"
+#include "voronoisplat.h"
#include "historygraph.h"
#include "interactionhandler.h"
#include "selectionhandler.h"
#include "effectivenessobserver.h"
#include "distortionobserver.h"
#include "npdistortion.h"
+#include "skelft.h"
static QObject *mainProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
@@ -155,12 +157,16 @@ int main(int argc, char **argv)
m->setSubsample(Ys);
qmlRegisterType<Scatterplot>("PM", 1, 0, "Scatterplot");
+ qmlRegisterType<VoronoiSplat>("PM", 1, 0, "VoronoiSplat");
qmlRegisterType<HistoryGraph>("PM", 1, 0, "HistoryGraph");
+ qmlRegisterType<InteractionHandler>("PM", 1, 0, "InteractionHandler");
qmlRegisterSingletonType<Main>("PM", 1, 0, "Main", mainProvider);
// Set up multisampling
QSurfaceFormat fmt;
fmt.setSamples(16);
+ fmt.setRenderableType(QSurfaceFormat::OpenGL);
+ fmt.setVersion(4, 5);
QSurfaceFormat::setDefaultFormat(fmt);
QQmlApplicationEngine engine(QUrl("qrc:///main_view.qml"));
@@ -184,6 +190,8 @@ int main(int argc, char **argv)
// subsamplePlot->setColorData(arma::zeros<arma::vec>(subsampleSize));
subsamplePlot->setColorScale(&colorScale);
Scatterplot *plot = engine.rootObjects()[0]->findChild<Scatterplot *>("plot");
+ VoronoiSplat *splat = engine.rootObjects()[0]->findChild<VoronoiSplat *>("splat");
+ skelft2DInitialization(splat->width());
// Keep track of the current subsample (in order to save them later, if requested)
QObject::connect(subsamplePlot, SIGNAL(xyChanged(const arma::mat &)),
@@ -191,15 +199,22 @@ int main(int argc, char **argv)
QObject::connect(subsamplePlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)),
m, SLOT(setSubsample(const arma::mat &)));
- // Update LAMP projection as the subsample is modified
+ // Update projection as the subsample is modified
InteractionHandler interactionHandler(X, sampleIndices);
- interactionHandler.setTechnique(InteractionHandler::TECHNIQUE_LAMP);
+ m->setInteractionHandler(&interactionHandler);
QObject::connect(subsamplePlot, SIGNAL(xyChanged(const arma::mat &)),
&interactionHandler, SLOT(setSubsample(const arma::mat &)));
QObject::connect(subsamplePlot, SIGNAL(xyInteractivelyChanged(const arma::mat &)),
&interactionHandler, SLOT(setSubsample(const arma::mat &)));
QObject::connect(&interactionHandler, SIGNAL(subsampleChanged(const arma::mat &)),
plot, SLOT(setXY(const arma::mat &)));
+ m->setTechnique(InteractionHandler::TECHNIQUE_LAMP);
+
+ // Update splat whenever the main plot is also updated
+ QObject::connect(plot, SIGNAL(xyChanged(const arma::mat &)),
+ splat, SLOT(setPoints(const arma::mat &)));
+ QObject::connect(plot, SIGNAL(colorDataChanged(const arma::vec &)),
+ splat, SLOT(setValues(const arma::vec &)));
// Linking between selections in subsample plot and full dataset plot
SelectionHandler selectionHandler(sampleIndices);
@@ -237,7 +252,11 @@ int main(int argc, char **argv)
subsamplePlot->setXY(Ys);
subsamplePlot->setColorData(labels(sampleIndices));
plot->setColorScale(&colorScale);
+ splat->setColorScale(&colorScale);
plot->setColorData(labels);
- return app.exec();
+ auto ret = app.exec();
+
+ skelft2DDeinitialization();
+ return ret;
}