Skip to content

Commit

Permalink
part 4
Browse files Browse the repository at this point in the history
  • Loading branch information
KuzemkoA committed May 29, 2024
1 parent c1a91fe commit acc7253
Show file tree
Hide file tree
Showing 60 changed files with 582 additions and 582 deletions.
14 changes: 7 additions & 7 deletions src/Base/UnitsSchemaCentimeters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@ QString UnitsSchemaCentimeters::schemaTranslate(const Base::Quantity& quant,
Unit unit = quant.getUnit();
if (unit == Unit::Length) {
// all length units in centimeters
unitString = QString::fromLatin1("cm");
unitString = QLatin1String("cm");
factor = 10.0;
}
else if (unit == Unit::Area) {
// all area units in square meters
unitString = QString::fromLatin1("m^2");
unitString = QLatin1String("m^2");
factor = 1000000.0;
}
else if (unit == Unit::Volume) {
// all area units in cubic meters
unitString = QString::fromLatin1("m^3");
unitString = QLatin1String("m^3");
factor = 1000000000.0;
}
else if (unit == Unit::Power) {
unitString = QString::fromLatin1("W");
unitString = QLatin1String("W");
factor = 1000000;
}
else if (unit == Unit::ElectricPotential) {
unitString = QString::fromLatin1("V");
unitString = QLatin1String("V");
factor = 1000000;
}
else if (unit == Unit::HeatFlux) {
unitString = QString::fromLatin1("W/m^2");
unitString = QLatin1String("W/m^2");
factor = 1.0;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("mm/min");
unitString = QLatin1String("mm/min");
factor = 1.0 / 60;
}
else {
Expand Down
4 changes: 2 additions & 2 deletions src/Base/UnitsSchemaFemMilliMeterNewton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ QString UnitsSchemaFemMilliMeterNewton::schemaTranslate(const Quantity& quant,
Unit unit = quant.getUnit();
if (unit == Unit::Length) {
// all length units in millimeters
unitString = QString::fromLatin1("mm");
unitString = QLatin1String("mm");
factor = 1.0;
}
else if (unit == Unit::Mass) {
// all mass units in t
unitString = QString::fromUtf8("t");
unitString = QLatin1String("t");
factor = 1e3;
}
else {
Expand Down
68 changes: 34 additions & 34 deletions src/Base/UnitsSchemaImperial1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,31 @@ UnitsSchemaImperial1::schemaTranslate(const Quantity& quant, double& factor, QSt
// 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");
unitString = QLatin1String("in");
factor = 25.4;
}
else if (UnitValue < 2.54) { // smaller then 0.1 inch -> Thou (mil)
unitString = QString::fromLatin1("thou");
unitString = QLatin1String("thou");
factor = 0.0254;
}
else if (UnitValue < 304.8) {
unitString = QString::fromLatin1("\"");
unitString = QLatin1String("\"");
factor = 25.4;
}
else if (UnitValue < 914.4) {
unitString = QString::fromLatin1("\'");
unitString = QLatin1String("\'");
factor = 304.8;
}
else if (UnitValue < 1609344.0) {
unitString = QString::fromLatin1("yd");
unitString = QLatin1String("yd");
factor = 914.4;
}
else if (UnitValue < 1609344000.0) {
unitString = QString::fromLatin1("mi");
unitString = QLatin1String("mi");
factor = 1609344.0;
}
else { // bigger then 1000 mi -> scientific notation
unitString = QString::fromLatin1("in");
unitString = QLatin1String("in");
factor = 25.4;
}
}
Expand All @@ -84,41 +84,41 @@ UnitsSchemaImperial1::schemaTranslate(const Quantity& quant, double& factor, QSt
else if (unit == Unit::Area) {
// TODO: Cascade for the Areas
// default action for all cases without special treatment:
unitString = QString::fromLatin1("in^2");
unitString = QLatin1String("in^2");
factor = 645.16;
}
else if (unit == Unit::Volume) {
// TODO: Cascade for the Volume
// default action for all cases without special treatment:
unitString = QString::fromLatin1("in^3");
unitString = QLatin1String("in^3");
factor = 16387.064;
}
else if (unit == Unit::Mass) {
// TODO: Cascade for the weights
// default action for all cases without special treatment:
unitString = QString::fromLatin1("lb");
unitString = QLatin1String("lb");
factor = 0.45359237;
}
else if (unit == Unit::Pressure) {
if (UnitValue < 6894.744) { // psi is the smallest
unitString = QString::fromLatin1("psi");
unitString = QLatin1String("psi");
factor = 6.894744825494;
}
else if (UnitValue < 6894744.825) {
unitString = QString::fromLatin1("ksi");
unitString = QLatin1String("ksi");
factor = 6894.744825494;
}
else { // bigger then 1000 ksi -> psi + scientific notation
unitString = QString::fromLatin1("psi");
unitString = QLatin1String("psi");
factor = 6.894744825494;
}
}
else if (unit == Unit::Stiffness) { // Conversion to lbf/in
unitString = QString::fromLatin1("lbf/in");
unitString = QLatin1String("lbf/in");
factor = 4.448222 / 0.0254;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("in/min");
unitString = QLatin1String("in/min");
factor = 25.4 / 60;
}
else {
Expand All @@ -141,7 +141,7 @@ QString UnitsSchemaImperialDecimal::schemaTranslate(const Base::Quantity& quant,

// now do special treatment on all cases seems necessary:
if (unit == Unit::Length) { // Length handling ============================
unitString = QString::fromLatin1("in");
unitString = QLatin1String("in");
factor = 25.4;
}
else if (unit == Unit::Angle) {
Expand All @@ -151,35 +151,35 @@ QString UnitsSchemaImperialDecimal::schemaTranslate(const Base::Quantity& quant,
else if (unit == Unit::Area) {
// TODO: Cascade for the Areas
// default action for all cases without special treatment:
unitString = QString::fromLatin1("in^2");
unitString = QLatin1String("in^2");
factor = 645.16;
}
else if (unit == Unit::Volume) {
// TODO: Cascade for the Volume
// default action for all cases without special treatment:
unitString = QString::fromLatin1("in^3");
unitString = QLatin1String("in^3");
factor = 16387.064;
}
else if (unit == Unit::Mass) {
// TODO: Cascade for the weights
// default action for all cases without special treatment:
unitString = QString::fromLatin1("lb");
unitString = QLatin1String("lb");
factor = 0.45359237;
}
else if (unit == Unit::Pressure) {
unitString = QString::fromLatin1("psi");
unitString = QLatin1String("psi");
factor = 6.894744825494;
}
else if (unit == Unit::Stiffness) {
unitString = QString::fromLatin1("lbf/in");
unitString = QLatin1String("lbf/in");
factor = 4.448222 / 0.0254;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("in/min");
unitString = QLatin1String("in/min");
factor = 25.4 / 60;
}
else if (unit == Unit::Acceleration) {
unitString = QString::fromLatin1("in/min^2");
unitString = QLatin1String("in/min^2");
factor = 25.4 / 3600;
}
else {
Expand All @@ -199,7 +199,7 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity& quant,
// ex: 3'- 4 1/4" with proper rounding
Unit unit = quant.getUnit();
if (unit == Unit::Length) {
unitString = QString::fromLatin1("in");
unitString = QLatin1String("in");
factor = 25.4;

// Total number of inches to format
Expand Down Expand Up @@ -227,7 +227,7 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity& quant,

// If this is zero, nothing to do but return
if (ntot == 0) {
return QString::fromLatin1("0");
return QLatin1String("0");
}

// Compute the whole number of feet and remaining units
Expand Down Expand Up @@ -300,15 +300,15 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity& quant,
factor = 1.0;
}
else if (unit == Unit::Area) {
unitString = QString::fromLatin1("sqft");
unitString = QLatin1String("sqft");
factor = 92903.04;
}
else if (unit == Unit::Volume) {
unitString = QString::fromLatin1("cft");
unitString = QLatin1String("cft");
factor = 28316846.592;
}
else if (unit == Unit::Velocity) {
unitString = QString::fromLatin1("in/min");
unitString = QLatin1String("in/min");
factor = 25.4 / 60;
}
else {
Expand All @@ -330,27 +330,27 @@ QString UnitsSchemaImperialCivil::schemaTranslate(const Base::Quantity& quant,

// now do special treatment on all cases seems necessary:
if (unit == Unit::Length) { // Length handling ============================
unitString = QString::fromLatin1("ft"); // always ft
unitString = QLatin1String("ft"); // always ft
factor = 304.8; // 12 * 25.4
}
else if (unit == Unit::Area) {
unitString = QString::fromLatin1("ft^2"); // always sq.ft
unitString = QLatin1String("ft^2"); // always sq.ft
factor = 92903.04;
}
else if (unit == Unit::Volume) {
unitString = QString::fromLatin1("ft^3"); // always cu. ft
unitString = QLatin1String("ft^3"); // always cu. ft
factor = 28316846.592;
}
else if (unit == Unit::Mass) {
unitString = QString::fromLatin1("lb"); // always lbs.
unitString = QLatin1String("lb"); // always lbs.
factor = 0.45359237;
}
else if (unit == Unit::Pressure) {
unitString = QString::fromLatin1("psi");
unitString = QLatin1String("psi");
factor = 6.894744825494;
}
else if (unit == Unit::Stiffness) {
unitString = QString::fromLatin1("lbf/in");
unitString = QLatin1String("lbf/in");
factor = 4.448222 / 0.0254;
}
else if (unit == Unit::Velocity) {
Expand Down
Loading

0 comments on commit acc7253

Please sign in to comment.