[apps/graph/graph] Define PreimageGraphController class

This commit is contained in:
Ruben Dashyan
2019-04-02 11:31:35 +02:00
committed by Émilie Feral
parent ab108bbd2c
commit e0774cba4b
3 changed files with 52 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ app_src += $(addprefix apps/graph/,\
graph/graph_controller.cpp \
graph/graph_controller_helper.cpp \
graph/graph_view.cpp \
graph/preimage_graph_controller.cpp\
graph/integral_graph_controller.cpp \
graph/intersection_graph_controller.cpp \
graph/root_graph_controller.cpp \

View File

@@ -0,0 +1,29 @@
#include "preimage_graph_controller.h"
namespace Graph {
PreimageGraphController::PreimageGraphController(
Responder * parentResponder,
GraphView * graphView,
BannerView * bannerView,
Shared::InteractiveCurveViewRange * curveViewRange,
Shared::CurveViewCursor * cursor
) :
CalculationGraphController(
parentResponder,
graphView,
bannerView,
curveViewRange,
cursor,
I18n::Message::NoPreimageFound
),
m_image(NAN)
{
}
Poincare::Expression::Coordinate2D PreimageGraphController::computeNewPointOfInterest(double start, double step, double max, Poincare::Context * context) {
Poincare::Expression expression = Poincare::Float<double>::Builder(m_image);
return functionStore()->modelForRecord(m_record)->nextIntersectionFrom(start, step, max, context, expression);
}
}

View File

@@ -0,0 +1,22 @@
#include "calculation_graph_controller.h"
namespace Graph {
class PreimageGraphController : public CalculationGraphController {
public:
PreimageGraphController(
Responder * parentResponder,
GraphView * graphView,
BannerView * bannerView,
Shared::InteractiveCurveViewRange * curveViewRange,
Shared::CurveViewCursor * cursor
);
const char * title() override { return I18n::translate(I18n::Message::Preimage); }
double image() { return m_image; }
void setImage(double value) { m_image = value; }
private:
Poincare::Expression::Coordinate2D computeNewPointOfInterest(double start, double step, double max, Poincare::Context * context) override;
double m_image;
};
}