mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/graph/graph] Define PreimageParameterController class
This commit is contained in:
committed by
Émilie Feral
parent
e0774cba4b
commit
23fd28b3b4
@@ -13,6 +13,7 @@ app_src += $(addprefix apps/graph/,\
|
||||
graph/graph_controller_helper.cpp \
|
||||
graph/graph_view.cpp \
|
||||
graph/preimage_graph_controller.cpp\
|
||||
graph/preimage_parameter_controller.cpp\
|
||||
graph/integral_graph_controller.cpp \
|
||||
graph/intersection_graph_controller.cpp \
|
||||
graph/root_graph_controller.cpp \
|
||||
|
||||
53
apps/graph/graph/preimage_parameter_controller.cpp
Normal file
53
apps/graph/graph/preimage_parameter_controller.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "preimage_parameter_controller.h"
|
||||
#include "../app.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Graph {
|
||||
|
||||
PreimageParameterController::PreimageParameterController(
|
||||
Responder * parentResponder,
|
||||
InputEventHandlerDelegate * inputEventHandlerDelegate,
|
||||
Shared::InteractiveCurveViewRange * graphRange,
|
||||
Shared::CurveViewCursor * cursor,
|
||||
PreimageGraphController * preimageGraphController
|
||||
) :
|
||||
Shared::GoToParameterController(
|
||||
parentResponder,
|
||||
inputEventHandlerDelegate,
|
||||
graphRange,
|
||||
cursor,
|
||||
I18n::Message::Y
|
||||
),
|
||||
m_preimageGraphController(preimageGraphController)
|
||||
{
|
||||
}
|
||||
|
||||
const char * PreimageParameterController::title() {
|
||||
return I18n::translate(I18n::Message::Preimage);
|
||||
}
|
||||
|
||||
void PreimageParameterController::viewWillAppear() {
|
||||
m_preimageGraphController->setImage(m_cursor->y());
|
||||
Shared::GoToParameterController::viewWillAppear();
|
||||
}
|
||||
|
||||
void PreimageParameterController::buttonAction() {
|
||||
m_preimageGraphController->setRecord(m_record);
|
||||
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
|
||||
stack->pop();
|
||||
stack->pop();
|
||||
stack->pop();
|
||||
stack->push(m_preimageGraphController);
|
||||
}
|
||||
|
||||
double PreimageParameterController::parameterAtIndex(int index) {
|
||||
assert(index == 0);
|
||||
return m_preimageGraphController->image();
|
||||
}
|
||||
bool PreimageParameterController::setParameterAtIndex(int parameterIndex, double f) {
|
||||
assert(parameterIndex == 0);
|
||||
m_preimageGraphController->setImage(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
31
apps/graph/graph/preimage_parameter_controller.h
Normal file
31
apps/graph/graph/preimage_parameter_controller.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef GRAPH_PREIMAGE_PARAMETER_CONTROLLER
|
||||
#define GRAPH_PREIMAGE_PARAMETER_CONTROLLER
|
||||
|
||||
#include "../../shared/go_to_parameter_controller.h"
|
||||
#include "preimage_graph_controller.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class PreimageParameterController : public Shared::GoToParameterController {
|
||||
public:
|
||||
PreimageParameterController(
|
||||
Responder * parentResponder,
|
||||
InputEventHandlerDelegate * inputEventHandlerDelegate,
|
||||
Shared::InteractiveCurveViewRange * graphRange,
|
||||
Shared::CurveViewCursor * cursor,
|
||||
PreimageGraphController * preimageGraphController
|
||||
);
|
||||
const char * title() override;
|
||||
void setRecord(Ion::Storage::Record record) { m_record = record; }
|
||||
void viewWillAppear() override;
|
||||
private:
|
||||
void buttonAction() override;
|
||||
double parameterAtIndex(int index) override;
|
||||
bool setParameterAtIndex(int parameterIndex, double f) override;
|
||||
Ion::Storage::Record m_record;
|
||||
PreimageGraphController * m_preimageGraphController;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user