]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Correction of validator for point to point distance
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 6 Mar 2015 08:14:59 +0000 (11:14 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Fri, 6 Mar 2015 08:14:59 +0000 (11:14 +0300)
src/PartSet/PartSet_Validators.cpp

index 278c3e637906497337b4230cf972e978c90ed773..92100792ede4fba1b1c3a64555721c790578786b 100644 (file)
@@ -164,7 +164,22 @@ bool PartSet_DifferentObjectsValidator::isValid(const FeaturePtr& theFeature,
                                                 const std::list<std::string>& theArguments,
                                                 const AttributePtr& theAttribute) const
 {
-  return PartSet_DifferentObjectsValidator::isValid(theAttribute, theArguments);
+  if (PartSet_DifferentObjectsValidator::isValid(theAttribute, theArguments)) {
+    std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs = 
+      theFeature->data()->attributes(ModelAPI_AttributeRefAttr::type());
+    std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
+    for(; anAttr != anAttrs.end(); anAttr++) {
+      if (*anAttr) {
+        std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = 
+          std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttr);
+        // check the object is already presented
+        if (!aRef->isObject() && aRef->attr() == theAttribute)
+          return false;
+      }
+    }
+    return true;
+  }
+  return false;
 }
 
 bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute,