[apps/shared/values_controller] Move evaluationOfAbscissaAtColumn impl to Sequence

And remove TODO
This commit is contained in:
Ruben Dashyan
2019-09-05 17:52:16 +02:00
parent f579010340
commit ae7d60d7c2
4 changed files with 8 additions and 9 deletions

View File

@@ -63,6 +63,12 @@ bool ValuesController::setDataAtLocation(double floatBody, int columnIndex, int
return Shared::ValuesController::setDataAtLocation(std::round(floatBody), columnIndex, rowIndex);
}
double ValuesController::evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) {
ExpiringPointer<Function> function = functionStore()->modelForRecord(recordAtColumn(columnIndex));
Poincare::Coordinate2D<double> xy = function->evaluateXYAtParameter(abscissa, textFieldDelegateApp()->localContext());
return xy.x2();
}
Shared::Interval * ValuesController::intervalAtColumn(int columnIndex) {
return App::app()->interval();
}

View File

@@ -22,6 +22,7 @@ public:
private:
void setStartEndMessages(Shared::IntervalParameterController * controller, int column) override;
bool setDataAtLocation(double floatBody, int columnIndex, int rowIndex) override;
double evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) override;
Shared::Interval * intervalAtColumn(int columnIndex) override;
I18n::Message valuesParameterMessageAtColumn(int columnIndex) const override;
int maxNumberOfCells() override { return k_maxNumberOfCells; }

View File

@@ -250,14 +250,6 @@ int ValuesController::numberOfElementsInColumn(int columnIndex) {
return intervalAtColumn(columnIndex)->numberOfElements();
}
double ValuesController::evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) {
ExpiringPointer<Function> function = functionStore()->modelForRecord(recordAtColumn(columnIndex));
//TODO LEA RUBEN Careful with merge
//TODO LEA RUBEN change with evaluationOfParameterAtColumn? evaluate2DAtParameter ?
Poincare::Coordinate2D<double> xy = function->evaluateXYAtParameter(abscissa, textFieldDelegateApp()->localContext());
return xy.x2();
}
void ValuesController::updateNumberOfColumns() {
m_numberOfColumns = 1+functionStore()->numberOfActiveFunctions();
}

View File

@@ -61,12 +61,12 @@ private:
Responder * tabController() const override;
bool cellAtLocationIsEditable(int columnIndex, int rowIndex) override;
double dataAtLocation(int columnIndex, int rowIndex) override;
virtual double evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) = 0;
virtual Interval * intervalAtColumn(int columnIndex) = 0;
virtual I18n::Message valuesParameterMessageAtColumn(int columnIndex) const = 0;
int maxNumberOfElements() const override {
return Interval::k_maxNumberOfElements;
};
virtual double evaluationOfAbscissaAtColumn(double abscissa, int columnIndex);
virtual int maxNumberOfCells() = 0;
virtual int maxNumberOfFunctions() = 0;
virtual FunctionTitleCell * functionTitleCells(int j) = 0;