App: add convenience methods to get minimum, maximum and step size of property constraints

This commit is contained in:
wmayer
2021-03-03 08:12:03 +01:00
parent 20024707a9
commit 30e9ba9609
4 changed files with 77 additions and 0 deletions

View File

@@ -181,6 +181,27 @@ const PropertyQuantityConstraint::Constraints* PropertyQuantityConstraint::getC
return _ConstStruct;
}
double PropertyQuantityConstraint::getMinimum() const
{
if (_ConstStruct)
return _ConstStruct->LowerBound;
return std::numeric_limits<double>::min();
}
double PropertyQuantityConstraint::getMaximum() const
{
if (_ConstStruct)
return _ConstStruct->UpperBound;
return std::numeric_limits<double>::max();
}
double PropertyQuantityConstraint::getStepSize() const
{
if (_ConstStruct)
return _ConstStruct->StepSize;
return 1.0;
}
void PropertyQuantityConstraint::setPyObject(PyObject *value)
{
Base::Quantity quant= createQuantityFromPy(value);