aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-03-02 15:47:24 -0300
committerSamuel Fadel <samuelfadel@gmail.com>2016-03-02 15:47:24 -0300
commit3ce49858c6859fccc2e4d35839c34685348790d1 (patch)
tree9919729ae2d094ab3bed9fb45184c027713d9127 /main.cpp
parent00efaedf4e328604598975a07a497d1ce769bb19 (diff)
Improvements related to ColorScale and screenshots.
* ColorScale: now a pointer whenever needed. main() takes care of updating extents * New class DivergentColorScale: works specifically for divergent scales, always has 3 colors as input: negative values, 0, positive values * ManipulationHandler: ProjectionHistory no longer needed
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index 235f036..3417534 100644
--- a/main.cpp
+++ b/main.cpp
@@ -170,7 +170,7 @@ int main(int argc, char **argv)
// Update projection as the cp are modified (either directly in the
// manipulationHandler object or interactively in cpPlot
- ManipulationHandler manipulationHandler(X, cpIndices, m->projectionHistory);
+ ManipulationHandler manipulationHandler(X, cpIndices);
QObject::connect(m->cpPlot, &Scatterplot::xyInteractivelyChanged,
&manipulationHandler, &ManipulationHandler::setCP);
@@ -237,6 +237,33 @@ int main(int argc, char **argv)
m->rpBarChart, &BarChart::brushItem);
// Update visual components whenever values change
+ QObject::connect(m->projectionHistory, &ProjectionHistory::rpValuesChanged,
+ [m](const arma::vec &v, bool rescale) {
+ ColorScale *ptr = m->colorScaleRPs.get();
+ if (!ptr || v.n_elem == 0) {
+ return;
+ }
+
+ if (rescale) {
+ ptr->setExtents(v.min(), v.max());
+ } else {
+ ptr->setExtents(std::min(ptr->min(), (float) v.min()),
+ std::max(ptr->max(), (float) v.max()));
+ }
+
+ m->splat->setColorScale(ptr);
+ m->rpColormap->setColorScale(ptr);
+ });
+ QObject::connect(m->projectionHistory, &ProjectionHistory::cpValuesChanged,
+ [m](const arma::vec &v) {
+ ColorScale *ptr = m->colorScaleCPs.get();
+ if (!ptr || v.n_elem == 0) {
+ return;
+ }
+
+ ptr->setExtents(v.min(), v.max());
+ m->cpColormap->setColorScale(ptr);
+ });
QObject::connect(m->projectionHistory, &ProjectionHistory::cpValuesChanged,
m->cpPlot, &Scatterplot::setColorData);
QObject::connect(m->projectionHistory, &ProjectionHistory::rpValuesChanged,