summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2020-04-24 22:23:36 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2020-04-24 22:23:36 +0200
commite834521b276eda5cff3e422b0372bb1a66e0b98a (patch)
treea1a4daf7b02bccf6610a348b9179b25441f92ed2
parente4cee6593e08470342dc1b79d675c2d3845410ec (diff)
Add the spline nodes to the UI.
-rw-r--r--plugingui/powerwidget.cc9
-rw-r--r--src/powermap.cc15
-rw-r--r--src/powermap.h4
3 files changed, 28 insertions, 0 deletions
diff --git a/plugingui/powerwidget.cc b/plugingui/powerwidget.cc
index 1cecafc..e459503 100644
--- a/plugingui/powerwidget.cc
+++ b/plugingui/powerwidget.cc
@@ -181,6 +181,15 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent)
// p.setColour(c);
// p.drawFilledRectangle(0, 0, width(), height());
+ // draw the fixed nodes of the spline
+ p.setColour(GUI::Colour{0.f, 0.7f, .5f, 1.f});
+ p.drawFilledCircle(
+ power_map.getFixed0().in*width(), height() - power_map.getFixed0().out*height(), 3);
+ p.drawFilledCircle(
+ power_map.getFixed1().in*width(), height() - power_map.getFixed1().out*height(), 3);
+ p.drawFilledCircle(
+ power_map.getFixed2().in*width(), height() - power_map.getFixed2().out*height(), 3);
+
if(enabled)
{
// enabled green
diff --git a/src/powermap.cc b/src/powermap.cc
index 6ffb74f..db1eafc 100644
--- a/src/powermap.cc
+++ b/src/powermap.cc
@@ -123,6 +123,21 @@ void Powermap::setShelf(bool enable)
}
}
+PowerPair Powermap::getFixed0() const
+{
+ return fixed[0];
+}
+
+PowerPair Powermap::getFixed1() const
+{
+ return fixed[1];
+}
+
+PowerPair Powermap::getFixed2() const
+{
+ return fixed[2];
+}
+
// This mostly followes the wikipedia article for monotone cubic splines:
// https://en.wikipedia.org/wiki/Monotone_cubic_interpolation
void Powermap::updateSpline()
diff --git a/src/powermap.h b/src/powermap.h
index 589573f..aa4cbfc 100644
--- a/src/powermap.h
+++ b/src/powermap.h
@@ -53,6 +53,10 @@ public:
void setFixed2(PowerPair new_value);
void setShelf(bool enable);
+ PowerPair getFixed0() const;
+ PowerPair getFixed1() const;
+ PowerPair getFixed2() const;
+
private:
// input parameters (state of this class)
std::array<PowerPair, 3> fixed;