1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_Validators.h
4 // Created: 01 Aug 2014
5 // Author: Vitaly SMETANNIKOV
7 #ifndef SketchPlugin_Validators_H
8 #define SketchPlugin_Validators_H
10 #include "SketchPlugin.h"
11 #include <ModelAPI_AttributeValidator.h>
12 #include <ModelAPI_FeatureValidator.h>
14 /**\class SketchPlugin_DistanceAttrValidator
16 * \brief Validator for the distance input.
18 * It just checks that distance is greater than zero.
20 class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator
23 //! returns true if attribute is valid
24 //! \param theAttribute the checked attribute
25 //! \param theArguments arguments of the attribute
26 virtual bool isValid(const AttributePtr& theAttribute,
27 const std::list<std::string>& theArguments,
28 std::string& theError) const;
31 /**\class SketchPlugin_TangentAttrValidator
33 * \brief Validator for the tangent constraint input.
35 * It just checks that distance is greater than zero.
37 class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator
40 //! returns true if attribute is valid
41 //! \param theAttribute the checked attribute
42 //! \param theArguments arguments of the attribute
43 virtual bool isValid(const AttributePtr& theAttribute,
44 const std::list<std::string>& theArguments,
45 std::string& theError) const;
49 /**\class SketchPlugin_NotFixed
51 * \brief Validator for the rigid constraint input.
53 * It just checks there is no rigid constraint for the current feature.
55 class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator
58 //! returns true if attribute is not used in another rigid constraint
59 //! \param theAttribute the checked attribute
60 //! \param theArguments arguments of the attribute
61 virtual bool isValid(const AttributePtr& theAttribute,
62 const std::list<std::string>& theArguments,
63 std::string& theError) const;
66 /**\class SketchPlugin_EqualAttrValidator
68 * \brief Validator for the equal constraint input.
70 * It checks that attributes of the Equal constraint are correct.
72 class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator
75 //! returns true if attribute is valid
76 //! \param theAttribute the checked attribute
77 //! \param theArguments arguments of the attribute
78 virtual bool isValid(const AttributePtr& theAttribute,
79 const std::list<std::string>& theArguments,
80 std::string& theError) const;
83 /**\class SketchPlugin_MirrorAttrValidator
85 * \brief Validator for the mirror constraint input.
87 * It checks that attributes of the Mirror constraint are correct.
89 class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator
92 //! returns true if attribute is valid
93 //! \param theAttribute the checked attribute
94 //! \param theArguments arguments of the attribute (not used)
95 virtual bool isValid(const AttributePtr& theAttribute,
96 const std::list<std::string>& theArguments,
97 std::string& theError) const;
101 /**\class SketchPlugin_CoincidenceAttrValidator
102 * \ingroup Validators
103 * \brief Validator for the coincidence constraint input.
105 * It checks that attributes of the Coincidence constraint are correct.
107 class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator
110 //! returns true if attribute is valid
111 //! \param theAttribute the checked attribute
112 //! \param theArguments arguments of the attribute (not used)
113 virtual bool isValid(const AttributePtr& theAttribute,
114 const std::list<std::string>& theArguments,
115 std::string& theError) const;
119 /**\class SketchPlugin_CopyValidator
120 * \ingroup Validators
121 * \brief Validator for the constraints which create features.
123 * Applicable only for features, which creates another features. It verifies the produced
124 * features of current constraint don't become into the list of initial features
126 class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator
129 //! returns true if attribute is valid
130 //! \param theAttribute the checked attribute
131 //! \param theArguments arguments of the attribute (not used)
132 virtual bool isValid(const AttributePtr& theAttribute,
133 const std::list<std::string>& theArguments,
134 std::string& theError) const;
137 /**\class SketchPlugin_SolverErrorValidator
138 * \ingroup Validators
139 * \brief Validator for the solver error.
141 * Simply checks that solver error attribute is empty. Returns the attribute value as an error.
143 class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator
146 //! returns true if there are no solver errors
147 //! \param theFeature the checked feature
148 //! \param theArguments arguments of the feature (not used)
149 virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
150 const std::list<std::string>& theArguments,
151 std::string& theError) const;
153 /// Returns true if the attribute in feature is not obligatory for the feature execution
154 virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);