X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Validators.h;h=7016177d51799ab22fb5ece8476395911a2af7f1;hb=64fc7e4fdd63997ec7a502b233ef5f88186d5bbb;hp=6b1f29c0a12d1dbeab534f88a74610b639927849;hpb=74da3f1682a21155302ebd0f5eb69ecc27a08c52;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Validators.h b/src/SketchPlugin/SketchPlugin_Validators.h index 6b1f29c0a..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,22 +24,8 @@ 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; -}; - -/**\class SketchPlugin_CoincidentAttr - * \ingroup Validators - * \brief Validator to check whether there is a coincident constraint between - * the attribute and attribute of argument. - */ -class SketchPlugin_CoincidentAttr : public ModelAPI_AttributeValidator -{ - public: - //! returns true if attribute is valid - //! \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 @@ -54,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; }; @@ -71,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 @@ -87,7 +76,8 @@ 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 @@ -103,7 +93,8 @@ class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; }; @@ -120,7 +111,8 @@ class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + std::string& theError) const; }; @@ -138,7 +130,28 @@ class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + 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