X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Validators.h;h=951d4c52f969eb17ce2924d31fe0b5732e43c242;hb=7551606a6acc65c7ee1bc474ae36f118526c4ca6;hp=5824ce9dc08753ffb46219711eae7e46bee418ff;hpb=1c3738ae81b02ba62136ac03a53a81a532b95141;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.h b/src/FeaturesPlugin/FeaturesPlugin_Validators.h index 5824ce9dc..951d4c52f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2020 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 @@ -12,10 +12,9 @@ // // 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 +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef FeaturesPlugin_Validators_H_ @@ -41,8 +40,23 @@ public: /// \class FeaturesPlugin_ValidatorPipeLocations /// \ingroup Validators +/// \brief A validator for selection pipe locations. +class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_AttributeValidator +{ +public: + //! \return True if the attribute is valid. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + +/// \class FeaturesPlugin_ValidatorPipeLocationsNumber +/// \ingroup Validators /// \brief Validator for the pipe locations. -class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator +class FeaturesPlugin_ValidatorPipeLocationsNumber: public ModelAPI_FeatureValidator { public: //! \return true if number of selected locations the same as number of selected bases, or empty. @@ -57,7 +71,7 @@ class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator /// \class FeaturesPlugin_ValidatorBaseForGeneration /// \ingroup Validators /// \brief A validator for selection base for generation. Allows to select faces on sketch, -/// whole sketch(if it has at least one face), and following objects: vertex, edge, wire, face. +/// whole sketch (if it has at least one face), and following objects: vertex, edge, wire, face. class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator { public: @@ -127,6 +141,21 @@ private: Events_InfoMessage& theError) const; }; +/// \class FeaturesPlugin_ValidatorExtrusionBoundaryFace +/// \ingroup Validators +/// \brief A validator for extrusion from/to face attribute. +class FeaturesPlugin_ValidatorExtrusionBoundaryFace: public ModelAPI_AttributeValidator +{ +public: + //! \return true if attribute listed in the parameter arguments are planar. + //! \param[in] theFeature the checked feature. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + /// \class FeaturesPlugin_ValidatorBooleanSelection /// \ingroup Validators /// \brief Validates selection for boolean operation. @@ -159,6 +188,22 @@ public: Events_InfoMessage& theError) const; }; +/// \class FeaturesPlugin_ValidatorFillet1DSelection +/// \ingroup Validators +/// \brief Validates selection for 1d-fillet operation. +class FeaturesPlugin_ValidatorFillet1DSelection : public ModelAPI_AttributeValidator +{ +public: + /// \return True if the attribute is valid. It checks whether the selection + /// is acceptable for fillet on wire (vertex is a sharp corner). + /// \param[in] theAttribute an attribute to check. + /// \param[in] theArguments a filter parameters. + /// \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + /// \class FeaturesPlugin_ValidatorPartitionSelection /// \ingroup Validators /// \brief Validates selection for partition. @@ -267,4 +312,143 @@ public: Events_InfoMessage& theError) const; }; +/** \class FeaturesPlugin_ValidatorBooleanArguments +* \ingroup Validators +* \brief Validates that boolean operation have enough arguments. +*/ +class FeaturesPlugin_ValidatorBooleanArguments: 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. + */ + virtual bool isValid(const std::shared_ptr& theFeature, + const std::list& theArguments, + Events_InfoMessage& theError) const; + + /// \return true if the attribute in feature is not obligatory for the feature execution. + virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); +}; + +/// \class FeaturesPlugin_ValidatorBooleanSmashSelection +/// \ingroup Validators +/// \brief Verifies the selected object for boolean smash feature +class FeaturesPlugin_ValidatorBooleanSmashSelection: public ModelAPI_AttributeValidator +{ +public: + //! \return True if the attribute is valid. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + +/// \class FeaturesPlugin_IntersectionSelection +/// \ingroup Validators +/// \brief Verifies the selected object for intersection feature +class FeaturesPlugin_IntersectionSelection: public ModelAPI_AttributeValidator +{ +public: + //! \return True if the attribute is valid. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + +/// \class FeaturesPlugin_ValidatorBooleanFuseSelection +/// \ingroup Validators +/// \brief Verifies the selected object for boolean fuse feature +class FeaturesPlugin_ValidatorBooleanFuseSelection: public ModelAPI_AttributeValidator +{ +public: + //! \return True if the attribute is valid. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + +/** \class FeaturesPlugin_ValidatorBooleanFuseArguments +* \ingroup Validators +* \brief Validates that boolean operation have enough arguments. +*/ +class FeaturesPlugin_ValidatorBooleanFuseArguments: 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. + */ + virtual bool isValid(const std::shared_ptr& theFeature, + const std::list& theArguments, + Events_InfoMessage& theError) const; + + /// \return true if the attribute in feature is not obligatory for the feature execution. + virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); +}; + +/// \class FeaturesPlugin_ValidatorBooleanCommonSelection +/// \ingroup Validators +/// \brief Verifies the selected object for boolean common feature +class FeaturesPlugin_ValidatorBooleanCommonSelection: public ModelAPI_AttributeValidator +{ +public: + //! \return True if the attribute is valid. + //! \param[in] theAttribute the checked attribute. + //! \param[in] theArguments arguments of the attribute. + //! \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + +/** \class FeaturesPlugin_ValidatorBooleanCommonArguments +* \ingroup Validators +* \brief Validates that boolean operation have enough arguments. +*/ +class FeaturesPlugin_ValidatorBooleanCommonArguments: 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. + */ + virtual bool isValid(const std::shared_ptr& theFeature, + const std::list& theArguments, + Events_InfoMessage& theError) const; + + /// \return true if the attribute in feature is not obligatory for the feature execution. + virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); +}; + +/// \class FeaturesPlugin_ValidatorDefeaturingSelection +/// \ingroup Validators +/// \brief Validates selection for fillet operation. +class FeaturesPlugin_ValidatorDefeaturingSelection : public ModelAPI_AttributeValidator +{ +public: + /// \return True if the attribute is valid. It checks whether the selection + /// is acceptable for boolean operation. + /// \param[in] theAttribute an attribute to check. + /// \param[in] theArguments a filter parameters. + /// \param[out] theError error message. + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + #endif