X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Validators.h;h=70120d614a640331a6f65fc1800d725591c2d710;hb=65b511870adccd85f3cf65e1b80466045abc1608;hp=6b1f29c0a12d1dbeab534f88a74610b639927849;hpb=bb4472b719a70fac9842ed33f16a4ce1f6877d79;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Validators.h b/src/SketchPlugin/SketchPlugin_Validators.h index 6b1f29c0a..70120d614 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 @@ -22,23 +23,10 @@ class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute + //! \param theError error message 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, + Events_InfoMessage& theError) const; }; /**\class SketchPlugin_TangentAttrValidator @@ -53,12 +41,14 @@ class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute + //! \param theError error message virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + Events_InfoMessage& theError) const; }; -/**\class SketchPlugin_NotFixed +/**\class SketchPlugin_NotFixedValidator * \ingroup Validators * \brief Validator for the rigid constraint input. * @@ -70,8 +60,10 @@ class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator //! returns true if attribute is not used in another rigid constraint //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute + //! \param theError error message virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + Events_InfoMessage& theError) const; }; /**\class SketchPlugin_EqualAttrValidator @@ -86,8 +78,10 @@ class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute + //! \param theError error message virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + Events_InfoMessage& theError) const; }; /**\class SketchPlugin_MirrorAttrValidator @@ -102,8 +96,10 @@ class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) + //! \param theError error message virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + Events_InfoMessage& theError) const; }; @@ -119,8 +115,10 @@ class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) + //! \param theError error message virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + Events_InfoMessage& theError) const; }; @@ -137,8 +135,140 @@ class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) + //! \param theError error message + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& 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) + //! \param theError error message + virtual bool isValid(const std::shared_ptr& theFeature, + const std::list& theArguments, + 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); +}; + +/**\class SketchPlugin_FilletVertexValidator + * \ingroup Validators + * \brief Validator for the point for fillet creation. + * + * Checks that selected point have exactly two coincident lines. + */ +class SketchPlugin_FilletVertexValidator : public ModelAPI_AttributeValidator +{ +public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute (not used) + //! \param theError error message + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + + +/**\class SketchPlugin_MiddlePointAttrValidator + * \ingroup Validators + * \brief Validator for the middle point constraint input. + * + * It checks that attributes of the Middle point constraint are correct. + */ +class SketchPlugin_MiddlePointAttrValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute (not used) + //! \param theError error message + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + + +/**\class SketchPlugin_ArcTangentPointValidator + * \ingroup Validators + * \brief Validator for the point where the tangent arc is building. + * + * Checks that the point is a start or end point just on line or arc. + */ +class SketchPlugin_ArcTangentPointValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute + //! \param theError error message + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + +/**\class SketchPlugin_SplitValidator + * \ingroup Validators + * \brief Validator for the entity of the following type: + * - Linear segment with point(s) coinident to this line + * - Arc with point(s) coincident to the arc + * - Circle with at least 2 split-points on this circle + * + * Checks that there are coincident point on selected feature. + */ +class SketchPlugin_SplitValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute + //! \param theError error message + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + +/**\class SketchPlugin_IntersectionValidator + * \ingroup Validators + * \brief Validator for the attribute to be intersected with the sketch plane. + */ +class SketchPlugin_IntersectionValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute + //! \param theError error message + virtual bool isValid(const AttributePtr& theAttribute, + const std::list& theArguments, + Events_InfoMessage& theError) const; +}; + +/**\class SketchPlugin_ProjectionValidator + * \ingroup Validators + * \brief Validator for the attribute to be projected onto the sketch plane. + */ +class SketchPlugin_ProjectionValidator : public ModelAPI_AttributeValidator +{ + public: + //! returns true if attribute is valid + //! \param theAttribute the checked attribute + //! \param theArguments arguments of the attribute + //! \param theError error message virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments) const; + const std::list& theArguments, + Events_InfoMessage& theError) const; }; #endif