some fixes in quantity
This commit is contained in:
parent
83e63a67b1
commit
75216d9d8c
|
@ -76,7 +76,7 @@ ID [a-z][a-z0-9]*
|
||||||
"'" yylval = Quantity::Foot; return UNIT; // foot
|
"'" yylval = Quantity::Foot; return UNIT; // foot
|
||||||
"thou" yylval = Quantity::Thou; return UNIT; // thou (in/1000)
|
"thou" yylval = Quantity::Thou; return UNIT; // thou (in/1000)
|
||||||
"mil" yylval = Quantity::Thou; return UNIT; // mil (the thou in US)
|
"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
|
"mi" yylval = Quantity::Mile; return UNIT; // mile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,17 @@ PyObject* QuantityPy::pow(PyObject * args)
|
||||||
|
|
||||||
PyObject* QuantityPy::getUserPrefered(PyObject *args)
|
PyObject* QuantityPy::getUserPrefered(PyObject *args)
|
||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
QString uus;
|
||||||
return 0;
|
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)
|
PyObject* QuantityPy::getValueAs(PyObject *args)
|
||||||
|
|
|
@ -55,7 +55,7 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor
|
||||||
factor = 1.0;
|
factor = 1.0;
|
||||||
}else if(UnitValue < 10000000.0){
|
}else if(UnitValue < 10000000.0){
|
||||||
unitString = QString::fromLatin1("m");
|
unitString = QString::fromLatin1("m");
|
||||||
factor = 10000.0;
|
factor = 1000.0;
|
||||||
}else if(UnitValue < 100000000000.0 ){
|
}else if(UnitValue < 100000000000.0 ){
|
||||||
unitString = QString::fromLatin1("km");
|
unitString = QString::fromLatin1("km");
|
||||||
factor = 10000000.0;
|
factor = 10000000.0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user