Salome HOME
Issue #817: Be able to export the whole part.
[modules/shaper.git] / src / GeomValidators / GeomValidators_Finite.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomValidators_Finite.cpp
4 // Created:     27 Aug 2015
5 // Author:      Natalia ERMOLAEVA
6
7 #include <GeomValidators_Finite.h>
8
9 #include <ModelAPI_AttributeSelectionList.h>
10 #include <ModelAPI_ResultConstruction.h>
11
12 bool GeomValidators_Finite::isValid(const AttributePtr& theAttribute,
13                                    const std::list<std::string>& theArguments,
14                                    std::string& theError) const
15 {
16   bool aValid = true;
17
18   if (theAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) {
19     AttributeSelectionListPtr aSelectionListAttr = 
20                       std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
21     for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) {
22       AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i);
23       ResultPtr aResult = aSelectAttr->context();
24       if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) {
25         ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
26         if (aConstruction.get() && aConstruction->isInfinite()) {
27           aValid = false;
28         }
29       }
30     }
31   }
32   return aValid;
33 }
34