Units: extend parser to accept mph, sqft and cft. Fix a bug in imperial civil schema
This commit is contained in:
@@ -290,6 +290,10 @@ Quantity Quantity::Thou (0.0254 ,Unit(1));
|
||||
Quantity Quantity::Yard (914.4 ,Unit(1));
|
||||
Quantity Quantity::Mile (1609344.0 ,Unit(1));
|
||||
|
||||
Quantity Quantity::MilePerHour (447.04 ,Unit(1,0,-1));
|
||||
Quantity Quantity::SquareFoot (92903.04 ,Unit(2));
|
||||
Quantity Quantity::CubicFoot (28316846.592 ,Unit(3));
|
||||
|
||||
Quantity Quantity::Pound (0.45359237 ,Unit(0,1));
|
||||
Quantity Quantity::Ounce (0.0283495231 ,Unit(0,1));
|
||||
Quantity Quantity::Stone (6.35029318 ,Unit(0,1));
|
||||
|
||||
@@ -232,6 +232,10 @@ public:
|
||||
static Quantity Hundredweights;
|
||||
static Quantity Mile;
|
||||
|
||||
static Quantity MilePerHour;
|
||||
static Quantity SquareFoot;
|
||||
static Quantity CubicFoot;
|
||||
|
||||
static Quantity PoundForce;
|
||||
|
||||
static Quantity Newton;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -101,6 +101,9 @@ CGRP '\,'[0-9][0-9][0-9]
|
||||
"mil" yylval = Quantity::Thou; return UNIT; // mil (the thou in US)
|
||||
"yd" yylval = Quantity::Yard; return UNIT; // yard
|
||||
"mi" yylval = Quantity::Mile; return UNIT; // mile
|
||||
"mph" yylval = Quantity::MilePerHour; return UNIT; // mile per hour
|
||||
"sqft" yylval = Quantity::SquareFoot; return UNIT; // square foot
|
||||
"cft" yylval = Quantity::CubicFoot; return UNIT; // cubic foot
|
||||
|
||||
"lb" yylval = Quantity::Pound; return UNIT; // pound
|
||||
"lbm" yylval = Quantity::Pound; return UNIT; // pound
|
||||
|
||||
@@ -298,7 +298,7 @@ QString UnitsSchemaImperialBuilding::schemaTranslate(const Quantity &quant, doub
|
||||
factor = 92903.04;
|
||||
}
|
||||
else if (unit == Unit::Volume) {
|
||||
unitString = QString::fromLatin1("cuft");
|
||||
unitString = QString::fromLatin1("cft");
|
||||
factor = 28316846.592;
|
||||
}
|
||||
else if (unit == Unit::Velocity) {
|
||||
@@ -343,7 +343,7 @@ QString UnitsSchemaImperialCivil::schemaTranslate(const Base::Quantity& quant, d
|
||||
}
|
||||
else if (unit == Unit::Velocity) {
|
||||
unitString = QString::fromLatin1("mph");
|
||||
factor = 0.002235598; //1mm/sec => mph
|
||||
factor = 447.04; //1mm/sec => mph
|
||||
}
|
||||
// this schema expresses angles in degrees + minutes + seconds
|
||||
else if (unit == Unit::Angle) {
|
||||
|
||||
Reference in New Issue
Block a user