From 529a06131d6da8e0c9ec78e74b18a0bb618ff031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 19 Oct 2016 16:01:14 +0200 Subject: [PATCH] [apps/graph] Add a boolean in function to indicate wheter to display derivative Change-Id: I0565de1645952007347cf3aee5f1a70f8280e0f3 --- apps/graph/function.cpp | 11 ++++++++++- apps/graph/function.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/graph/function.cpp b/apps/graph/function.cpp index b5c8e7d18..95ac5065f 100644 --- a/apps/graph/function.cpp +++ b/apps/graph/function.cpp @@ -8,7 +8,8 @@ Function::Function(const char * text, KDColor color) : m_color(color), m_expression(nullptr), m_layout(nullptr), - m_active(true) + m_active(true), + m_displayDerivative(false) { } @@ -57,10 +58,18 @@ bool Function::isActive() { return m_active; } +bool Function::displayDerivative() { + return m_displayDerivative; +} + void Function::setActive(bool active) { m_active = active; } +void Function::setDisplayDerivative(bool display) { + m_displayDerivative = display; +} + float Function::evaluateAtAbscissa(float x, EvaluateContext * context) const { context->setOverridenValueForSymbolX(x); return m_expression->approximate(*context); diff --git a/apps/graph/function.h b/apps/graph/function.h index 44c1252f5..56bab2ebe 100644 --- a/apps/graph/function.h +++ b/apps/graph/function.h @@ -20,6 +20,8 @@ public: ExpressionLayout * layout(); bool isActive(); void setActive(bool active); + bool displayDerivative(); + void setDisplayDerivative(bool display); void setContent(const char * c); void setColor(KDColor m_color); float evaluateAtAbscissa(float x, EvaluateContext * context) const; @@ -33,6 +35,7 @@ private: Expression * m_expression; ExpressionLayout * m_layout; bool m_active; + bool m_displayDerivative; }; }