PVS: The 'then' statement is equivalent to the 'else' statement.

This commit is contained in:
wmayer
2019-02-17 19:52:35 +01:00
parent 67020fffef
commit 493a144080

View File

@@ -144,24 +144,15 @@ QString UnitsSchemaImperial1::schemaTranslate(const Quantity &quant, double &fac
QString UnitsSchemaImperialDecimal::schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString)
{
double UnitValue = std::abs(quant.getValue());
//double UnitValue = std::abs(quant.getValue());
Unit unit = quant.getUnit();
// for imperial user/programmer mind; UnitValue is in internal system, that means
// mm/kg/s. And all combined units have to be calculated from there!
// now do special treatment on all cases seems necessary:
if (unit == Unit::Length) { // Length handling ============================
if (UnitValue < 0.00000254) {// smaller then 0.001 thou -> inch and scientific notation
unitString = QString::fromLatin1("in");
factor = 25.4;
//}else if(UnitValue < 2.54){ // smaller then 0.1 inch -> Thou (mil)
// unitString = QString::fromLatin1("thou");
// factor = 0.0254;
}
else { // bigger then 1000 mi -> scientific notation
unitString = QString::fromLatin1("in");
factor = 25.4;
}
unitString = QString::fromLatin1("in");
factor = 25.4;
}
else if (unit == Unit::Area) {
// TODO Cascade for the Areas
@@ -182,14 +173,8 @@ QString UnitsSchemaImperialDecimal::schemaTranslate(const Base::Quantity& quant,
factor = 0.45359237;
}
else if (unit == Unit::Pressure) {
if (UnitValue < 6894.744) {// psi is the smallest
unitString = QString::fromLatin1("psi");
factor = 6.894744825494;
}
else { // bigger then 1000 ksi -> psi + scientific notation
unitString = QString::fromLatin1("psi");
factor = 6.894744825494;
}
unitString = QString::fromLatin1("psi");
factor = 6.894744825494;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("in/min");