diff --git a/src/App/PropertyStandard.cpp b/src/App/PropertyStandard.cpp index 02245e6caa..e0572d436d 100644 --- a/src/App/PropertyStandard.cpp +++ b/src/App/PropertyStandard.cpp @@ -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::min(); +} + +long PropertyIntegerConstraint::getMaximum() const +{ + if (_ConstStruct) + return _ConstStruct->UpperBound; + // return the max of int, not long + return std::numeric_limits::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::min(); +} + +double PropertyFloatConstraint::getMaximum() const +{ + if (_ConstStruct) + return _ConstStruct->UpperBound; + return std::numeric_limits::max(); +} + +double PropertyFloatConstraint::getStepSize() const +{ + if (_ConstStruct) + return _ConstStruct->StepSize; + return 1.0; +} + void PropertyFloatConstraint::setPyObject(PyObject *value) { if (PyFloat_Check(value)) { diff --git a/src/App/PropertyStandard.h b/src/App/PropertyStandard.h index 73e539e5cb..aa4557b1a5 100644 --- a/src/App/PropertyStandard.h +++ b/src/App/PropertyStandard.h @@ -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"; } diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp index 6e4e55d0da..36884cb81a 100644 --- a/src/App/PropertyUnits.cpp +++ b/src/App/PropertyUnits.cpp @@ -181,6 +181,27 @@ const PropertyQuantityConstraint::Constraints* PropertyQuantityConstraint::getC return _ConstStruct; } +double PropertyQuantityConstraint::getMinimum() const +{ + if (_ConstStruct) + return _ConstStruct->LowerBound; + return std::numeric_limits::min(); +} + +double PropertyQuantityConstraint::getMaximum() const +{ + if (_ConstStruct) + return _ConstStruct->UpperBound; + return std::numeric_limits::max(); +} + +double PropertyQuantityConstraint::getStepSize() const +{ + if (_ConstStruct) + return _ConstStruct->StepSize; + return 1.0; +} + void PropertyQuantityConstraint::setPyObject(PyObject *value) { Base::Quantity quant= createQuantityFromPy(value); diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h index 5421c13acc..a95a201d3f 100644 --- a/src/App/PropertyUnits.h +++ b/src/App/PropertyUnits.h @@ -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 *);