X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Validators.h;h=7016177d51799ab22fb5ece8476395911a2af7f1;hb=22b8f7fe2eccd1eeee183f52834b191b1e904dc3;hp=47df3706156129b4cfacac9f4891d6bc0b733bc9;hpb=f303e0ac953271787efce9c96845b41db3d4dcb9;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Validators.h b/src/SketchPlugin/SketchPlugin_Validators.h index 47df37061..7016177d5 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.h +++ b/src/SketchPlugin/SketchPlugin_Validators.h @@ -9,6 +9,7 @@ #include "SketchPlugin.h" #include +#include /**\class SketchPlugin_DistanceAttrValidator * \ingroup Validators @@ -23,10 +24,10 @@ class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; }; - /**\class SketchPlugin_TangentAttrValidator * \ingroup Validators * \brief Validator for the tangent constraint input. @@ -40,7 +41,8 @@ class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; }; @@ -57,7 +59,8 @@ class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; }; /**\class SketchPlugin_EqualAttrValidator @@ -73,8 +76,82 @@ class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; +}; + +/**\class SketchPlugin_MirrorAttrValidator + * \ingroup Validators + * \brief Validator for the mirror constraint input. + * + * It checks that attributes of the Mirror constraint are correct. + */ +class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute (not used) + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + std::string& theError) const; +}; + + +/**\class SketchPlugin_CoincidenceAttrValidator + * \ingroup Validators + * \brief Validator for the coincidence constraint input. + * + * It checks that attributes of the Coincidence constraint are correct. + */ +class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute (not used) + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + std::string& theError) const; +}; + + +/**\class SketchPlugin_CopyValidator + * \ingroup Validators + * \brief Validator for the constraints which create features. + * + * Applicable only for features, which creates another features. It verifies the produced + * features of current constraint don't become into the list of initial features + */ +class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute (not used) + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + std::string& theError) const; }; +/**\class SketchPlugin_SolverErrorValidator + * \ingroup Validators + * \brief Validator for the solver error. + * + * Simply checks that solver error attribute is empty. Returns the attribute value as an error. + */ +class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator +{ + public: + //! returns true if there are no solver errors + //! \param theFeature the checked feature + //! \param theArguments arguments of the feature (not used) + virtual bool isValid(const std::shared_ptr& theFeature, + const std::list& theArguments, + std::string& 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); +}; #endif