[apps/shared/cartesian_function] Function symbol depends on its plot type

This commit is contained in:
Ruben Dashyan
2019-07-24 18:02:07 +02:00
committed by Léa Saviot
parent a2dcad069f
commit ee1cdea837
3 changed files with 16 additions and 1 deletions

View File

@@ -78,11 +78,25 @@ int CartesianFunction::derivativeNameWithArgument(char * buffer, size_t bufferSi
return numberOfChars + derivativeSize;
}
CodePoint CartesianFunction::symbol() const {
switch (plotType()) {
case PlotType::Cartesian:
return 'x';
case PlotType::Polar:
return UCodePointGreekSmallLetterTheta;
default:
assert(plotType() == PlotType::Parametric);
return 't';
}
}
CartesianFunction::PlotType CartesianFunction::plotType() const {
return recordData()->plotType();
}
void CartesianFunction::setPlotType(PlotType plotType) {
/* Reset memoized layout. */
m_model.tidy();
return recordData()->setPlotType(plotType);
}

View File

@@ -14,7 +14,7 @@ public:
CartesianFunction(Ion::Storage::Record record = Record()) :
Function(record)
{}
CodePoint symbol() const override { return 'x'; }
CodePoint symbol() const override;
enum class PlotType {
Cartesian = 0,

View File

@@ -32,6 +32,7 @@ static constexpr CodePoint UCodePointRightSystemParenthesis = 0x13; // Used fo
static constexpr CodePoint UCodePointMiddleDot = 0xb7; // ·
static constexpr CodePoint UCodePointMultiplicationSign = 0xd7; // ×
static constexpr CodePoint UCodePointGreekSmallLetterTheta = 0x3b8; // θ
static constexpr CodePoint UCodePointGreekSmallLetterPi = 0x3c0; // π
static constexpr CodePoint UCodePointLatinLetterSmallCapitalE = 0x1d07; // ᴇ
static constexpr CodePoint UCodePointScriptSmallE = 0x212f; //