X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Validators.h;h=cd7a7d5336dba141f1df7bb9b44f8302130aad57;hb=61cd0845b41710ad4e7eae07cc6106904be67b9f;hp=0e94d7a70152f50fe66a01f4c65eea2a91b5e74d;hpb=88ca95388a92f9bbe96d81bf5b1456ca1179100e;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Validators.h b/src/SketchPlugin/SketchPlugin_Validators.h index 0e94d7a70..cd7a7d533 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.h +++ b/src/SketchPlugin/SketchPlugin_Validators.h @@ -8,7 +8,7 @@ #define SketchPlugin_Validators_H #include "SketchPlugin.h" -#include +#include /**\class SketchPlugin_DistanceAttrValidator * \ingroup Validators @@ -16,43 +16,115 @@ * * It just checks that distance is greater than zero. */ -class SketchPlugin_DistanceAttrValidator : public ModelAPI_RefAttrValidator +class SketchPlugin_DistanceAttrValidator : 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; - //! Returns true if object is good for the feature attribute - virtual bool isValid(const FeaturePtr& theFeature, const std::list& theArguments, - const ObjectPtr& theObject) const; - - //! Returns true if the attribute is good for the feature attribute - virtual bool isValid(const FeaturePtr& theFeature, const std::list& theArguments, - const AttributePtr& theAttribute) const { return true; }; + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments) const; }; -/**\class SketchPlugin_DifferentObjectsValidator + +/**\class SketchPlugin_TangentAttrValidator + * \ingroup Validators + * \brief Validator for the tangent constraint input. + * + * It just checks that distance is greater than zero. + */ +class SketchPlugin_TangentAttrValidator : 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; +}; + + +/**\class SketchPlugin_NotFixed * \ingroup Validators + * \brief Validator for the rigid constraint input. * - * Check that there is no same object was already selected in the feature. - * For an example: to avoid perpendicularity on line and the same line. + * It just checks there is no rigid constraint for the current feature. */ -class SketchPlugin_DifferentObjectsValidator : public ModelAPI_RefAttrValidator +class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is not used in another rigid constraint + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments) const; +}; + +/**\class SketchPlugin_EqualAttrValidator + * \ingroup Validators + * \brief Validator for the equal constraint input. + * + * It checks that attributes of the Equal constraint are correct. + */ +class SketchPlugin_EqualAttrValidator : 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; - //! Returns true if object is good for the feature attribute - virtual bool isValid(const FeaturePtr& theFeature, const std::list& theArguments, - const ObjectPtr& theObject) const; - //! Returns true if the attribute is good for the feature attribute - virtual bool isValid(const FeaturePtr& theFeature, const std::list& theArguments, - const AttributePtr& theAttribute) const; + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments) 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) 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) 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) const; }; #endif