- boost::shared_ptr<ModelAPI_AttributeDouble> aDouble =
- boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
- return aDouble->isInitialized() && aDouble->value() > 1.e-5;
+ double aMinValue = 1.e-5;
+ if(theArguments.size() == 1) {
+ std::list<std::string>::const_iterator anIt = theArguments.begin();
+ double aValue = Config_PropManager::stringToDouble((*anIt).c_str());
+ if(aValue != 0) {
+ // very probably ok
+ aMinValue = aValue;
+ }
+ }
+
+ if (theAttribute->attributeType() == ModelAPI_AttributeDouble::typeId()) {
+ AttributeDoublePtr aDouble =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
+ if (!aDouble->isInitialized()) {
+ theError = "Double is not initialized.";
+ return false;
+ }
+ if (aDouble->value() <= aMinValue) {
+ theError = "Value is too small.";
+ return false;
+ }
+ }
+
+ if (theAttribute->attributeType() == ModelAPI_AttributeInteger::typeId()) {
+ AttributeIntegerPtr aInteger =
+ std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(theAttribute);
+ if (!aInteger->isInitialized()) {
+ theError = "Integer is not initialized.";
+ return false;
+ }
+ if (aInteger->value() <= floor(aMinValue)) {
+ theError = "Integer is not positive.";
+ return false;
+ }
+ }
+
+ return true;