[apps/shared/cartesian_function] Add static ParameterMessageForPlotType method

This commit is contained in:
Ruben Dashyan
2019-09-05 11:17:43 +02:00
parent 9417a52167
commit c8206d51f2
2 changed files with 13 additions and 9 deletions

View File

@@ -95,15 +95,7 @@ Poincare::Expression CartesianFunction::expressionReduced(Poincare::Context * co
}
I18n::Message CartesianFunction::parameterMessageName() const {
PlotType type = plotType();
if (type == PlotType::Cartesian) {
return I18n::Message::X;
}
if (type == PlotType::Polar) {
return I18n::Message::Theta;
}
assert(plotType() == PlotType::Parametric);
return I18n::Message::T;
return ParameterMessageForPlotType(plotType());
}
CodePoint CartesianFunction::symbol() const {
@@ -161,6 +153,17 @@ void CartesianFunction::setPlotType(PlotType newPlotType) {
}
}
I18n::Message CartesianFunction::ParameterMessageForPlotType(PlotType plotType) {
if (plotType == PlotType::Cartesian) {
return I18n::Message::X;
}
if (plotType == PlotType::Polar) {
return I18n::Message::Theta;
}
assert(plotType == PlotType::Parametric);
return I18n::Message::T;
}
template <typename T>
Poincare::Coordinate2D<T> CartesianFunction::privateEvaluateXYAtParameter(T t, Poincare::Context * context) const {
Coordinate2D<T> x1x2 = templatedApproximateAtParameter(t, context);