GeomValidators_Face.h
GeomValidators_FeatureKind.h
GeomValidators_Finite.h
- GeomValidators_PartitionArguments.h
GeomValidators_Plugin.h
GeomValidators_Positive.h
GeomValidators_ShapeType.h
GeomValidators_Face.cpp
GeomValidators_FeatureKind.cpp
GeomValidators_Finite.cpp
- GeomValidators_PartitionArguments.cpp
GeomValidators_Plugin.cpp
GeomValidators_Positive.cpp
GeomValidators_ShapeType.cpp
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include <GeomValidators_PartitionArguments.h>
-
-#include <Events_InfoMessage.h>
-
-#include <ModelAPI_AttributeBoolean.h>
-#include <ModelAPI_AttributeSelectionList.h>
-
-//=================================================================================================
-bool GeomValidators_PartitionArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<std::string>& theArguments,
- Events_InfoMessage& theError) const
-{
- if(theArguments.size() != 3) {
- theError = "Wrong number of arguments (expected 3).";
- return false;
- }
-
- int anObjectsNb = 0, aToolsNb = 0;
- bool isCombine = true;
-
- std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
-
- std::shared_ptr<ModelAPI_AttributeSelectionList> anAttrSelList = theFeature->selectionList(*anIt);
- if(anAttrSelList) {
- anObjectsNb = anAttrSelList->size();
- }
- anIt++;
-
- anAttrSelList = theFeature->selectionList(*anIt);
- if(anAttrSelList) {
- aToolsNb = anAttrSelList->size();
- }
- anIt++;
-
- std::shared_ptr<ModelAPI_AttributeBoolean> anAttrBool = theFeature->boolean(*anIt);
- if(anAttrBool) {
- isCombine = anAttrBool->value();
- }
-
- if((anObjectsNb > 0 && aToolsNb > 0) ||
- (isCombine && anObjectsNb != 0 && (anObjectsNb + aToolsNb > 1))) {
- return true;
- }
-
- theError = "Not enough arguments";
- return false;
-}
-
-//=================================================================================================
-bool GeomValidators_PartitionArguments::isNotObligatory(std::string theFeature,
- std::string theAttribute)
-{
- if(theAttribute == "tool_objects") {
- return true;
- }
-
- return false;
-}
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef GeomValidators_PartitionArguments_H
-#define GeomValidators_PartitionArguments_H
-
-#include <GeomValidators.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_FeatureValidator.h>
-
-/** \class GeomValidators_PartitionArguments
- * \ingroup Validators
- * \brief Validates that partition operation have enough arguments.
- */
-class GeomValidators_PartitionArguments : public ModelAPI_FeatureValidator
-{
-public:
- /** \brief Returns true if feature and/or attributes are valid.
- * \param[in] theFeature the validated feature.
- * \param[in] theArguments the arguments in the configuration file for this validator.
- * \param[out] theError error message.
- * \returns true if feature is valid.
- */
- GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<std::string>& theArguments,
- Events_InfoMessage& theError) const;
-
- /// \return true if the attribute in feature is not obligatory for the feature execution.
- GEOMVALIDATORS_EXPORT virtual
- bool isNotObligatory(std::string theFeature, std::string theAttribute);
-};
-
-#endif
#include <GeomValidators_DifferentShapes.h>
#include <GeomValidators_Face.h>
#include <GeomValidators_Finite.h>
-#include <GeomValidators_PartitionArguments.h>
#include <GeomValidators_ShapeType.h>
#include <GeomValidators_ZeroOffset.h>
#include <GeomValidators_FeatureKind.h>
new GeomValidators_DifferentShapes);
aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite);
- aFactory->registerValidator("GeomValidators_PartitionArguments",
- new GeomValidators_PartitionArguments);
aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
aFactory->registerValidator("GeomValidators_ZeroOffset", new GeomValidators_ZeroOffset);
aFactory->registerValidator("GeomValidators_FeatureKind", new GeomValidators_FeatureKind);