1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomValidators_BooleanArguments.h
4 // Created: 30 June 2015
5 // Author: Dmitry Bobylev
7 #include <GeomValidators_BooleanArguments.h>
9 #include <ModelAPI_AttributeInteger.h>
10 #include <ModelAPI_AttributeSelectionList.h>
12 //=================================================================================================
13 bool GeomValidators_BooleanArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
14 const std::list<std::string>& theArguments) const
16 if(theArguments.size() != 3) {
20 int anObjectsNb = 0, aToolsNb = 0;
21 int anOperationType = 0;
23 std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
25 std::shared_ptr<ModelAPI_AttributeSelectionList> anAttrSelList = theFeature->selectionList(*anIt);
27 anObjectsNb = anAttrSelList->size();
31 anAttrSelList = theFeature->selectionList(*anIt);
33 aToolsNb = anAttrSelList->size();
37 std::shared_ptr<ModelAPI_AttributeInteger> anAttrInt = theFeature->integer(*anIt);
39 anOperationType = anAttrInt->value();
42 if(anOperationType == 1 && (anObjectsNb + aToolsNb > 1)) {
44 } else if (anOperationType != 1 && anObjectsNb > 0 && aToolsNb > 0) {
51 //=================================================================================================
52 bool GeomValidators_BooleanArguments::isNotObligatory(std::string theFeature, std::string theAttribute)
54 if(theAttribute == "main_objects" || theAttribute == "tool_objects") {