1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomValidators_BooleanArguments.cpp
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,
15 std::string& theError) const
17 if(theArguments.size() != 3) {
21 int anObjectsNb = 0, aToolsNb = 0;
22 int anOperationType = 0;
24 std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
26 std::shared_ptr<ModelAPI_AttributeSelectionList> anAttrSelList = theFeature->selectionList(*anIt);
28 anObjectsNb = anAttrSelList->size();
32 anAttrSelList = theFeature->selectionList(*anIt);
34 aToolsNb = anAttrSelList->size();
38 std::shared_ptr<ModelAPI_AttributeInteger> anAttrInt = theFeature->integer(*anIt);
40 anOperationType = anAttrInt->value();
43 if(anOperationType == 1 && (anObjectsNb + aToolsNb > 1)) {
45 } else if (anOperationType != 1 && anObjectsNb > 0 && aToolsNb > 0) {
52 //=================================================================================================
53 bool GeomValidators_BooleanArguments::isNotObligatory(std::string theFeature, std::string theAttribute)
55 if(theAttribute == "main_objects" || theAttribute == "tool_objects") {