+ bool isValid = false;
+
+ std::string anAttributeType = theAttribute->attributeType();
+ bool isList = anAttributeType == ModelAPI_AttributeSelectionList::typeId();
+
+ std::list<AttributePtr> anAttrs;
+ if (isList) {
+ AttributeSelectionListPtr aListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
+ // get all selection attributes from the list
+ for (int anIndex = 0; anIndex < aListAttr->size(); ++anIndex) {
+ anAttrs.push_back(aListAttr->value(anIndex));
+ }
+
+ isValid = checkEquals(anAttrs);
+ }
+ else {
+ // get all feature selection attributes
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
+ anAttrs = aFeature->data()->attributes(ModelAPI_AttributeSelection::typeId());
+
+ isValid = checkEqualToCurrent(anAttrs, theAttribute);
+ }
+
+ if (!isValid) {
+ theError = isList ? "The selection list contains equal shapes." :
+ "The feature uses equal shapes.";
+ return false;
+ }
+
+ return true;
+}
+
+//=================================================================================================
+bool GeomValidators_DifferentShapes::checkEquals(std::list<AttributePtr>& theAttributes)
+{
+ std::list<AttributePtr>::iterator anIt = theAttributes.begin();
+ for (; anIt != theAttributes.end(); anIt++) {
+ AttributePtr anAttribute = *anIt;
+
+ std::list<AttributePtr>::iterator anOthersIt = std::next(anIt);
+ for (; anOthersIt != theAttributes.end(); anOthersIt++) {
+ AttributePtr anOtherAttribute = *anOthersIt;
+ if (isAttrShapesEqual(anAttribute, anOtherAttribute)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+//=================================================================================================
+bool GeomValidators_DifferentShapes::checkEqualToCurrent(std::list<AttributePtr>& theAttributes,
+ const AttributePtr& theCurrentAttribute)
+{