[apps] Display float in decimal mode in curve views and title

Change-Id: I3c069f3e001b43c98d4c54975b02636dad330acf
This commit is contained in:
Émilie Feral
2016-12-29 13:20:02 +01:00
parent b395680cc7
commit ff3d8dce5a
2 changed files with 4 additions and 4 deletions

View File

@@ -71,11 +71,11 @@ int CurveView::numberOfLabels(Axis axis) const {
}
void CurveView::computeLabels(Axis axis) {
char buffer[Constant::FloatBufferSizeInScientificMode];
char buffer[Constant::FloatBufferSizeInDecimalMode];
float step = gridUnit(axis);
for (int index = 0; index < numberOfLabels(axis); index++) {
// TODO: change the number of digits in mantissa once the numerical mode is implemented
Float(2.0f*step*(ceilf(min(axis)/(2.0f*step)))+index*2.0f*step).convertFloatToText(buffer, Constant::FloatBufferSizeInScientificMode, Constant::NumberOfDigitsInMantissaInScientificMode);
Float(2.0f*step*(ceilf(min(axis)/(2.0f*step)))+index*2.0f*step).convertFloatToText(buffer, Constant::FloatBufferSizeInDecimalMode, Constant::NumberOfDigitsInMantissaInDecimalMode, Float::DisplayMode::Decimal);
//TODO: check for size of label?
strlcpy(label(axis, index), buffer, strlen(buffer)+1);
}

View File

@@ -106,8 +106,8 @@ void ParametersController::updateTitle() {
m_titleBuffer[currentChar++] = m_law->parameterNameAtIndex(index)[0];
strlcpy(m_titleBuffer+currentChar, " = ", 4);
currentChar += 3;
char buffer[Constant::FloatBufferSizeInScientificMode];
Float(m_law->parameterValueAtIndex(index)).convertFloatToText(buffer, Constant::FloatBufferSizeInScientificMode, Constant::NumberOfDigitsInMantissaInScientificMode);
char buffer[Constant::FloatBufferSizeInDecimalMode];
Float(m_law->parameterValueAtIndex(index)).convertFloatToText(buffer, Constant::FloatBufferSizeInDecimalMode, Constant::NumberOfDigitsInMantissaInDecimalMode, Float::DisplayMode::Decimal);
strlcpy(m_titleBuffer+currentChar, buffer, strlen(buffer)+1);
currentChar += strlen(buffer);
m_titleBuffer[currentChar++] = ' ';