diff --git a/apps/shared/cartesian_function.cpp b/apps/shared/cartesian_function.cpp index 1196cdf29..70ec010d5 100644 --- a/apps/shared/cartesian_function.cpp +++ b/apps/shared/cartesian_function.cpp @@ -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 Poincare::Coordinate2D CartesianFunction::privateEvaluateXYAtParameter(T t, Poincare::Context * context) const { Coordinate2D x1x2 = templatedApproximateAtParameter(t, context); diff --git a/apps/shared/cartesian_function.h b/apps/shared/cartesian_function.h index 786b1c9fc..d0b9e5b8a 100644 --- a/apps/shared/cartesian_function.h +++ b/apps/shared/cartesian_function.h @@ -27,6 +27,7 @@ public: }; PlotType plotType() const; void setPlotType(PlotType plotType); + static I18n::Message ParameterMessageForPlotType(PlotType plotType); // Evaluation Poincare::Coordinate2D evaluate2DAtParameter(double t, Poincare::Context * context) const {