mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
67 lines
1.6 KiB
C++
67 lines
1.6 KiB
C++
#include "go_to_parameter_controller.h"
|
|
#include <assert.h>
|
|
|
|
namespace Regression {
|
|
|
|
GoToParameterController::GoToParameterController(Responder * parentResponder, Data * data) :
|
|
FloatParameterController(parentResponder),
|
|
m_abscisseCell(EditableTextMenuListCell(&m_selectableTableView, this, m_draftTextBuffer)),
|
|
m_data(data),
|
|
m_xPrediction(true)
|
|
{
|
|
}
|
|
|
|
void GoToParameterController::setXPrediction(bool xPrediction) {
|
|
m_xPrediction = xPrediction;
|
|
}
|
|
|
|
const char * GoToParameterController::title() const {
|
|
if (m_xPrediction) {
|
|
return "Prediction sachant x";
|
|
}
|
|
return "Prediction sachant y";
|
|
}
|
|
|
|
float GoToParameterController::parameterAtIndex(int index) {
|
|
assert(index == 0);
|
|
if (m_xPrediction) {
|
|
return m_data->xCursorPosition();
|
|
}
|
|
return m_data->yCursorPosition();
|
|
}
|
|
|
|
void GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
|
|
assert(parameterIndex == 0);
|
|
if (m_xPrediction) {
|
|
m_data->setCursorPositionAtAbscissa(f);
|
|
} else {
|
|
m_data->setCursorPositionAtOrdinate(f);
|
|
}
|
|
}
|
|
|
|
int GoToParameterController::numberOfRows() {
|
|
return 1;
|
|
};
|
|
|
|
TableViewCell * GoToParameterController::reusableCell(int index) {
|
|
assert(index == 0);
|
|
return &m_abscisseCell;
|
|
}
|
|
|
|
int GoToParameterController::reusableCellCount() {
|
|
return 1;
|
|
}
|
|
|
|
void GoToParameterController::willDisplayCellForIndex(TableViewCell * cell, int index) {
|
|
EditableTextMenuListCell * myCell = (EditableTextMenuListCell *) cell;
|
|
if (m_xPrediction) {
|
|
myCell->setText("x");
|
|
} else {
|
|
myCell->setText("y");
|
|
}
|
|
FloatParameterController::willDisplayCellForIndex(cell, index);
|
|
}
|
|
|
|
|
|
}
|