some fixes in quantity

This commit is contained in:
jriegel 2013-12-06 23:25:19 +01:00
parent 83e63a67b1
commit 75216d9d8c
3 changed files with 13 additions and 4 deletions

View File

@ -76,7 +76,7 @@ ID [a-z][a-z0-9]*
"'" yylval = Quantity::Foot; return UNIT; // foot
"thou" yylval = Quantity::Thou; return UNIT; // thou (in/1000)
"mil" yylval = Quantity::Thou; return UNIT; // mil (the thou in US)
"yr" yylval = Quantity::Yard; return UNIT; // yard
"yd" yylval = Quantity::Yard; return UNIT; // yard
"mi" yylval = Quantity::Mile; return UNIT; // mile

View File

@ -82,8 +82,17 @@ PyObject* QuantityPy::pow(PyObject * args)
PyObject* QuantityPy::getUserPrefered(PyObject *args)
{
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
return 0;
QString uus;
double factor;
Py::Tuple res(3);
QString uss = getQuantityPtr()->getUserString(factor,uus);
res[0] = Py::String(uss.toLatin1());
res[1] = Py::Float(factor);
res[2] = Py::String(uus.toLatin1());
return Py::new_reference_to(res);
}
PyObject* QuantityPy::getValueAs(PyObject *args)

View File

@ -55,7 +55,7 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor
factor = 1.0;
}else if(UnitValue < 10000000.0){
unitString = QString::fromLatin1("m");
factor = 10000.0;
factor = 1000.0;
}else if(UnitValue < 100000000000.0 ){
unitString = QString::fromLatin1("km");
factor = 10000000.0;