App: add convenience methods to get minimum, maximum and step size of property constraints
This commit is contained in:
@@ -623,6 +623,29 @@ const PropertyIntegerConstraint::Constraints* PropertyIntegerConstraint::getCon
|
||||
return _ConstStruct;
|
||||
}
|
||||
|
||||
long PropertyIntegerConstraint::getMinimum() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->LowerBound;
|
||||
// return the min of int, not long
|
||||
return std::numeric_limits<int>::min();
|
||||
}
|
||||
|
||||
long PropertyIntegerConstraint::getMaximum() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->UpperBound;
|
||||
// return the max of int, not long
|
||||
return std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
long PropertyIntegerConstraint::getStepSize() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->StepSize;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void PropertyIntegerConstraint::setPyObject(PyObject *value)
|
||||
{
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
@@ -1102,6 +1125,27 @@ const PropertyFloatConstraint::Constraints* PropertyFloatConstraint::getConstra
|
||||
return _ConstStruct;
|
||||
}
|
||||
|
||||
double PropertyFloatConstraint::getMinimum() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->LowerBound;
|
||||
return std::numeric_limits<double>::min();
|
||||
}
|
||||
|
||||
double PropertyFloatConstraint::getMaximum() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->UpperBound;
|
||||
return std::numeric_limits<double>::max();
|
||||
}
|
||||
|
||||
double PropertyFloatConstraint::getStepSize() const
|
||||
{
|
||||
if (_ConstStruct)
|
||||
return _ConstStruct->StepSize;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
void PropertyFloatConstraint::setPyObject(PyObject *value)
|
||||
{
|
||||
if (PyFloat_Check(value)) {
|
||||
|
||||
@@ -281,6 +281,10 @@ public:
|
||||
const Constraints* getConstraints(void) const;
|
||||
//@}
|
||||
|
||||
long getMinimum() const;
|
||||
long getMaximum() const;
|
||||
long getStepSize() const;
|
||||
|
||||
virtual const char* getEditorName(void) const { return "Gui::PropertyEditor::PropertyIntegerConstraintItem"; }
|
||||
virtual void setPyObject(PyObject *);
|
||||
|
||||
@@ -561,6 +565,10 @@ public:
|
||||
const Constraints* getConstraints(void) const;
|
||||
//@}
|
||||
|
||||
double getMinimum() const;
|
||||
double getMaximum() const;
|
||||
double getStepSize() const;
|
||||
|
||||
virtual const char* getEditorName(void) const
|
||||
{ return "Gui::PropertyEditor::PropertyFloatConstraintItem"; }
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -106,6 +106,10 @@ public:
|
||||
const Constraints* getConstraints(void) const;
|
||||
//@}
|
||||
|
||||
double getMinimum() const;
|
||||
double getMaximum() const;
|
||||
double getStepSize() const;
|
||||
|
||||
virtual const char* getEditorName(void) const;
|
||||
virtual void setPyObject(PyObject *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user