[TD] Refactor DrawViewDimension getFormatedValue() into two functions.

This commit is contained in:
Aapo
2020-11-27 16:33:10 +02:00
committed by wwmayer
parent 292a711922
commit e7b4d9ed99
5 changed files with 25 additions and 17 deletions

View File

@@ -530,23 +530,17 @@ bool DrawViewDimension::isMultiValueSchema(void) const
return result;
}
std::string DrawViewDimension::getFormatedValue(int partial)
std::string DrawViewDimension::formatValue(qreal value, QString qFormatSpec, int partial)
{
// Base::Console().Message("DVD::getFormatedValue(%d)\n", partial);
std::string result;
if (Arbitrary.getValue()) {
return FormatSpec.getStrValue();
}
bool multiValueSchema = false;
QString qFormatSpec = QString::fromUtf8(FormatSpec.getStrValue().data(),FormatSpec.getStrValue().size());
double val = getDimValue();
QString qUserStringUnits;
QString formattedValue;
bool angularMeasure = false;
Base::Quantity asQuantity;
asQuantity.setValue(val);
asQuantity.setValue(value);
if ( (Type.isValue("Angle")) ||
(Type.isValue("Angle3Pt")) ) {
angularMeasure = true;
@@ -686,8 +680,20 @@ std::string DrawViewDimension::getFormatedValue(int partial)
}
return result;
}
std::string DrawViewDimension::getFormattedDimensionValue(int partial)
{
// Base::Console().Message("DVD::getFormattedValue(%d)\n", partial);
QString qFormatSpec = QString::fromUtf8(FormatSpec.getStrValue().data(),FormatSpec.getStrValue().size());
if (Arbitrary.getValue()) {
return FormatSpec.getStrValue();
}
return formatValue(getDimValue(), qFormatSpec, partial);
}
QStringList DrawViewDimension::getPrefixSuffixSpec(QString fSpec)
{