X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Validators.h;h=d01605463efc0bd9577bc6c719b7660513927863;hb=596cc06a3cdc89783d15e893e7da4b6b882fb442;hp=66006583f85656277ed0d334283aa539eba35fbd;hpb=c44cee9c2c5f83a58f172a47037a8d9035e29b94;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.h b/src/FeaturesPlugin/FeaturesPlugin_Validators.h index 66006583f..d01605463 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.h @@ -10,6 +10,21 @@ #include #include +/// \class FeaturesPlugin_ValidatorPipePath +/// \ingroup Validators +/// \brief A validator for selection pipe path. +class FeaturesPlugin_ValidatorPipePath: 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_ValidatorPipeLocations /// \ingroup Validators /// \brief Validator for the pipe locations. @@ -22,7 +37,7 @@ class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator //! \param theError error message virtual bool isValid(const std::shared_ptr& theFeature, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; /// Returns true if the attribute in feature is not obligatory for the feature execution virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); @@ -35,18 +50,18 @@ class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator class FeaturesPlugin_ValidatorBaseForGeneration: public ModelAPI_AttributeValidator { public: - //! Returns true if attribute has selection type listed in the parameter arguments. + //! \return true if attribute has selection type listed in the parameter arguments. //! \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, - std::string& theError) const; + Events_InfoMessage& theError) const; private: bool isValidAttribute(const AttributePtr& theAttribute, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; }; /// \class FeaturesPlugin_ValidatorCompositeLauncher @@ -55,53 +70,151 @@ private: class FeaturesPlugin_ValidatorCompositeLauncher: public ModelAPI_AttributeValidator { public: - //! Returns true if attribute has selection type listed in the parameter arguments. + //! \return true if attribute has selection type listed in the parameter arguments. //! \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, - std::string& theError) const; + Events_InfoMessage& theError) const; }; -/// \class FeaturesPlugin_ValidatorCanBeEmpty +/// \class FeaturesPlugin_ValidatorExtrusionDir /// \ingroup Validators -/// \brief A validator for extrusion direction attribute and bounding planes for extrusion and -/// revolution. Allows them to be empty if base objects are planar and do not contain -/// vertices and edges. -class FeaturesPlugin_ValidatorCanBeEmpty: public ModelAPI_FeatureValidator +/// \brief A validator for extrusion direction attribute. Allows it to be empty if base objects are +/// planar and do not contain vertices and edges. +class FeaturesPlugin_ValidatorExtrusionDir: public ModelAPI_FeatureValidator { public: - //! Returns true if attribute listed in the parameter arguments are planar. + //! \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 std::shared_ptr& theFeature, const std::list& theArguments, - std::string& theError) const; + Events_InfoMessage& theError) const; - /// Returns true if the attribute in feature is not obligatory for the feature execution + /// \return true if the attribute in feature is not obligatory for the feature execution virtual bool isNotObligatory(std::string theFeature, std::string theAttribute); private: bool isShapesCanBeEmpty(const AttributePtr& theAttribute, - std::string& theError) const; + Events_InfoMessage& theError) const; +}; + +/// \class FeaturesPlugin_ValidatorBooleanSelection +/// \ingroup Validators +/// \brief Validates selection for boolean operation. +class FeaturesPlugin_ValidatorBooleanSelection: 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; +}; + +/// \class FeaturesPlugin_ValidatorPartitionSelection +/// \ingroup Validators +/// \brief Validates selection for partition. +class FeaturesPlugin_ValidatorPartitionSelection: public ModelAPI_AttributeValidator +{ +public: + /// \return True if the attribute is valid. It checks whether the selection + /// is acceptable for 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; }; -/// \class FeaturesPlugin_ValidatorBaseForWire +/// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection /// \ingroup Validators -/// \brief A validator for selection base shapes for wire. Allows to select edges on sketch and -/// wires objects that are connected to already selected shapes. -class FeaturesPlugin_ValidatorBaseForWire: public ModelAPI_AttributeValidator +/// \brief Validates selection for "Remove Sub-Shapes" feature. +class FeaturesPlugin_ValidatorRemoveSubShapesSelection: public ModelAPI_AttributeValidator { public: - //! Returns true if attribute is ok. + /// \return True if the attribute is valid. It checks whether the selection + /// is acceptable for 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; +}; + +/// \class FeaturesPlugin_ValidatorRemoveSubShapesResult +/// \ingroup Validators +/// \brief Validator for the Remove Sub-Shapes feature. +class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureValidator +{ + public: + //! \return true if result is valid shape. + //! \param theFeature the checked feature + //! \param theArguments arguments of the feature (not used) + //! \param theError error message + 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_ValidatorUnionSelection +/// \ingroup Validators +/// \brief Validates selection for "Union" feature. +class FeaturesPlugin_ValidatorUnionSelection: public ModelAPI_AttributeValidator +{ +public: + /// \return True if the attribute is valid. It checks whether the selection + /// is acceptable for 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; +}; + +/// \class FeaturesPlugin_ValidatorUnionArguments +/// \ingroup Validators +/// \brief Validator for the "Union" feature. +class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator +{ + public: + //! \return true if result is valid shape. + //! \param theFeature the checked feature + //! \param theArguments arguments of the feature (not used) + //! \param theError error message + 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_ValidatorConcealedResult +/// \ingroup Validators +/// \brief Validator for the "Recover" feature. +class FeaturesPlugin_ValidatorConcealedResult: 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, - std::string& theError) const; + Events_InfoMessage& theError) const; }; #endif