Units: Add Density to internal schema

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
Przemo Firszt
2015-07-30 13:24:04 +01:00
committed by Yorik van Havre
parent d380187ef3
commit 7d8fb99cea
3 changed files with 201 additions and 152 deletions

View File

@@ -80,6 +80,17 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
factor = 1.0;
}else if (unit == Unit::Density){
if(UnitValue < 0.0001){
unitString = QString::fromLatin1("kg/m^3");
factor = 0.000000001;
}else if(UnitValue < 1.0){
unitString = QString::fromLatin1("kg/cm^3");
factor = 0.001;
}else{
unitString = QString::fromLatin1("kg/mm^3");
factor = 1.0;
}
}else if ((unit == Unit::Pressure) || (unit == Unit::Stress)){
if(UnitValue < 10.0){// Pa is the smallest
unitString = QString::fromLatin1("Pa");